KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DESIGN_BLOCK_IO Class Reference

#include <design_block_io.h>

Inheritance diagram for DESIGN_BLOCK_IO:
IO_BASE

Public Member Functions

 DESIGN_BLOCK_IO ()
 
const IO_BASE::IO_FILE_DESC GetLibraryDesc () const override
 Get the descriptor for the library container that this IO plugin operates on.
 
long long GetLibraryTimestamp (const wxString &aLibraryPath) const
 
void DesignBlockEnumerate (wxArrayString &aDesignBlockNames, const wxString &aLibraryPath, bool aBestEfforts, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
const DESIGN_BLOCKGetEnumeratedDesignBlock (const wxString &aLibraryPath, const wxString &aDesignBlockName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
bool DesignBlockExists (const wxString &aLibraryPath, const wxString &aDesignBlockName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
DESIGN_BLOCKImportDesignBlock (const wxString &aDesignBlockPath, wxString &aDesignBlockNameOut, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
void CreateLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Create a new empty library at aLibraryPath empty.
 
virtual 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, or throws an exception if library exists but is read only or cannot be deleted for some other reason.
 
bool IsLibraryWritable (const wxString &aLibraryPath) override
 Return true if the library at aLibraryPath is writable.
 
DESIGN_BLOCKDesignBlockLoad (const wxString &aLibraryPath, const wxString &aDesignBlockName, bool aKeepUUID=false, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
void DesignBlockSave (const wxString &aLibraryPath, const DESIGN_BLOCK *aDesignBlock, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
void DesignBlockDelete (const wxString &aLibraryPath, const wxString &aDesignBlockName, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
virtual void PrefetchLib (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
 
const wxString & GetName () const
 Return a brief hard coded name for this IO interface.
 
virtual void SetReporter (REPORTER *aReporter)
 Set an optional reporter for warnings/errors.
 
virtual void SetProgressReporter (PROGRESS_REPORTER *aReporter)
 Set an optional progress reporter.
 
virtual const IO_FILE_DESC GetLibraryFileDesc () const
 Get the descriptor for the individual library elements that this IO plugin operates on.
 
virtual bool CanReadLibrary (const wxString &aFileName) const
 Checks if this IO object can read the specified library file/directory.
 
virtual void GetLibraryOptions (std::map< std::string, UTF8 > *aListToAppendTo) const
 Append supported IO options to aListToAppenTo along with internationalized descriptions.
 
virtual void Report (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 
virtual void AdvanceProgressPhase ()
 

Protected Attributes

wxString m_name
 Name of the IO loader.
 
REPORTERm_reporter
 Reporter to log errors/warnings to, may be nullptr.
 
PROGRESS_REPORTERm_progressReporter
 Progress reporter to track the progress of the operation, may be nullptr.
 

Detailed Description

Definition at line 58 of file design_block_io.h.

Constructor & Destructor Documentation

◆ DESIGN_BLOCK_IO()

DESIGN_BLOCK_IO::DESIGN_BLOCK_IO ( )
inline

Definition at line 61 of file design_block_io.h.

Member Function Documentation

◆ AdvanceProgressPhase()

void IO_BASE::AdvanceProgressPhase ( )
virtualinherited

◆ CanReadLibrary()

bool IO_BASE::CanReadLibrary ( const wxString &  aFileName) const
virtualinherited

Checks if this IO object can read the specified library file/directory.

If not overriden, extension check is used.

Note
This is not a check that the file system object is readable by the user, but a check that this IO object can parse the given library.

Reimplemented in SCH_IO_ALTIUM, SCH_IO_CADSTAR_ARCHIVE, SCH_IO_EAGLE, SCH_IO_EASYEDA, SCH_IO_KICAD_LEGACY, PCB_IO_ALTIUM_DESIGNER, PCB_IO_CADSTAR_ARCHIVE, PCB_IO_EAGLE, PCB_IO_EASYEDA, PCB_IO_IPC2581, and PCB_IO_ODBPP.

Definition at line 69 of file io_base.cpp.

References IO_BASE::GetLibraryDesc(), IO_BASE::IO_FILE_DESC::m_ExtensionsInDir, IO_BASE::IO_FILE_DESC::m_FileExtensions, and IO_BASE::IO_FILE_DESC::m_IsFile.

Referenced by SCH_IO_ALTIUM::CanReadLibrary(), SCH_IO_CADSTAR_ARCHIVE::CanReadLibrary(), SCH_IO_EAGLE::CanReadLibrary(), SCH_IO_KICAD_LEGACY::CanReadLibrary(), PCB_IO_ALTIUM_DESIGNER::CanReadLibrary(), PCB_IO_CADSTAR_ARCHIVE::CanReadLibrary(), and PCB_IO_EAGLE::CanReadLibrary().

◆ CreateLibrary()

void DESIGN_BLOCK_IO::CreateLibrary ( const wxString &  aLibraryPath,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
overridevirtual

Create a new empty library at aLibraryPath empty.

It is an error to attempt to create an existing library or to attempt to create on a "read only" location.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several elements.
aPropertiesis an associative array that can be used to tell the library create function anything special, because it can take any number of additional named tuning arguments that the IO is known to support. The caller continues to own this object (IO may not delete it), and IOs should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem finding the library, or creating it.

Reimplemented from IO_BASE.

Definition at line 166 of file design_block_io.cpp.

References _, and THROW_IO_ERROR.

◆ DeleteLibrary()

bool DESIGN_BLOCK_IO::DeleteLibrary ( const wxString &  aLibraryPath,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
overridevirtual

Delete an existing 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.

Parameters
aLibraryPathis a locator for the "library", usually a directory or file which will contain several elements.
aPropertiesis an associative array that can be used to tell the library delete implementation function anything special, 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.
Returns
true if library deleted, false if library did not exist.
Exceptions
IO_ERRORif there is a problem deleting an existing library.

Reimplemented from IO_BASE.

Definition at line 188 of file design_block_io.cpp.

References _, FILEEXT::KiCadDesignBlockLibPathExtension, THROW_IO_ERROR, and traceDesignBlocks.

◆ DesignBlockDelete()

void DESIGN_BLOCK_IO::DesignBlockDelete ( const wxString &  aLibraryPath,
const wxString &  aDesignBlockName,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)

Definition at line 426 of file design_block_io.cpp.

References _, FILEEXT::KiCadDesignBlockPathExtension, and THROW_IO_ERROR.

◆ DesignBlockEnumerate()

void DESIGN_BLOCK_IO::DesignBlockEnumerate ( wxArrayString &  aDesignBlockNames,
const wxString &  aLibraryPath,
bool  aBestEfforts,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)

Definition at line 259 of file design_block_io.cpp.

References FILEEXT::KiCadDesignBlockPathExtension.

◆ DesignBlockExists()

bool DESIGN_BLOCK_IO::DesignBlockExists ( const wxString &  aLibraryPath,
const wxString &  aDesignBlockName,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
inline

Definition at line 77 of file design_block_io.h.

◆ DesignBlockLoad()

DESIGN_BLOCK * DESIGN_BLOCK_IO::DesignBlockLoad ( const wxString &  aLibraryPath,
const wxString &  aDesignBlockName,
bool  aKeepUUID = false,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)

◆ DesignBlockSave()

void DESIGN_BLOCK_IO::DesignBlockSave ( const wxString &  aLibraryPath,
const DESIGN_BLOCK aDesignBlock,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)

◆ GetEnumeratedDesignBlock()

const DESIGN_BLOCK * DESIGN_BLOCK_IO::GetEnumeratedDesignBlock ( const wxString &  aLibraryPath,
const wxString &  aDesignBlockName,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
inline

Definition at line 71 of file design_block_io.h.

◆ GetLibraryDesc()

const DESIGN_BLOCK_IO::IO_FILE_DESC DESIGN_BLOCK_IO::GetLibraryDesc ( ) const
overridevirtual

Get the descriptor for the library container that this IO plugin operates on.

Returns
File descriptor for the container of the library elements

Implements IO_BASE.

Definition at line 132 of file design_block_io.cpp.

References _HKI, and FILEEXT::KiCadDesignBlockLibPathExtension.

◆ GetLibraryFileDesc()

virtual const IO_FILE_DESC IO_BASE::GetLibraryFileDesc ( ) const
inlinevirtualinherited

Get the descriptor for the individual library elements that this IO plugin operates on.

For libraries where all the elements are in a single container (e.g. all elements in a single file), then this will return the descriptor from IO_BASE::GetLibraryDesc().

Returns
File descriptor for the library elements

Reimplemented in PCB_IO_EASYEDA, PCB_IO_EASYEDAPRO, PCB_IO_GEDA, and PCB_IO_KICAD_SEXPR.

Definition at line 106 of file io_base.h.

Referenced by PCB_IO::CanReadFootprint().

◆ GetLibraryOptions()

void IO_BASE::GetLibraryOptions ( std::map< std::string, UTF8 > *  aListToAppendTo) const
virtualinherited

Append supported IO options to aListToAppenTo along with internationalized descriptions.

Options are typically appended so that a derived IO_BASE can call its base class function by the same name first, thus inheriting options declared there. (Some base class options could pertain to all functions in all derived IOs.) Note that since aListToAppendTo is a PROPERTIES object, all options will be unique and last guy wins.

Parameters
aListToAppendToholds a tuple of
option
This eventually is what shows up into the "options" field, possibly combined with others.
internationalized description
The internationalized description is displayed in DIALOG_PLUGIN_OPTIONS. It may be multi-line and be quite explanatory of the option.

In the future perhaps aListToAppendTo evolves to something capable of also holding a wxValidator for the cells in said dialog: http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180. This would require a 3 column list, and introducing wx GUI knowledge to SCH_IO, which has been avoided to date.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE, SCH_IO, and PCB_IO.

Definition at line 63 of file io_base.cpp.

Referenced by SCH_IO::GetLibraryOptions(), and PCB_IO::GetLibraryOptions().

◆ GetLibraryTimestamp()

long long DESIGN_BLOCK_IO::GetLibraryTimestamp ( const wxString &  aLibraryPath) const

Definition at line 139 of file design_block_io.cpp.

References FILEEXT::KiCadDesignBlockPathExtension, and TimestampDir().

◆ GetName()

const wxString & IO_BASE::GetName ( ) const
inlineinherited

Return a brief hard coded name for this IO interface.

Definition at line 75 of file io_base.h.

Referenced by SCH_IO_ALTIUM::ParseLibFile().

◆ ImportDesignBlock()

DESIGN_BLOCK * DESIGN_BLOCK_IO::ImportDesignBlock ( const wxString &  aDesignBlockPath,
wxString &  aDesignBlockNameOut,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
inline

Definition at line 83 of file design_block_io.h.

◆ IsLibraryWritable()

bool DESIGN_BLOCK_IO::IsLibraryWritable ( const wxString &  aLibraryPath)
overridevirtual

Return true if the library at aLibraryPath is writable.

The system libraries are typically read only because of where they are installed..

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
Exceptions
IO_ERRORif no library at aLibraryPath exists.

Reimplemented from IO_BASE.

Definition at line 447 of file design_block_io.cpp.

References path.

◆ PrefetchLib()

virtual void DESIGN_BLOCK_IO::PrefetchLib ( const wxString &  aLibraryPath,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
inlinevirtual

Definition at line 109 of file design_block_io.h.

◆ Report()

void IO_BASE::Report ( const wxString &  aText,
SEVERITY  aSeverity = RPT_SEVERITY_UNDEFINED 
)
virtualinherited

◆ SetProgressReporter()

virtual void IO_BASE::SetProgressReporter ( PROGRESS_REPORTER aReporter)
inlinevirtualinherited

Set an optional progress reporter.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 85 of file io_base.h.

Referenced by PCB_CONTROL::AppendBoard().

◆ SetReporter()

virtual void IO_BASE::SetReporter ( REPORTER aReporter)
inlinevirtualinherited

Set an optional reporter for warnings/errors.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 80 of file io_base.h.

Member Data Documentation

◆ m_name

wxString IO_BASE::m_name
protectedinherited

Name of the IO loader.

Definition at line 215 of file io_base.h.

◆ m_progressReporter

◆ m_reporter

REPORTER* IO_BASE::m_reporter
protectedinherited

Reporter to log errors/warnings to, may be nullptr.

Definition at line 218 of file io_base.h.

Referenced by SCH_IO_ALTIUM::AddLibTextBox(), SCH_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary(), PCB_IO_ALTIUM_DESIGNER::FootprintLoad(), PCB_IO_ALTIUM_CIRCUIT_STUDIO::LoadBoard(), PCB_IO_ALTIUM_CIRCUIT_MAKER::LoadBoard(), PCB_IO_ALTIUM_DESIGNER::LoadBoard(), PCB_IO_SOLIDWORKS::LoadBoard(), SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile(), SCH_IO_LTSPICE::LoadSchematicFile(), SCH_IO_ALTIUM::ParseAltiumSch(), SCH_IO_ALTIUM::ParseArc(), SCH_IO_ALTIUM::ParseBezier(), SCH_IO_ALTIUM::ParseCircle(), SCH_IO_ALTIUM::ParseComponent(), SCH_IO_ALTIUM::ParseDesignator(), SCH_IO_ALTIUM::ParseEllipse(), SCH_IO_ALTIUM::ParseEllipticalArc(), SCH_IO_ALTIUM::ParseFileName(), SCH_IO_ALTIUM::ParseHarnessConnector(), SCH_IO_ALTIUM::ParseHarnessEntry(), SCH_IO_ALTIUM::ParseHarnessPort(), SCH_IO_ALTIUM::ParseHarnessType(), SCH_IO_ALTIUM::ParseImage(), SCH_IO_ALTIUM::ParseImplementation(), SCH_IO_ALTIUM::ParseLabel(), SCH_IO_ALTIUM::ParseLibFile(), SCH_IO_ALTIUM::ParseLine(), SCH_IO_ALTIUM::ParsePieChart(), SCH_IO_ALTIUM::ParsePin(), SCH_IO_ALTIUM::ParsePolygon(), SCH_IO_ALTIUM::ParsePolyline(), SCH_IO_ALTIUM::ParsePort(), SCH_IO_ALTIUM::ParsePowerPort(), SCH_IO_ALTIUM::ParseRecord(), SCH_IO_ALTIUM::ParseRectangle(), SCH_IO_ALTIUM::ParseRoundRectangle(), SCH_IO_ALTIUM::ParseSheetEntry(), SCH_IO_ALTIUM::ParseSheetName(), SCH_IO_ALTIUM::ParseSignalHarness(), SCH_IO_ALTIUM::ParseStorage(), PCB_IO_ALTIUM_DESIGNER::PCB_IO_ALTIUM_DESIGNER(), PCB_IO_SOLIDWORKS::PCB_IO_SOLIDWORKS(), IO_BASE::Report(), SCH_IO_ALTIUM::SCH_IO_ALTIUM(), SCH_IO_CADSTAR_ARCHIVE::SCH_IO_CADSTAR_ARCHIVE(), SCH_IO_EAGLE::SCH_IO_EAGLE(), SCH_IO_EASYEDA::SCH_IO_EASYEDA(), SCH_IO_EASYEDAPRO::SCH_IO_EASYEDAPRO(), SCH_IO_LTSPICE::SCH_IO_LTSPICE(), and SCH_IO_CADSTAR_ARCHIVE::SetReporter().


The documentation for this class was generated from the following files: