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

#include <sch_io_altium.h>

Inheritance diagram for SCH_IO_ALTIUM:
SCH_IO IO_BASE

Public Member Functions

 SCH_IO_ALTIUM ()
 
 ~SCH_IO_ALTIUM ()
 
const IO_BASE::IO_FILE_DESC GetSchematicFileDesc () const override
 Returns schematic file description for the SCH_IO.
 
const IO_BASE::IO_FILE_DESC GetLibraryDesc () const override
 Get the descriptor for the library container that this IO plugin operates on.
 
bool CanReadSchematicFile (const wxString &aFileName) const override
 Checks if this SCH_IO can read the specified schematic file.
 
bool CanReadLibrary (const wxString &aFileName) const override
 Checks if this IO object can read the specified library file/directory.
 
int GetModifyHash () const override
 Return the modification hash from the library cache.
 
SCH_SHEETLoadSchematicFile (const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const STRING_UTF8_MAP *aProperties=nullptr) override
 Load information from some input file format that this SCH_IO implementation knows about, into either a new SCH_SHEET or an existing one.
 
void EnumerateSymbolLib (wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override
 Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
 
void EnumerateSymbolLib (std::vector< LIB_SYMBOL * > &aSymbolList, const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override
 Populate a list of LIB_SYMBOL aliases contained within the library aLibraryPath.
 
LIB_SYMBOLLoadSymbol (const wxString &aLibraryPath, const wxString &aAliasName, const STRING_UTF8_MAP *aProperties=nullptr) override
 Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this SCH_IO knows about.
 
bool IsLibraryWritable (const wxString &aLibraryPath) override
 Return true if the library at aLibraryPath is writable.
 
wxString getLibName ()
 
wxFileName getLibFileName ()
 
void ParseAltiumSch (const wxString &aFileName)
 
void ParseStorage (const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
 
void ParseAdditional (const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
 
void ParseFileHeader (const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
 
void ParseASCIISchematic (const wxString &aFileName)
 
void ParseRecord (int index, std::map< wxString, wxString > &properties, const wxString &aSectionName)
 
virtual void SaveLibrary (const wxString &aFileName, const STRING_UTF8_MAP *aProperties=nullptr)
 
virtual void SaveSchematicFile (const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const STRING_UTF8_MAP *aProperties=nullptr)
 Write aSchematic to a storage file in a format that this SCH_IO implementation knows about, or it can be used to write a portion of aSchematic to a special kind of export file.
 
virtual void SaveSymbol (const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const STRING_UTF8_MAP *aProperties=nullptr)
 Write aSymbol to an existing library located at aLibraryPath.
 
virtual void DeleteSymbol (const wxString &aLibraryPath, const wxString &aSymbolName, const STRING_UTF8_MAP *aProperties=nullptr)
 Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
 
virtual void GetLibraryOptions (STRING_UTF8_MAP *aListToAppendTo) const override
 Append supported SCH_IO options to aListToAppenTo along with internationalized descriptions.
 
virtual bool SupportsSubLibraries () const
 
virtual void GetSubLibraryNames (std::vector< wxString > &aNames)
 Retrieves a list of sub-libraries in this library.
 
virtual wxString GetSubLibraryDescription (const wxString &aName)
 Gets a description of a sublibrary.
 
virtual void GetAvailableSymbolFields (std::vector< wxString > &aNames)
 Retrieves a list of (custom) field names that are present on symbols in this library.
 
virtual void GetDefaultSymbolFields (std::vector< wxString > &aNames)
 Retrieves a list of (custom) field names that should be shown by default for this library in the symbol chooser.
 
virtual const wxString & GetError () const
 Return an error string to the caller.
 
virtual void SetLibTable (SYMBOL_LIB_TABLE *aTable)
 Some library plugins need to have access to their parent library table.
 
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 void CreateLibrary (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
 Create a new empty library at aLibraryPath empty.
 
virtual bool DeleteLibrary (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
 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.
 

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.
 

Private Member Functions

SCH_SCREENgetCurrentScreen ()
 
SCH_SHEETgetCurrentSheet ()
 
bool ShouldPutItemOnSheet (int aOwnerindex)
 
bool IsComponentPartVisible (const ASCH_OWNER_INTERFACE &aElem) const
 
const ASCH_STORAGE_FILEGetFileFromStorage (const wxString &aFilename) const
 
void AddTextBox (const ASCH_TEXT_FRAME *aElem)
 
void AddLibTextBox (const ASCH_TEXT_FRAME *aElem, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
 
void ParseComponent (int aIndex, const std::map< wxString, wxString > &aProperties)
 
void ParseTemplate (int aIndex, const std::map< wxString, wxString > &aProperties)
 
void ParsePin (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseLabel (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
 
void ParseTextFrame (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
 
void ParseNote (const std::map< wxString, wxString > &aProperties)
 
void ParseBezier (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParsePolyline (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParsePolygon (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseRoundRectangle (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseArc (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseEllipticalArc (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseEllipse (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseCircle (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseLine (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseSignalHarness (const std::map< wxString, wxString > &aProperties)
 
void ParseHarnessConnector (int aIndex, const std::map< wxString, wxString > &aProperties)
 
void ParseHarnessEntry (const std::map< wxString, wxString > &aProperties)
 
void ParseHarnessType (const std::map< wxString, wxString > &aProperties)
 
void ParseHarnessPort (const ASCH_PORT &aElem)
 
void ParseHyperlink (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParsePieChart (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseRectangle (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseSheetSymbol (int aIndex, const std::map< wxString, wxString > &aProperties)
 
void ParseSheetEntry (const std::map< wxString, wxString > &aProperties)
 
void ParsePowerPort (const std::map< wxString, wxString > &aProperties)
 
void ParsePort (const ASCH_PORT &aElem)
 
void ParseNoERC (const std::map< wxString, wxString > &aProperties)
 
void ParseNetLabel (const std::map< wxString, wxString > &aProperties)
 
void ParseBus (const std::map< wxString, wxString > &aProperties)
 
void ParseWire (const std::map< wxString, wxString > &aProperties)
 
void ParseJunction (const std::map< wxString, wxString > &aProperties)
 
void ParseImage (const std::map< wxString, wxString > &aProperties)
 
void ParseSheet (const std::map< wxString, wxString > &aProperties)
 
void ParseSheetName (const std::map< wxString, wxString > &aProperties)
 
void ParseFileName (const std::map< wxString, wxString > &aProperties)
 
void ParseDesignator (const std::map< wxString, wxString > &aProperties)
 
void ParseLibDesignator (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
 
void ParseBusEntry (const std::map< wxString, wxString > &aProperties)
 
void ParseParameter (const std::map< wxString, wxString > &aProperties)
 
void ParseLibParameter (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym, std::vector< int > &aFontSize=nullint)
 
void ParseImplementationList (int aIndex, const std::map< wxString, wxString > &aProperties)
 
void ParseImplementation (const std::map< wxString, wxString > &aProperties, std::vector< LIB_SYMBOL * > &aSymbol=nullsym)
 
void ParseLibHeader (const ALTIUM_COMPOUND_FILE &aAltiumSchFile, std::vector< int > &aFontSizes)
 
std::map< wxString, LIB_SYMBOL * > ParseLibFile (const ALTIUM_COMPOUND_FILE &aAltiumSchFile)
 
std::vector< LIB_SYMBOL * > ParseLibComponent (const std::map< wxString, wxString > &aProperties)
 
void doEnumerateSymbolLib (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties, std::function< void(const wxString &, LIB_SYMBOL *)> aInserter)
 
void ensureLoadedLibrary (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties)
 
long long getLibraryTimestamp (const wxString &aLibraryPath) const
 

Static Private Member Functions

static bool isBinaryFile (const wxString &aFileName)
 
static bool isASCIIFile (const wxString &aFileName)
 
static bool checkFileHeader (const wxString &aFileName)
 

Private Attributes

SCH_SHEETm_rootSheet
 
SCH_SHEET_PATH m_sheetPath
 
SCHEMATICm_schematic
 
wxString m_libName
 
bool m_isIntLib
 
IO_RELEASER< SCH_IOm_pi
 
std::unique_ptr< STRING_UTF8_MAPm_properties
 
std::unique_ptr< TITLE_BLOCKm_currentTitleBlock
 
VECTOR2I m_sheetOffset
 
std::unique_ptr< ASCH_SHEETm_altiumSheet
 
std::map< int, SCH_SYMBOL * > m_symbols
 
std::map< int, SCH_SHEET * > m_sheets
 
std::map< int, LIB_SYMBOL * > m_libSymbols
 
std::map< wxString, LIB_SYMBOL * > m_powerSymbols
 
std::vector< ASCH_STORAGE_FILEm_altiumStorage
 
std::vector< ASCH_ADDITIONAL_FILEm_altiumAdditional
 
std::map< int, ASCH_SYMBOLm_altiumComponents
 
std::map< int, ASCH_TEMPLATEm_altiumTemplates
 
std::map< int, int > m_altiumImplementationList
 
std::vector< ASCH_PORTm_altiumPortsCurrentSheet
 
std::vector< ASCH_PORTm_altiumHarnessPortsCurrentSheet
 
int m_harnessOwnerIndexOffset
 
int m_harnessEntryParent
 
std::map< wxString, long long > m_timestamps
 
std::map< wxString, std::map< wxString, LIB_SYMBOL * > > m_libCache
 
std::vector< std::pair< wxString, int > > m_fonts
 

Detailed Description

Definition at line 56 of file sch_io_altium.h.

Constructor & Destructor Documentation

◆ SCH_IO_ALTIUM()

◆ ~SCH_IO_ALTIUM()

SCH_IO_ALTIUM::~SCH_IO_ALTIUM ( )

Definition at line 232 of file sch_io_altium.cpp.

References m_libCache, and name.

Member Function Documentation

◆ AddLibTextBox()

◆ AddTextBox()

◆ CanReadLibrary()

bool SCH_IO_ALTIUM::CanReadLibrary ( const wxString &  aFileName) const
overridevirtual

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 from IO_BASE.

Definition at line 277 of file sch_io_altium.cpp.

References IO_BASE::CanReadLibrary(), and checkFileHeader().

◆ CanReadSchematicFile()

bool SCH_IO_ALTIUM::CanReadSchematicFile ( const wxString &  aFileName) const
overridevirtual

Checks if this SCH_IO can read the specified schematic file.

If not overriden, extension check is used.

Reimplemented from SCH_IO.

Definition at line 268 of file sch_io_altium.cpp.

References SCH_IO::CanReadSchematicFile(), and checkFileHeader().

◆ checkFileHeader()

bool SCH_IO_ALTIUM::checkFileHeader ( const wxString &  aFileName)
staticprivate

Definition at line 262 of file sch_io_altium.cpp.

References isASCIIFile(), and isBinaryFile().

Referenced by CanReadLibrary(), and CanReadSchematicFile().

◆ CreateLibrary()

void IO_BASE::CreateLibrary ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

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 in SCH_IO_KICAD_LEGACY, SCH_IO_KICAD_SEXPR, and PCB_IO_KICAD_SEXPR.

Definition at line 44 of file io_base.cpp.

References NOT_IMPLEMENTED.

◆ DeleteLibrary()

bool IO_BASE::DeleteLibrary ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

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 in SCH_IO_KICAD_LEGACY, SCH_IO_KICAD_SEXPR, PCB_IO_GEDA, PCB_IO_KICAD_LEGACY, and PCB_IO_KICAD_SEXPR.

Definition at line 50 of file io_base.cpp.

References NOT_IMPLEMENTED.

◆ DeleteSymbol()

void SCH_IO::DeleteSymbol ( const wxString &  aLibraryPath,
const wxString &  aSymbolName,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several symbols.
aSymbolNameis the name of a LIB_SYMBOL associated with it's root LIB_SYMBOL object to delete from the specified library.
aPropertiesis an associative array that can be used to tell the library delete 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.
Exceptions
IO_ERRORif there is a problem finding the alias or the library or deleting it.

Reimplemented in SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 117 of file sch_io.cpp.

References NOT_IMPLEMENTED.

Referenced by LIB_BUFFER::SaveBuffer().

◆ doEnumerateSymbolLib()

void SCH_IO_ALTIUM::doEnumerateSymbolLib ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties,
std::function< void(const wxString &, LIB_SYMBOL *)>  aInserter 
)
private

◆ ensureLoadedLibrary()

void SCH_IO_ALTIUM::ensureLoadedLibrary ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties 
)
private

◆ EnumerateSymbolLib() [1/2]

void SCH_IO_ALTIUM::EnumerateSymbolLib ( std::vector< LIB_SYMBOL * > &  aSymbolList,
const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
overridevirtual

Populate a list of LIB_SYMBOL aliases contained within the library aLibraryPath.

Note
It is the responsibility of the caller to delete the returned object from the heap. Failure to do this will result in memory leaks.
Parameters
aSymbolListis an array to populate with the LIB_SYMBOL pointers associated with the library.
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing one or more LIB_SYMBOL objects.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif the library cannot be found, the part library cannot be loaded.

Reimplemented from SCH_IO.

Definition at line 4522 of file sch_io_altium.cpp.

References doEnumerateSymbolLib().

◆ EnumerateSymbolLib() [2/2]

void SCH_IO_ALTIUM::EnumerateSymbolLib ( wxArrayString &  aSymbolNameList,
const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
overridevirtual

Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.

Parameters
aSymbolNameListis an array to populate with the LIB_SYMBOL names associated with the library.
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing one or more LIB_SYMBOL objects.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif the library cannot be found, the part library cannot be loaded.

Reimplemented from SCH_IO.

Definition at line 4510 of file sch_io_altium.cpp.

References doEnumerateSymbolLib().

◆ GetAvailableSymbolFields()

virtual void SCH_IO::GetAvailableSymbolFields ( std::vector< wxString > &  aNames)
inlinevirtualinherited

Retrieves a list of (custom) field names that are present on symbols in this library.

The plugin is responsible for guaranteeing that this list contains the set of unique custom field names present on any symbols contained in the library.

The required KiCad fields are not included in this list.

Parameters
aNameswill be filled with any custom fields present in this library.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE, SCH_IO_DATABASE, SCH_IO_HTTP_LIB, and SCH_IO_KICAD_SEXPR.

Definition at line 324 of file sch_io.h.

Referenced by SCH_IO::GetDefaultSymbolFields().

◆ getCurrentScreen()

◆ getCurrentSheet()

SCH_SHEET * SCH_IO_ALTIUM::getCurrentSheet ( )
private

◆ GetDefaultSymbolFields()

virtual void SCH_IO::GetDefaultSymbolFields ( std::vector< wxString > &  aNames)
inlinevirtualinherited

Retrieves a list of (custom) field names that should be shown by default for this library in the symbol chooser.

This list should be a subset of the result returned by GetAvailableSymbolFields().

The preference for which fields to hide and show for a given library is stored on a per-library basis in a user's preferences (or in the project local settings for a project- local library). The set of fields returned by GetDefaultSymbolFields() will be used if this preference is missing.

Parameters
aNameswill be filled with the custom field names that should be shown by default

Reimplemented in SCH_IO_DATABASE, SCH_IO_HTTP_LIB, and SCH_IO_KICAD_SEXPR.

Definition at line 338 of file sch_io.h.

References SCH_IO::GetAvailableSymbolFields().

◆ GetError()

const wxString & SCH_IO::GetError ( ) const
virtualinherited

Return an error string to the caller.

This is useful for schematic loaders that can load partial schematics where throwing an exception would be problematic such as the KiCad legacy plugin.

Returns
an unformatted string containing errors if any.

Reimplemented in SCH_IO_HTTP_LIB, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 140 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ GetFileFromStorage()

const ASCH_STORAGE_FILE * SCH_IO_ALTIUM::GetFileFromStorage ( const wxString &  aFilename) const
private

Definition at line 1073 of file sch_io_altium.cpp.

References m_altiumStorage.

Referenced by ParseImage().

◆ getLibFileName()

◆ getLibName()

◆ GetLibraryDesc()

const IO_BASE::IO_FILE_DESC SCH_IO_ALTIUM::GetLibraryDesc ( ) const
inlineoverridevirtual

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 67 of file sch_io_altium.h.

References _HKI.

◆ 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 102 of file io_base.h.

References IO_BASE::GetLibraryDesc().

Referenced by PCB_IO::CanReadFootprint().

◆ GetLibraryOptions()

void SCH_IO::GetLibraryOptions ( STRING_UTF8_MAP aListToAppendTo) const
overridevirtualinherited

Append supported SCH_IO options to aListToAppenTo along with internationalized descriptions.

Options are typically appended so that a derived SCH_IO can call its base class function by the same name first, thus inheriting options declared there. (Some base class options could pertain to all Symbol*() functions in all derived SCH_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 fp-lib-table "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 from IO_BASE.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 125 of file sch_io.cpp.

References IO_BASE::GetLibraryOptions().

◆ getLibraryTimestamp()

long long SCH_IO_ALTIUM::getLibraryTimestamp ( const wxString &  aLibraryPath) const
private

Definition at line 4367 of file sch_io_altium.cpp.

Referenced by ensureLoadedLibrary().

◆ GetModifyHash()

int SCH_IO_ALTIUM::GetModifyHash ( ) const
overridevirtual

Return the modification hash from the library cache.

Note
This is temporary until the new s-expr file format is implement. The new file format will embed symbols instead of referencing them from the library. This function can be removed when the new file format is implemented.
Returns
the modification hash of the library cache.

Implements SCH_IO.

Definition at line 242 of file sch_io_altium.cpp.

◆ GetName()

const wxString & IO_BASE::GetName ( ) const
inlineinherited

Return a brief hard coded name for this IO interface.

Definition at line 71 of file io_base.h.

References IO_BASE::m_name.

Referenced by ParseLibFile().

◆ GetSchematicFileDesc()

const IO_BASE::IO_FILE_DESC SCH_IO_ALTIUM::GetSchematicFileDesc ( ) const
inlineoverridevirtual

Returns schematic file description for the SCH_IO.

Reimplemented from SCH_IO.

Definition at line 62 of file sch_io_altium.h.

References _HKI.

◆ GetSubLibraryDescription()

virtual wxString SCH_IO::GetSubLibraryDescription ( const wxString &  aName)
inlinevirtualinherited

Gets a description of a sublibrary.

Has no effect if SupportsSubLibraries() returns false.

Parameters
aNamecontains the name of the sublibrary for which the description is retrieved
Returns
the description of the sublibrary

Reimplemented in SCH_IO_HTTP_LIB.

Definition at line 313 of file sch_io.h.

◆ GetSubLibraryNames()

virtual void SCH_IO::GetSubLibraryNames ( std::vector< wxString > &  aNames)
inlinevirtualinherited

Retrieves a list of sub-libraries in this library.

Some types of symbol library support sub-libraries, which are a single-level organizational hierarchy that is implementation-defined per plugin. Most of KiCad ignores sub-libraries and treats the hierarchy between library and symbol as flat, but the sub-libraries are used for sorting and grouping symbols in the symbol chooser.

Has no effect if SupportsSubLibraries() returns false.

Parameters
aNameswill be filled with a list of sub-libraries within this symbol library

Reimplemented in SCH_IO_DATABASE, and SCH_IO_HTTP_LIB.

Definition at line 302 of file sch_io.h.

◆ isASCIIFile()

bool SCH_IO_ALTIUM::isASCIIFile ( const wxString &  aFileName)
staticprivate

Definition at line 255 of file sch_io_altium.cpp.

References IO_UTILS::fileStartsWithPrefix().

Referenced by checkFileHeader().

◆ isBinaryFile()

bool SCH_IO_ALTIUM::isBinaryFile ( const wxString &  aFileName)
staticprivate

◆ IsComponentPartVisible()

◆ IsLibraryWritable()

bool SCH_IO_ALTIUM::IsLibraryWritable ( const wxString &  aLibraryPath)
inlineoverridevirtual

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 110 of file sch_io_altium.h.

◆ LoadSchematicFile()

SCH_SHEET * SCH_IO_ALTIUM::LoadSchematicFile ( const wxString &  aFileName,
SCHEMATIC aSchematic,
SCH_SHEET aAppendToMe = nullptr,
const STRING_UTF8_MAP aProperties = nullptr 
)
overridevirtual

Load information from some input file format that this SCH_IO implementation knows about, into either a new SCH_SHEET or an existing one.

This may be used to load an entire new SCH_SHEET, or to augment an existing one if aAppendToMe is not NULL.

Parameters
aFileNameis the name of the file to use as input and may be foreign in nature or native in nature.
aKiwayis the KIWAY object used to access the symbol libraries loaded by the project.
aAppendToMeis an existing SCH_SHEET to append to, but if NULL then this means "do not append, rather load anew".
aPropertiesis an associative array that can be used to tell the loader how to load the file, because it can take any number of additional named arguments that the plugin is known to support. These are tuning parameters for the import or load. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
the successfully loaded schematic, or the same one as aAppendToMe if aAppendToMe was not NULL, and the caller owns it.
Exceptions
IO_ERRORif there is a problem loading, and its contents should say what went wrong, using line number and character offsets of the input file if possible.
Note
No check is being done here to see if the existing symbol library exists so this will overwrite the existing one.

Reimplemented from SCH_IO.

Definition at line 319 of file sch_io_altium.cpp.

References SCH_SCREENS::ClearEditFlags(), PROJECT::ELEM_SYMBOL_LIB_TABLE, SYMBOL_LIB_TABLE::Format(), SCH_SCREENS::GetFirst(), getLibFileName(), getLibName(), SCH_LINE::GetLineWidth(), SCH_SCREENS::GetNext(), PROJECT::GetProjectFile(), PROJECT::GetProjectPath(), SCH_SHEET::GetScreen(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName(), SCH_SCREEN::GetUuid(), LIB_TABLE::HasLibrary(), LIB_TABLE::InsertRow(), SCH_LINE::IsBus(), SCHEMATIC::IsValid(), SCH_LINE::IsWire(), FILEEXT::KiCadSchematicFileExtension, SCH_SHEET_INSTANCE::m_PageNumber, SCH_SHEET_INSTANCE::m_Path, m_pi, m_rootSheet, m_schematic, SCH_SCREEN::m_sheetInstances, m_sheetPath, EDA_ITEM::m_Uuid, PROJECT_FILE::NetSettings(), ParseAltiumSch(), SCH_SHEET_PATH::Path(), SCHEMATIC::Prj(), SCH_SHEET_PATH::push_back(), SCHEMATIC::Root(), SCH_LINE_T, PROJECT_SCH::SchSymbolLibTable(), PROJECT::SetElem(), SCH_SCREEN::SetFileName(), SCH_SHEET::SetFileName(), SCH_SHEET_PATH::SetPageNumber(), SCHEMATIC::SetRoot(), SCH_SHEET::SetScreen(), and SCH_SCREENS::UpdateSymbolLinks().

◆ LoadSymbol()

LIB_SYMBOL * SCH_IO_ALTIUM::LoadSymbol ( const wxString &  aLibraryPath,
const wxString &  aPartName,
const STRING_UTF8_MAP aProperties = nullptr 
)
overridevirtual

Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this SCH_IO knows about.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several symbols.
aPartNameis the name of the LIB_SYMBOL to load.
aPropertiesis an associative array that can be used to tell the loader implementation to do something 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
the part created on the heap if found caller shares it or NULL if not found.
Exceptions
IO_ERRORif the library cannot be found or read. No exception is thrown in the case where aAliasName cannot be found.

Reimplemented from SCH_IO.

Definition at line 4534 of file sch_io_altium.cpp.

References ensureLoadedLibrary(), and m_libCache.

◆ ParseAdditional()

◆ ParseAltiumSch()

◆ ParseArc()

◆ ParseASCIISchematic()

◆ ParseBezier()

◆ ParseBus()

void SCH_IO_ALTIUM::ParseBus ( const std::map< wxString, wxString > &  aProperties)
private

◆ ParseBusEntry()

void SCH_IO_ALTIUM::ParseBusEntry ( const std::map< wxString, wxString > &  aProperties)
private

◆ ParseCircle()

◆ ParseComponent()

◆ ParseDesignator()

◆ ParseEllipse()

◆ ParseEllipticalArc()

◆ ParseFileHeader()

◆ ParseFileName()

◆ ParseHarnessConnector()

◆ ParseHarnessEntry()

◆ ParseHarnessPort()

◆ ParseHarnessType()

◆ ParseHyperlink()

void SCH_IO_ALTIUM::ParseHyperlink ( const std::map< wxString, wxString > &  aProperties,
std::vector< LIB_SYMBOL * > &  aSymbol = nullsym 
)
private

◆ ParseImage()

◆ ParseImplementation()

◆ ParseImplementationList()

void SCH_IO_ALTIUM::ParseImplementationList ( int  aIndex,
const std::map< wxString, wxString > &  aProperties 
)
private

Definition at line 4094 of file sch_io_altium.cpp.

References m_altiumImplementationList, and ASCH_OWNER_INTERFACE::ownerindex.

Referenced by ParseRecord().

◆ ParseJunction()

void SCH_IO_ALTIUM::ParseJunction ( const std::map< wxString, wxString > &  aProperties)
private

◆ ParseLabel()

◆ ParseLibComponent()

◆ ParseLibDesignator()

void SCH_IO_ALTIUM::ParseLibDesignator ( const std::map< wxString, wxString > &  aProperties,
std::vector< LIB_SYMBOL * > &  aSymbol = nullsym,
std::vector< int > &  aFontSize = nullint 
)
private

◆ ParseLibFile()

◆ ParseLibHeader()

void SCH_IO_ALTIUM::ParseLibHeader ( const ALTIUM_COMPOUND_FILE aAltiumSchFile,
std::vector< int > &  aFontSizes 
)
private

◆ ParseLibParameter()

◆ ParseLine()

◆ ParseNetLabel()

void SCH_IO_ALTIUM::ParseNetLabel ( const std::map< wxString, wxString > &  aProperties)
private

◆ ParseNoERC()

void SCH_IO_ALTIUM::ParseNoERC ( const std::map< wxString, wxString > &  aProperties)
private

◆ ParseNote()

void SCH_IO_ALTIUM::ParseNote ( const std::map< wxString, wxString > &  aProperties)
private

Definition at line 1572 of file sch_io_altium.cpp.

References AddTextBox().

Referenced by ParseRecord().

◆ ParseParameter()

◆ ParsePieChart()

◆ ParsePin()

◆ ParsePolygon()

◆ ParsePolyline()

◆ ParsePort()

◆ ParsePowerPort()

◆ ParseRecord()

◆ ParseRectangle()

◆ ParseRoundRectangle()

◆ ParseSheet()

◆ ParseSheetEntry()

◆ ParseSheetName()

◆ ParseSheetSymbol()

◆ ParseSignalHarness()

◆ ParseStorage()

◆ ParseTemplate()

void SCH_IO_ALTIUM::ParseTemplate ( int  aIndex,
const std::map< wxString, wxString > &  aProperties 
)
private

◆ ParseTextFrame()

void SCH_IO_ALTIUM::ParseTextFrame ( const std::map< wxString, wxString > &  aProperties,
std::vector< LIB_SYMBOL * > &  aSymbol = nullsym,
std::vector< int > &  aFontSize = nullint 
)
private

◆ ParseWire()

void SCH_IO_ALTIUM::ParseWire ( const std::map< wxString, wxString > &  aProperties)
private

◆ SaveLibrary()

void SCH_IO::SaveLibrary ( const wxString &  aFileName,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Reimplemented in SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 62 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ SaveSchematicFile()

void SCH_IO::SaveSchematicFile ( const wxString &  aFileName,
SCH_SHEET aSheet,
SCHEMATIC aSchematic,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Write aSchematic to a storage file in a format that this SCH_IO implementation knows about, or it can be used to write a portion of aSchematic to a special kind of export file.

Parameters
aFileNameis the name of a file to save to on disk.
aSheetis the class SCH_SHEET in memory document tree from which to extract information when writing to aFileName. The caller continues to own the SCHEMATIC, and the plugin should refrain from modifying the SCHEMATIC if possible.
aSchematicis the SCHEMATIC object used to access any schematic-wide or project information needed to save the document.
aPropertiesis 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. Set the #PropSaveCurrentSheetOnly property to only save the current sheet. Otherwise, all hierarchical sheets are saved.
Exceptions
IO_ERRORif there is a problem saving or exporting.

Reimplemented in SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 75 of file sch_io.cpp.

References NOT_IMPLEMENTED.

◆ SaveSymbol()

void SCH_IO::SaveSymbol ( const wxString &  aLibraryPath,
const LIB_SYMBOL aSymbol,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Write aSymbol to an existing library located at aLibraryPath.

If a LIB_SYMBOL by the same name already exists or there are any conflicting alias names, the new LIB_SYMBOL will silently overwrite any existing aliases and/or part because libraries cannot have duplicate alias names. It is the responsibility of the caller to check the library for conflicts before saving.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several symbols.
aSymbolis what to store in the library. The library is refreshed and the caller must update any LIB_SYMBOL pointers that may have changed.
aPropertiesis an associative array that can be used to tell the saver how to save the symbol, 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.
Exceptions
IO_ERRORif there is a problem saving.

Reimplemented in SCH_IO_HTTP_LIB, SCH_IO_KICAD_LEGACY, and SCH_IO_KICAD_SEXPR.

Definition at line 109 of file sch_io.cpp.

References NOT_IMPLEMENTED.

Referenced by LIB_BUFFER::SaveBuffer().

◆ SetLibTable()

virtual void SCH_IO::SetLibTable ( SYMBOL_LIB_TABLE aTable)
inlinevirtualinherited

Some library plugins need to have access to their parent library table.

Parameters
aTableis the table this plugin is registered within.

Reimplemented in SCH_IO_DATABASE, and SCH_IO_HTTP_LIB.

Definition at line 357 of file sch_io.h.

◆ SetProgressReporter()

virtual void IO_BASE::SetProgressReporter ( PROGRESS_REPORTER aReporter)
inlinevirtualinherited

Set an optional progress reporter.

Reimplemented in SCH_IO_CADSTAR_ARCHIVE.

Definition at line 81 of file io_base.h.

References IO_BASE::m_progressReporter.

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 76 of file io_base.h.

References IO_BASE::m_reporter.

◆ ShouldPutItemOnSheet()

◆ SupportsSubLibraries()

virtual bool SCH_IO::SupportsSubLibraries ( ) const
inlinevirtualinherited
Returns
true if this plugin supports libraries that contain sub-libraries.

Reimplemented in SCH_IO_DATABASE, and SCH_IO_HTTP_LIB.

Definition at line 288 of file sch_io.h.

Member Data Documentation

◆ m_altiumAdditional

std::vector<ASCH_ADDITIONAL_FILE> SCH_IO_ALTIUM::m_altiumAdditional
private

Definition at line 207 of file sch_io_altium.h.

◆ m_altiumComponents

std::map<int, ASCH_SYMBOL> SCH_IO_ALTIUM::m_altiumComponents
private

◆ m_altiumHarnessPortsCurrentSheet

std::vector<ASCH_PORT> SCH_IO_ALTIUM::m_altiumHarnessPortsCurrentSheet
private

Definition at line 215 of file sch_io_altium.h.

Referenced by ParseAdditional(), ParseASCIISchematic(), and ParsePort().

◆ m_altiumImplementationList

std::map<int, int> SCH_IO_ALTIUM::m_altiumImplementationList
private

◆ m_altiumPortsCurrentSheet

std::vector<ASCH_PORT> SCH_IO_ALTIUM::m_altiumPortsCurrentSheet
private

Definition at line 212 of file sch_io_altium.h.

Referenced by ParseASCIISchematic(), ParseFileHeader(), and ParseRecord().

◆ m_altiumSheet

std::unique_ptr<ASCH_SHEET> SCH_IO_ALTIUM::m_altiumSheet
private

Definition at line 200 of file sch_io_altium.h.

Referenced by AddTextBox(), ParseHarnessPort(), ParseLabel(), and ParseSheet().

◆ m_altiumStorage

std::vector<ASCH_STORAGE_FILE> SCH_IO_ALTIUM::m_altiumStorage
private

Definition at line 206 of file sch_io_altium.h.

Referenced by GetFileFromStorage(), ParseASCIISchematic(), and ParseStorage().

◆ m_altiumTemplates

std::map<int, ASCH_TEMPLATE> SCH_IO_ALTIUM::m_altiumTemplates
private

◆ m_currentTitleBlock

std::unique_ptr<TITLE_BLOCK> SCH_IO_ALTIUM::m_currentTitleBlock
private

Definition at line 196 of file sch_io_altium.h.

Referenced by ParseASCIISchematic(), ParseFileHeader(), and ParseParameter().

◆ m_fonts

std::vector<std::pair<wxString, int> > SCH_IO_ALTIUM::m_fonts
private

Definition at line 233 of file sch_io_altium.h.

◆ m_harnessEntryParent

int SCH_IO_ALTIUM::m_harnessEntryParent
private

◆ m_harnessOwnerIndexOffset

int SCH_IO_ALTIUM::m_harnessOwnerIndexOffset
private

Definition at line 218 of file sch_io_altium.h.

Referenced by ParseHarnessConnector(), ParseRecord(), and SCH_IO_ALTIUM().

◆ m_isIntLib

bool SCH_IO_ALTIUM::m_isIntLib
private

Definition at line 191 of file sch_io_altium.h.

Referenced by ensureLoadedLibrary(), ParseImplementation(), and SCH_IO_ALTIUM().

◆ m_libCache

std::map<wxString, std::map<wxString, LIB_SYMBOL*> > SCH_IO_ALTIUM::m_libCache
private

◆ m_libName

wxString SCH_IO_ALTIUM::m_libName
private

Definition at line 190 of file sch_io_altium.h.

Referenced by ensureLoadedLibrary(), getLibName(), and ParseImplementation().

◆ m_libSymbols

◆ m_name

wxString IO_BASE::m_name
protectedinherited

Name of the IO loader.

Definition at line 207 of file io_base.h.

Referenced by IO_BASE::GetName().

◆ m_pi

IO_RELEASER<SCH_IO> SCH_IO_ALTIUM::m_pi
private

◆ m_powerSymbols

std::map<wxString, LIB_SYMBOL*> SCH_IO_ALTIUM::m_powerSymbols
private

Definition at line 205 of file sch_io_altium.h.

Referenced by ParsePowerPort().

◆ m_progressReporter

◆ m_properties

std::unique_ptr<STRING_UTF8_MAP> SCH_IO_ALTIUM::m_properties
private

Definition at line 194 of file sch_io_altium.h.

Referenced by ParseASCIISchematic(), ParseFileHeader(), and ParsePowerPort().

◆ m_reporter

◆ m_rootSheet

SCH_SHEET* SCH_IO_ALTIUM::m_rootSheet
private

◆ m_schematic

◆ m_sheetOffset

◆ m_sheetPath

◆ m_sheets

std::map<int, SCH_SHEET*> SCH_IO_ALTIUM::m_sheets
private

◆ m_symbols

◆ m_timestamps

std::map<wxString, long long> SCH_IO_ALTIUM::m_timestamps
private

Definition at line 229 of file sch_io_altium.h.

Referenced by ensureLoadedLibrary().


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