KiCad PCB EDA Suite
gpcb_plugin.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 Wayne Stambaugh <stambaughw@verizon.net>
5  * Copyright (C) 1992-2016 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 _GPCB_PLUGIN_H_
31 #define _GPCB_PLUGIN_H_
32 
33 #include <io_mgr.h>
34 #include <string>
35 
36 
37 class GPCB_FPL_CACHE;
38 
39 
47 class GPCB_PLUGIN : public PLUGIN
48 {
49  friend class GPCB_FPL_CACHE;
50 
51 public:
52 
53  //-----<PLUGIN API>---------------------------------------------------------
54 
55  const wxString PluginName() const override
56  {
57  return wxT( "Geda PCB" );
58  }
59 
60  const wxString GetFileExtension() const override
61  {
62  return wxT( "fp" );
63  }
64 
65  wxArrayString FootprintEnumerate( const wxString& aLibraryPath,
66  const PROPERTIES* aProperties = NULL) override;
67 
68  MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
69  const PROPERTIES* aProperties = NULL ) override;
70 
71  void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
72  const PROPERTIES* aProperties = NULL ) override;
73 
74  bool FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ) override;
75 
76  bool IsFootprintLibWritable( const wxString& aLibraryPath ) override;
77 
78  //-----</PLUGIN API>--------------------------------------------------------
79 
80  GPCB_PLUGIN();
81 
82  GPCB_PLUGIN( int aControlFlags );
83 
84  ~GPCB_PLUGIN();
85 
86 protected:
87 
88  wxString m_error;
91  int m_ctl;
93  wxString m_filename;
94 
95 private:
97  void cacheLib( const wxString& aLibraryPath, const wxString& aFootprintName = wxEmptyString );
98 
99  void init( const PROPERTIES* aProperties );
100 };
101 
102 #endif // _GPCB_PLUGIN_H_
Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived...
Definition: richio.h:81
Class GPCB_PLUGIN is a PLUGIN derivation for saving and loading Geda PCB files.
Definition: gpcb_plugin.h:47
wxArrayString FootprintEnumerate(const wxString &aLibraryPath, const PROPERTIES *aProperties=NULL) override
Function FootprintEnumerate returns a list of footprint names contained within the library at aLibrar...
MODULE * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, const PROPERTIES *aProperties=NULL) override
Function FootprintLoad loads a footprint having aFootprintName from the aLibraryPath containing a lib...
bool IsFootprintLibWritable(const wxString &aLibraryPath) override
Function IsFootprintLibWritable returns true iff the library at aLibraryPath is writable.
void cacheLib(const wxString &aLibraryPath, const wxString &aFootprintName=wxEmptyString)
we only cache one footprint library for now, this determines which one.
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
void init(const PROPERTIES *aProperties)
GPCB_FPL_CACHE * m_cache
Footprint library cache.
Definition: gpcb_plugin.h:90
const wxString PluginName() const override
Function PluginName returns a brief hard coded name for this PLUGIN.
Definition: gpcb_plugin.h:55
const PROPERTIES * m_props
passed via Save() or Load(), no ownership, may be NULL.
Definition: gpcb_plugin.h:89
const wxString GetFileExtension() const override
Function GetFileExtension returns the file extension for the PLUGIN.
Definition: gpcb_plugin.h:60
bool FootprintLibDelete(const wxString &aLibraryPath, const PROPERTIES *aProperties=NULL) override
Function FootprintLibDelete deletes an existing footprint library and returns true, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason.
Class PLUGIN is a base class that BOARD loading and saving plugins should derive from.
Definition: io_mgr.h:193
LINE_READER * m_reader
no ownership here.
Definition: gpcb_plugin.h:92
void FootprintDelete(const wxString &aLibraryPath, const wxString &aFootprintName, const PROPERTIES *aProperties=NULL) override
Function FootprintDelete deletes aFootprintName from the library at aLibraryPath. ...
wxString m_error
for throwing exceptions
Definition: gpcb_plugin.h:88
wxString m_filename
for saves only, name is in m_reader for loads
Definition: gpcb_plugin.h:93