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-2023 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 STRING_UTF8_MAP* aProperties ) override;
63
64 void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
65 bool aBestEfforts,
66 const STRING_UTF8_MAP* aProperties = nullptr ) override;
67
68 const FOOTPRINT* GetEnumeratedFootprint( const wxString& aLibraryPath,
69 const wxString& aFootprintName,
70 const STRING_UTF8_MAP* aProperties = nullptr ) override;
71
72 FOOTPRINT* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
73 bool aKeepUUID = false,
74 const STRING_UTF8_MAP* aProperties = nullptr ) override;
75
76 void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
77 const STRING_UTF8_MAP* aProperties = nullptr ) override;
78
79 bool DeleteLibrary( const wxString& aLibraryPath,
80 const STRING_UTF8_MAP* aProperties = nullptr ) override;
81
82 long long GetLibraryTimestamp( const wxString& aLibraryPath ) const override;
83
84 bool IsLibraryWritable( const wxString& aLibraryPath ) override;
85
86 //-----</PLUGIN API>--------------------------------------------------------
87
89
90 PCB_IO_GEDA( int aControlFlags );
91
93
94private:
95 void validateCache( const wxString& aLibraryPath, bool checkModified = true );
96
97 const FOOTPRINT* getFootprint( const wxString& aLibraryPath, const wxString& aFootprintName,
98 const STRING_UTF8_MAP* aProperties, bool checkModified );
99
100 void init( const STRING_UTF8_MAP* aProperties );
101
102 friend class GPCB_FPL_CACHE;
103
104protected:
105 wxString m_error;
107 int m_ctl;
109 wxString m_filename;
110};
111
112#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
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
void init(const STRING_UTF8_MAP *aProperties)
void FootprintDelete(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr) override
Delete aFootprintName from the library at aLibraryPath.
const FOOTPRINT * getFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties, bool checkModified)
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.
long long GetLibraryTimestamp(const wxString &aLibraryPath) const override
Generate a timestamp representing all the files in the library (including the library directory).
wxString m_filename
for saves only, name is in m_reader for loads
Definition: pcb_io_geda.h:109
GPCB_FPL_CACHE * m_cache
Footprint library cache.
Definition: pcb_io_geda.h:106
void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const STRING_UTF8_MAP *aProperties=nullptr) override
Return a list of footprint names contained within the library at aLibraryPath.
bool DeleteLibrary(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override
Delete an existing library and returns true, or if library does not exist returns false,...
FOOTPRINT * ImportFootprint(const wxString &aFootprintPath, wxString &aFootprintNameOut, const STRING_UTF8_MAP *aProperties) override
Load a single footprint from aFootprintPath and put its name in aFootprintNameOut.
void validateCache(const wxString &aLibraryPath, bool checkModified=true)
const FOOTPRINT * GetEnumeratedFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr) override
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
LINE_READER * m_reader
no ownership here.
Definition: pcb_io_geda.h:108
FOOTPRINT * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const STRING_UTF8_MAP *aProperties=nullptr) override
Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PC...
wxString m_error
for throwing exceptions
Definition: pcb_io_geda.h:105
A base class that BOARD loading and saving plugins should derive from.
Definition: pcb_io.h:72
A name/value tuple with unique names and optional values.
#define _HKI(x)
Container that describes file type info.
Definition: io_base.h:39