KiCad PCB EDA Suite
|
A factory which returns an instance of a PLUGIN. More...
#include <io_mgr.h>
Classes | |
class | PLUGIN_REGISTRY |
Hold a list of available plugins, created using a singleton REGISTER_PLUGIN object. More... | |
struct | REGISTER_PLUGIN |
Register a plugin. More... | |
Public Types | |
enum | PCB_FILE_T { LEGACY , KICAD_SEXP , EAGLE , PCAD , FABMASTER , ALTIUM_DESIGNER , ALTIUM_CIRCUIT_STUDIO , ALTIUM_CIRCUIT_MAKER , CADSTAR_PCB_ARCHIVE , GEDA_PCB , FILE_TYPE_NONE } |
The set of file types that the IO_MGR knows about, and for which there has been a plugin written. More... | |
Static Public Member Functions | |
static PLUGIN * | PluginFind (PCB_FILE_T aFileType) |
Return a PLUGIN which the caller can use to import, export, save, or load design documents. More... | |
static void | PluginRelease (PLUGIN *aPlugin) |
Release a PLUGIN back to the system and may cause it to be unloaded from memory. More... | |
static const wxString | ShowType (PCB_FILE_T aFileType) |
Return a brief name for a plugin given aFileType enum. More... | |
static PCB_FILE_T | EnumFromStr (const wxString &aFileType) |
Return the PCB_FILE_T from the corresponding plugin type name: "kicad", "legacy", etc. More... | |
static const wxString | GetFileExtension (PCB_FILE_T aFileType) |
Return the file extension for aFileType. More... | |
static PCB_FILE_T | GuessPluginTypeFromLibPath (const wxString &aLibPath) |
Return a plugin type given a footprint library's libPath. More... | |
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 passed to this function. More... | |
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, or it can be used to write a portion ofaBoard to a special kind of export file. More... | |
enum IO_MGR::PCB_FILE_T |
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
Enumerator | |
---|---|
LEGACY | Legacy Pcbnew file formats prior to s-expression. |
KICAD_SEXP | S-expression Pcbnew file format. |
EAGLE | |
PCAD | |
FABMASTER | |
ALTIUM_DESIGNER | |
ALTIUM_CIRCUIT_STUDIO | |
ALTIUM_CIRCUIT_MAKER | |
CADSTAR_PCB_ARCHIVE | |
GEDA_PCB | Geda PCB file formats. |
FILE_TYPE_NONE |
Definition at line 53 of file io_mgr.h.
|
static |
Return the PCB_FILE_T from the corresponding plugin type name: "kicad", "legacy", etc.
Definition at line 93 of file io_mgr.cpp.
References IO_MGR::PLUGIN_REGISTRY::AllPlugins(), and IO_MGR::PLUGIN_REGISTRY::Instance().
Referenced by DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), and FP_LIB_TABLE_ROW::SetType().
|
static |
Return the file extension for aFileType.
aFileType | The PCB_FILE_T type. |
Definition at line 109 of file io_mgr.cpp.
References PLUGIN::GetFileExtension(), PluginFind(), and PluginRelease().
Referenced by plugin_type().
|
static |
Return a plugin type given a footprint library's libPath.
Definition at line 124 of file io_mgr.cpp.
References ALTIUM_DESIGNER, AltiumFootprintLibPathExtension, EAGLE, EagleFootprintLibPathExtension, GEDA_PCB, GedaPcbFootprintLibFileExtension, KICAD_SEXP, KiCadFootprintLibPathExtension, LEGACY, and LegacyFootprintLibPathExtension.
Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), FOOTPRINT_EDIT_FRAME::DuplicateFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), and FOOTPRINT_EDIT_FRAME::SaveLibraryAs().
|
static |
Find the requested PLUGIN and if found, calls the PLUGIN::Load() function on it using the arguments passed to this function.
After the PLUGIN::Load() function returns, the PLUGIN is Released() as part of this call.
aFileType | is the PCB_FILE_T of file to load. |
aFileName | is the name of the file to load. |
aAppendToMe | is an existing BOARD to append to, use NULL if fresh board load is wanted. |
aProperties | is an associative array that allows the caller to pass additional tuning parameters to the PLUGIN. |
aProject | is the optional PROJECT object primarily used by third party importers. |
Definition at line 162 of file io_mgr.cpp.
References FMT_NOTFOUND, Format(), PLUGIN::Load(), PluginFind(), ShowType(), and THROW_IO_ERROR.
Referenced by LoadBoard().
|
static |
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
The returned PLUGIN, may be reference counted, so please call PluginRelease() when you are done using the returned PLUGIN. It may or may not be code running from a DLL/DSO.
aFileType | is from PCB_FILE_T and tells which plugin to find. |
Definition at line 58 of file io_mgr.cpp.
References IO_MGR::PLUGIN_REGISTRY::Create(), and IO_MGR::PLUGIN_REGISTRY::Instance().
Referenced by PCB_CONTROL::AppendBoardFromFile(), AskLoadBoardFileName(), PCB_BASE_EDIT_FRAME::createNewLibrary(), PCB_CONTROL::DdAppendBoard(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), FP_LIB_TABLE::FindRow(), GetFileExtension(), Load(), DIALOG_BOARD_SETUP::onAuxiliaryAction(), PCB_EDIT_FRAME::OpenProjectFiles(), parse_footprint_with_plugin(), Save(), FOOTPRINT_EDIT_FRAME::SaveLibraryAs(), PCB_EDIT_FRAME::SavePcbCopy(), and PCB_EDIT_FRAME::SavePcbFile().
|
static |
Release a PLUGIN back to the system and may cause it to be unloaded from memory.
aPlugin | is the one to be released, and which is no longer usable after calling this. |
Definition at line 67 of file io_mgr.cpp.
Referenced by GetFileExtension(), and PLUGIN::RELEASER::release().
|
static |
Write either a full aBoard to a storage file in a format that this implementation knows about, or it can be used to write a portion ofaBoard to a special kind of export file.
aFileType | is the PCB_FILE_T of file to save. |
aFileName | is the name of a file to save to on disk. |
aBoard | is the BOARD document (data tree) to save or export to disk. |
aBoard | is the in memory document tree from which to extract information when writing to aFileName. The caller continues to own the BOARD, and the plugin should refrain from modifying the BOARD if possible. |
aProperties | is an associative array that can be used to tell the saver how to save the file, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL. |
IO_ERROR | if there is a problem saving or exporting. |
Definition at line 178 of file io_mgr.cpp.
References FMT_NOTFOUND, Format(), PluginFind(), PLUGIN::Save(), ShowType(), and THROW_IO_ERROR.
Referenced by SaveBoard().
|
static |
Return a brief name for a plugin given aFileType enum.
Definition at line 77 of file io_mgr.cpp.
References _, IO_MGR::PLUGIN_REGISTRY::AllPlugins(), Format(), and IO_MGR::PLUGIN_REGISTRY::Instance().
Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), PANEL_FP_LIB_TABLE::browseLibrariesHandler(), FP_LIB_TABLE_ROW::GetType(), Load(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), and Save().