98 std::function<
PLUGIN*(
void)> aCreateFunc )
111 if ( ent.m_type == aFileType )
113 return ent.m_createFunc();
141 std::function<
PLUGIN*(
void)> aCreateFunc )
287 wxString aAction )> aCallback )
318 virtual BOARD*
Load(
const wxString& aFileName,
BOARD* aAppendToMe,
350 virtual void Save(
const wxString& aFileName,
BOARD* aBoard,
367 virtual void FootprintEnumerate( wxArrayString& aFootprintNames,
const wxString& aLibraryPath,
395 virtual void PrefetchLib(
const wxString& aLibraryPath,
420 const wxString& aFootprintName,
421 bool aKeepUUID =
false,
429 const wxString& aFootprintName,
435 virtual bool FootprintExists(
const wxString& aLibraryPath,
const wxString& aFootprintName,
471 virtual void FootprintDelete(
const wxString& aLibraryPath,
const wxString& aFootprintName,
Information pertinent to a Pcbnew printed circuit board.
Hold a list of available plugins, created using a singleton REGISTER_PLUGIN object.
std::vector< ENTRY > m_plugins
PLUGIN * Create(PCB_FILE_T aFileType) const
const std::vector< ENTRY > & AllPlugins() const
static PLUGIN_REGISTRY * Instance()
void Register(PCB_FILE_T aType, const wxString &aName, std::function< PLUGIN *(void)> aCreateFunc)
A factory which returns an instance of a PLUGIN.
static const wxString ShowType(PCB_FILE_T aFileType)
Return a brief name for a plugin given aFileType enum.
static void PluginRelease(PLUGIN *aPlugin)
Release a PLUGIN back to the system and may cause it to be unloaded from memory.
static const wxString GetFileExtension(PCB_FILE_T aFileType)
Return the file extension for aFileType.
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Return a plugin type given a footprint library's libPath.
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
@ LEGACY
Legacy Pcbnew file formats prior to s-expression.
@ KICAD_SEXP
S-expression Pcbnew file format.
@ GEDA_PCB
Geda PCB file formats.
static PCB_FILE_T EnumFromStr(const wxString &aFileType)
Return the PCB_FILE_T from the corresponding plugin type name: "kicad", "legacy", etc.
static BOARD * Load(PCB_FILE_T aFileType, const wxString &aFileName, BOARD *aAppendToMe=nullptr, const STRING_UTF8_MAP *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Find the requested PLUGIN and if found, calls the PLUGIN::Load() function on it using the arguments p...
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
static void Save(PCB_FILE_T aFileType, const wxString &aFileName, BOARD *aBoard, const STRING_UTF8_MAP *aProperties=nullptr)
Write either a full aBoard to a storage file in a format that this implementation knows about,...
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
RELEASER(const RELEASER &aOther)
RELEASER & operator=(RELEASER &aOther)
RELEASER(PLUGIN *aPlugin=nullptr)
PLUGIN * operator->() const
void set(PLUGIN *aPlugin)
A base class that BOARD loading and saving plugins should derive from.
virtual void SetQueryUserCallback(std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aAction)> aCallback)
Registers a KIDIALOG callback for collecting info from the user.
virtual const FOOTPRINT * GetEnumeratedFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
virtual void FootprintLibCreate(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Create a new empty footprint library at aLibraryPath empty.
virtual bool FootprintLibDelete(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Delete an existing footprint library and returns true, or if library does not exist returns false,...
virtual void Save(const wxString &aFileName, BOARD *aBoard, const STRING_UTF8_MAP *aProperties=nullptr)
Write aBoard to a storage file in a format that this PLUGIN implementation knows about or it can be u...
virtual BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const STRING_UTF8_MAP *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Load information from some input file format that this PLUGIN implementation knows about into either ...
virtual void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const STRING_UTF8_MAP *aProperties=nullptr)
Write aFootprint to an existing library located at aLibraryPath.
virtual std::vector< FOOTPRINT * > GetImportedCachedLibraryFootprints()
Return a container with the cached library footprints generated in the last call to Load.
virtual void FootprintDelete(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
Delete aFootprintName from the library at aLibraryPath.
virtual bool FootprintExists(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
Check for the existence of a footprint.
virtual FOOTPRINT * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const STRING_UTF8_MAP *aProperties=nullptr)
Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PL...
virtual bool IsFootprintLibWritable(const wxString &aLibraryPath)
Return true if the library at aLibraryPath is writable.
virtual const wxString PluginName() const =0
Return a brief hard coded name for this PLUGIN.
virtual const wxString GetFileExtension() const =0
Returns the file extension for the PLUGIN.
virtual long long GetLibraryTimestamp(const wxString &aLibraryPath) const =0
Generate a timestamp representing all the files in the library (including the library directory).
virtual void FootprintLibOptions(STRING_UTF8_MAP *aListToAppendTo) const
Append supported PLUGIN options to aListToAppenTo along with internationalized descriptions.
virtual void PrefetchLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
If possible, prefetches the specified library (e.g.
virtual void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const STRING_UTF8_MAP *aProperties=nullptr)
Return a list of footprint names contained within the library at aLibraryPath.
A progress reporter interface for use in multi-threaded environments.
Container for project specific data.
A name/value tuple with unique names and optional values.
std::function< PLUGIN *(void)> m_createFunc
REGISTER_PLUGIN(PCB_FILE_T aType, const wxString &aName, std::function< PLUGIN *(void)> aCreateFunc)