KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_io_geda.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2012-2020 Wayne Stambaugh <[email protected]>
5 * Copyright (C) 2012-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
30#ifndef PCB_IO_GEDA_H_
31#define PCB_IO_GEDA_H_
32
33#include <string>
34
35#include <pcb_io/pcb_io.h>
36#include <pcb_io/pcb_io_mgr.h>
37
38class GPCB_FPL_CACHE;
39class LINE_READER;
40
47class PCB_IO_GEDA : public PCB_IO
48{
49public:
51 {
52 return IO_BASE::IO_FILE_DESC( _HKI( "gEDA PCB footprint file" ), { "fp" } );
53 }
54
56 {
57 return IO_BASE::IO_FILE_DESC( _HKI( "gEDA PCB footprint library directory" ), {}, { "fp" },
58 false );
59 }
60
61 FOOTPRINT* ImportFootprint( const wxString& aFootprintPath, wxString& aFootprintNameOut,
62 const std::map<std::string, UTF8>* aProperties ) override;
63
64 void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
65 bool aBestEfforts,
66 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
67
68 FOOTPRINT* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
69 bool aKeepUUID = false,
70 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
71
72 void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
73 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
74
75 bool DeleteLibrary( const wxString& aLibraryPath,
76 const std::map<std::string, UTF8>* aProperties = nullptr ) override;
77
78 long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
79
80 bool IsLibraryWritable( const wxString& aLibraryPath ) override;
81
82 //-----</PLUGIN API>--------------------------------------------------------
83
85
86 PCB_IO_GEDA( int aControlFlags );
87
89
90private:
91 void validateCache( const wxString& aLibraryPath, bool checkModified = true );
92
93 const FOOTPRINT* getFootprint( const wxString& aLibraryPath, const wxString& aFootprintName,
94 const std::map<std::string, UTF8>* aProperties, bool checkModified );
95
96 void init( const std::map<std::string, UTF8>* aProperties );
97
98 friend class GPCB_FPL_CACHE;
99
100protected:
101 wxString m_error;
103 int m_ctl;
105 wxString m_filename;
106};
107
108#endif // PCB_IO_GEDA_H_
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:93
A #PLUGIN derivation for saving and loading Geda PCB files.
Definition: pcb_io_geda.h:48
void FootprintDelete(const wxString &aLibraryPath, const wxString &aFootprintName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Delete aFootprintName from the library at aLibraryPath.
const IO_BASE::IO_FILE_DESC GetLibraryFileDesc() const override
Get the descriptor for the individual library elements that this IO plugin operates on.
Definition: pcb_io_geda.h:50
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
Get the descriptor for the library container that this IO plugin operates on.
Definition: pcb_io_geda.h:55
bool IsLibraryWritable(const wxString &aLibraryPath) override
Return true if the library at aLibraryPath is writable.
void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Return a list of footprint names contained within the library at aLibraryPath.
long long GetLibraryTimestamp(const wxString &aLibraryPath) const override
Generate a timestamp representing all the files in the library (including the library directory).
bool DeleteLibrary(const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Delete an existing library and returns true, or if library does not exist returns false,...
wxString m_filename
for saves only, name is in m_reader for loads
Definition: pcb_io_geda.h:105
FOOTPRINT * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PC...
void init(const std::map< std::string, UTF8 > *aProperties)
GPCB_FPL_CACHE * m_cache
Footprint library cache.
Definition: pcb_io_geda.h:102
void validateCache(const wxString &aLibraryPath, bool checkModified=true)
LINE_READER * m_reader
no ownership here.
Definition: pcb_io_geda.h:104
FOOTPRINT * ImportFootprint(const wxString &aFootprintPath, wxString &aFootprintNameOut, const std::map< std::string, UTF8 > *aProperties) override
Load a single footprint from aFootprintPath and put its name in aFootprintNameOut.
const FOOTPRINT * getFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const std::map< std::string, UTF8 > *aProperties, bool checkModified)
wxString m_error
for throwing exceptions
Definition: pcb_io_geda.h:101
A base class that BOARD loading and saving plugins should derive from.
Definition: pcb_io.h:71
#define _HKI(x)
Container that describes file type info.
Definition: io_base.h:43