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

A SCH_PLUGIN derivation for loading schematic files created before the new s-expression file format. More...

#include <sch_legacy_plugin.h>

Inheritance diagram for SCH_LEGACY_PLUGIN:
SCH_PLUGIN

Public Member Functions

 SCH_LEGACY_PLUGIN ()
 
virtual ~SCH_LEGACY_PLUGIN ()
 
const wxString GetName () const override
 Return a brief hard coded name for this SCH_PLUGIN. More...
 
const PLUGIN_FILE_DESC GetSchematicFileDesc () const override
 Returns schematic file description for the SCH_PLUGIN. More...
 
const PLUGIN_FILE_DESC GetLibraryFileDesc () const override
 Returns symbol library description for the SCH_PLUGIN. More...
 
bool CanReadSchematicFile (const wxString &aFileName) const override
 Checks if this SCH_PLUGIN can read the specified schematic file. More...
 
bool CanReadLibrary (const wxString &aFileName) const override
 Checks if this SCH_PLUGIN can read the specified symbol library file. More...
 
void SetProgressReporter (PROGRESS_REPORTER *aReporter) override
 Set an optional progress reporter. More...
 
int GetModifyHash () const override
 Return the modification hash from the library cache. More...
 
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_PLUGIN implementation knows about, into either a new SCH_SHEET or an existing one. More...
 
void LoadContent (LINE_READER &aReader, SCH_SCREEN *aScreen, int version=EESCHEMA_VERSION)
 
void SaveSchematicFile (const wxString &aFileName, SCH_SHEET *aScreen, SCHEMATIC *aSchematic, const STRING_UTF8_MAP *aProperties=nullptr) override
 Write aSchematic to a storage file in a format that this SCH_PLUGIN implementation knows about, or it can be used to write a portion of aSchematic to a special kind of export file. More...
 
void Format (SCH_SHEET *aSheet)
 
void Format (SELECTION *aSelection, OUTPUTFORMATTER *aFormatter)
 
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. More...
 
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. More...
 
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_PLUGIN knows about. More...
 
void SaveSymbol (const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const STRING_UTF8_MAP *aProperties=nullptr) override
 Write aSymbol to an existing library located at aLibraryPath. More...
 
void DeleteSymbol (const wxString &aLibraryPath, const wxString &aSymbolName, const STRING_UTF8_MAP *aProperties=nullptr) override
 Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath. More...
 
void CreateSymbolLib (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override
 Create a new empty symbol library at aLibraryPath. More...
 
bool DeleteSymbolLib (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override
 Delete an existing symbol library and returns true if successful, 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. More...
 
void SaveLibrary (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr) override
 
bool IsSymbolLibWritable (const wxString &aLibraryPath) override
 Return true if the library at aLibraryPath is writable. More...
 
const wxString & GetError () const override
 Return an error string to the caller. More...
 
virtual void SetReporter (REPORTER *aReporter)
 Set an optional reporter for warnings/errors. More...
 
virtual void SymbolLibOptions (STRING_UTF8_MAP *aListToAppendTo) const
 Append supported SCH_PLUGIN options to aListToAppenTo along with internationalized descriptions. More...
 
virtual bool SupportsSubLibraries () const
 
virtual void GetSubLibraryNames (std::vector< wxString > &aNames)
 Retrieves a list of sub-libraries in this library. More...
 
virtual void GetAvailableSymbolFields (std::vector< wxString > &aNames)
 Retrieves a list of (custom) field names that are present on symbols in this library. More...
 
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. More...
 
virtual void SetLibTable (SYMBOL_LIB_TABLE *aTable)
 Some library plugins need to have access to their parent library table. More...
 

Static Public Member Functions

static LIB_SYMBOLParsePart (LINE_READER &aReader, int majorVersion=0, int minorVersion=0)
 
static void FormatPart (LIB_SYMBOL *aSymbol, OUTPUTFORMATTER &aFormatter)
 

Static Public Attributes

static const char * PropBuffering = "buffering"
 The property used internally by the plugin to enable cache buffering which prevents the library file from being written every time the cache is changed. More...
 
static const char * PropNoDocFile = "no_doc_file"
 The property used internally by the plugin to disable writing the library documentation (.dcm) file when saving the library cache. More...
 

Protected Member Functions

void init (SCHEMATIC *aSchematic, const STRING_UTF8_MAP *aProperties=nullptr)
 initialize PLUGIN like a constructor would. More...
 

Static Protected Member Functions

static bool fileStartsWithPrefix (const wxString &aFilePath, const wxString &aPrefix, bool aIgnoreWhitespace)
 
static bool fileStartsWithBinaryHeader (const wxString &aFilePath, const std::vector< uint8_t > &aHeader)
 

Protected Attributes

int m_version
 Version of file being loaded. More...
 
bool m_appending
 
wxString m_error
 For throwing exceptions or errors on partial schematic loads. More...
 
PROGRESS_REPORTERm_progressReporter
 optional; may be nullptr More...
 
LINE_READERm_lineReader
 for progress reporting More...
 
unsigned m_lastProgressLine
 
unsigned m_lineCount
 for progress reporting More...
 
wxString m_path
 Root project path for loading child sheets. More...
 
std::stack< wxString > m_currentPath
 Stack to maintain nested sheet paths. More...
 
SCH_SHEETm_rootSheet
 The root sheet of the schematic being loaded. More...
 
SCH_SHEETm_currentSheet
 The sheet currently being loaded. More...
 
OUTPUTFORMATTERm_out
 The formatter for saving SCH_SCREEN objects. More...
 
SCH_LEGACY_PLUGIN_CACHEm_cache
 
SCHEMATICm_schematic
 

Private Member Functions

void checkpoint ()
 
void loadHierarchy (SCH_SHEET *aSheet)
 
void loadHeader (LINE_READER &aReader, SCH_SCREEN *aScreen)
 
void loadPageSettings (LINE_READER &aReader, SCH_SCREEN *aScreen)
 
void loadFile (const wxString &aFileName, SCH_SCREEN *aScreen)
 
SCH_SHEETloadSheet (LINE_READER &aReader)
 
SCH_BITMAPloadBitmap (LINE_READER &aReader)
 
SCH_JUNCTIONloadJunction (LINE_READER &aReader)
 
SCH_NO_CONNECTloadNoConnect (LINE_READER &aReader)
 
SCH_LINEloadWire (LINE_READER &aReader)
 
SCH_BUS_ENTRY_BASEloadBusEntry (LINE_READER &aReader)
 
SCH_TEXTloadText (LINE_READER &aReader)
 
SCH_SYMBOLloadSymbol (LINE_READER &aReader)
 
std::shared_ptr< BUS_ALIASloadBusAlias (LINE_READER &aReader, SCH_SCREEN *aScreen)
 
void saveSymbol (SCH_SYMBOL *aSymbol)
 
void saveField (SCH_FIELD *aField)
 
void saveBitmap (SCH_BITMAP *aBitmap)
 
void saveSheet (SCH_SHEET *aSheet)
 
void saveJunction (SCH_JUNCTION *aJunction)
 
void saveNoConnect (SCH_NO_CONNECT *aNoConnect)
 
void saveBusEntry (SCH_BUS_ENTRY_BASE *aBusEntry)
 
void saveLine (SCH_LINE *aLine)
 
void saveText (SCH_TEXT *aText)
 
void saveBusAlias (std::shared_ptr< BUS_ALIAS > aAlias)
 
void cacheLib (const wxString &aLibraryFileName, const STRING_UTF8_MAP *aProperties)
 
bool writeDocFile (const STRING_UTF8_MAP *aProperties)
 
bool isBuffering (const STRING_UTF8_MAP *aProperties)
 

Detailed Description

A SCH_PLUGIN derivation for loading schematic files created before the new s-expression file format.

The legacy parser and formatter attempt to be compatible with the legacy file format. The original parser was very forgiving in that it would parse only part of a keyword. So "$C", "$Co", and "$Com" could be used for "$Comp" and the old parser would allow this. This parser is not that forgiving and sticks to the legacy file format document.

As with all SCH_PLUGINs there is no UI dependencies i.e. windowing calls allowed.

Definition at line 65 of file sch_legacy_plugin.h.

Constructor & Destructor Documentation

◆ SCH_LEGACY_PLUGIN()

SCH_LEGACY_PLUGIN::SCH_LEGACY_PLUGIN ( )

Definition at line 74 of file sch_legacy_plugin.cpp.

References init().

◆ ~SCH_LEGACY_PLUGIN()

SCH_LEGACY_PLUGIN::~SCH_LEGACY_PLUGIN ( )
virtual

Definition at line 85 of file sch_legacy_plugin.cpp.

References m_cache.

Member Function Documentation

◆ cacheLib()

void SCH_LEGACY_PLUGIN::cacheLib ( const wxString &  aLibraryFileName,
const STRING_UTF8_MAP aProperties 
)
private

◆ CanReadLibrary()

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

Checks if this SCH_PLUGIN can read the specified symbol library file.

If not overriden, extension check is used.

Reimplemented from SCH_PLUGIN.

Definition at line 2250 of file sch_legacy_plugin.cpp.

References SCH_PLUGIN::CanReadLibrary(), and SCH_PLUGIN::fileStartsWithPrefix().

◆ CanReadSchematicFile()

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

Checks if this SCH_PLUGIN can read the specified schematic file.

If not overriden, extension check is used.

Reimplemented from SCH_PLUGIN.

Definition at line 2241 of file sch_legacy_plugin.cpp.

References SCH_PLUGIN::CanReadSchematicFile(), and SCH_PLUGIN::fileStartsWithPrefix().

◆ checkpoint()

◆ CreateSymbolLib()

void SCH_LEGACY_PLUGIN::CreateSymbolLib ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
overridevirtual

Create a new empty symbol library at aLibraryPath.

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 footprints.
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 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 library, or creating it.

Reimplemented from SCH_PLUGIN.

Definition at line 2177 of file sch_legacy_plugin.cpp.

References _, SCH_LEGACY_PLUGIN_CACHE::Load(), m_cache, SCH_LEGACY_PLUGIN_CACHE::Save(), SCH_LIB_PLUGIN_CACHE::SetModified(), THROW_IO_ERROR, and writeDocFile().

◆ DeleteSymbol()

void SCH_LEGACY_PLUGIN::DeleteSymbol ( const wxString &  aLibraryPath,
const wxString &  aSymbolName,
const STRING_UTF8_MAP aProperties = nullptr 
)
overridevirtual

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

Definition at line 2163 of file sch_legacy_plugin.cpp.

References cacheLib(), SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol(), isBuffering(), m_cache, SCH_LEGACY_PLUGIN_CACHE::Save(), and writeDocFile().

◆ DeleteSymbolLib()

bool SCH_LEGACY_PLUGIN::DeleteSymbolLib ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
overridevirtual

Delete an existing symbol library and returns true if successful, 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 symbols.
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 or false if library did not exist.
Exceptions
IO_ERRORif there is a problem deleting an existing library.

Reimplemented from SCH_PLUGIN.

Definition at line 2196 of file sch_legacy_plugin.cpp.

References _, SCH_LIB_PLUGIN_CACHE::IsFile(), m_cache, and THROW_IO_ERROR.

◆ EnumerateSymbolLib() [1/2]

void SCH_LEGACY_PLUGIN::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_PLUGIN.

Definition at line 2111 of file sch_legacy_plugin.cpp.

References cacheLib(), m_cache, SCH_LIB_PLUGIN_CACHE::m_symbols, and SYMBOL_LIB_TABLE::PropPowerSymsOnly.

◆ EnumerateSymbolLib() [2/2]

void SCH_LEGACY_PLUGIN::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_PLUGIN.

Definition at line 2090 of file sch_legacy_plugin.cpp.

References cacheLib(), m_cache, SCH_LIB_PLUGIN_CACHE::m_symbols, and SYMBOL_LIB_TABLE::PropPowerSymsOnly.

◆ fileStartsWithBinaryHeader()

bool SCH_PLUGIN::fileStartsWithBinaryHeader ( const wxString &  aFilePath,
const std::vector< uint8_t > &  aHeader 
)
staticprotectedinherited

Definition at line 248 of file sch_plugin.cpp.

◆ fileStartsWithPrefix()

bool SCH_PLUGIN::fileStartsWithPrefix ( const wxString &  aFilePath,
const wxString &  aPrefix,
bool  aIgnoreWhitespace 
)
staticprotectedinherited

Definition at line 223 of file sch_plugin.cpp.

References text.

Referenced by CanReadLibrary(), and CanReadSchematicFile().

◆ Format() [1/2]

◆ Format() [2/2]

◆ FormatPart()

void SCH_LEGACY_PLUGIN::FormatPart ( LIB_SYMBOL aSymbol,
OUTPUTFORMATTER aFormatter 
)
static

Definition at line 2273 of file sch_legacy_plugin.cpp.

References SCH_LEGACY_PLUGIN_CACHE::SaveSymbol().

◆ GetAvailableSymbolFields()

virtual void SCH_PLUGIN::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 CADSTAR_SCH_ARCHIVE_PLUGIN, SCH_DATABASE_PLUGIN, SCH_HTTP_LIB_PLUGIN, and SCH_SEXPR_PLUGIN.

Definition at line 477 of file sch_io_mgr.h.

Referenced by SYMBOL_LIB_TABLE_ROW::GetAvailableSymbolFields(), and SCH_PLUGIN::GetDefaultSymbolFields().

◆ GetDefaultSymbolFields()

virtual void SCH_PLUGIN::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_DATABASE_PLUGIN, SCH_HTTP_LIB_PLUGIN, and SCH_SEXPR_PLUGIN.

Definition at line 491 of file sch_io_mgr.h.

References SCH_PLUGIN::GetAvailableSymbolFields().

Referenced by SYMBOL_LIB_TABLE_ROW::GetDefaultSymbolFields().

◆ GetError()

const wxString & SCH_LEGACY_PLUGIN::GetError ( ) const
inlineoverridevirtual

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

Definition at line 148 of file sch_legacy_plugin.h.

References m_error.

◆ GetLibraryFileDesc()

const PLUGIN_FILE_DESC SCH_LEGACY_PLUGIN::GetLibraryFileDesc ( ) const
inlineoverridevirtual

Returns symbol library description for the SCH_PLUGIN.

Reimplemented from SCH_PLUGIN.

Definition at line 83 of file sch_legacy_plugin.h.

References _HKI, and LegacySymbolLibFileExtension.

◆ GetModifyHash()

int SCH_LEGACY_PLUGIN::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_PLUGIN.

Definition at line 2080 of file sch_legacy_plugin.cpp.

References SCH_LIB_PLUGIN_CACHE::GetModifyHash(), and m_cache.

◆ GetName()

const wxString SCH_LEGACY_PLUGIN::GetName ( ) const
inlineoverridevirtual

Return a brief hard coded name for this SCH_PLUGIN.

Implements SCH_PLUGIN.

Definition at line 72 of file sch_legacy_plugin.h.

◆ GetSchematicFileDesc()

const PLUGIN_FILE_DESC SCH_LEGACY_PLUGIN::GetSchematicFileDesc ( ) const
inlineoverridevirtual

Returns schematic file description for the SCH_PLUGIN.

Reimplemented from SCH_PLUGIN.

Definition at line 77 of file sch_legacy_plugin.h.

References _HKI, and LegacySchematicFileExtension.

◆ GetSubLibraryNames()

virtual void SCH_PLUGIN::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_DATABASE_PLUGIN, and SCH_HTTP_LIB_PLUGIN.

Definition at line 466 of file sch_io_mgr.h.

Referenced by SYMBOL_LIB_TABLE_ROW::GetSubLibraryNames().

◆ init()

void SCH_LEGACY_PLUGIN::init ( SCHEMATIC aSchematic,
const STRING_UTF8_MAP aProperties = nullptr 
)
protected

initialize PLUGIN like a constructor would.

Definition at line 91 of file sch_legacy_plugin.cpp.

References m_cache, m_currentSheet, m_out, m_rootSheet, m_schematic, and m_version.

Referenced by LoadSchematicFile(), SaveSchematicFile(), and SCH_LEGACY_PLUGIN().

◆ isBuffering()

bool SCH_LEGACY_PLUGIN::isBuffering ( const STRING_UTF8_MAP aProperties)
private

Definition at line 2074 of file sch_legacy_plugin.cpp.

References STRING_UTF8_MAP::Exists(), and PropBuffering.

Referenced by cacheLib(), DeleteSymbol(), and SaveSymbol().

◆ IsSymbolLibWritable()

bool SCH_LEGACY_PLUGIN::IsSymbolLibWritable ( const wxString &  aLibraryPath)
overridevirtual

Return true if the library at aLibraryPath is writable.

(Often system libraries are read only because of where they are installed.)

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

Reimplemented from SCH_PLUGIN.

Definition at line 2259 of file sch_legacy_plugin.cpp.

◆ loadBitmap()

◆ loadBusAlias()

std::shared_ptr< BUS_ALIAS > SCH_LEGACY_PLUGIN::loadBusAlias ( LINE_READER aReader,
SCH_SCREEN aScreen 
)
private

Definition at line 1428 of file sch_legacy_plugin.cpp.

References LINE_READER::Line(), parseUnquotedString(), and strCompare().

Referenced by LoadContent().

◆ loadBusEntry()

◆ LoadContent()

◆ loadFile()

◆ loadHeader()

void SCH_LEGACY_PLUGIN::loadHeader ( LINE_READER aReader,
SCH_SCREEN aScreen 
)
private

◆ loadHierarchy()

◆ loadJunction()

SCH_JUNCTION * SCH_LEGACY_PLUGIN::loadJunction ( LINE_READER aReader)
private

◆ loadNoConnect()

SCH_NO_CONNECT * SCH_LEGACY_PLUGIN::loadNoConnect ( LINE_READER aReader)
private

◆ loadPageSettings()

◆ LoadSchematicFile()

SCH_SHEET * SCH_LEGACY_PLUGIN::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_PLUGIN 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.

Reimplemented from SCH_PLUGIN.

Definition at line 124 of file sch_legacy_plugin.cpp.

References SCH_SHEET::GetFileName(), PROJECT::GetProjectPath(), init(), SCHEMATIC::IsValid(), loadHierarchy(), m_appending, m_currentPath, m_path, m_rootSheet, SCHEMATIC::Prj(), SCHEMATIC::Root(), and traceSchLegacyPlugin.

◆ loadSheet()

◆ LoadSymbol()

LIB_SYMBOL * SCH_LEGACY_PLUGIN::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_PLUGIN 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_PLUGIN.

Definition at line 2132 of file sch_legacy_plugin.cpp.

References cacheLib(), m_cache, and SCH_LIB_PLUGIN_CACHE::m_symbols.

◆ loadSymbol()

◆ loadText()

◆ loadWire()

◆ ParsePart()

LIB_SYMBOL * SCH_LEGACY_PLUGIN::ParsePart ( LINE_READER aReader,
int  majorVersion = 0,
int  minorVersion = 0 
)
static

Definition at line 2266 of file sch_legacy_plugin.cpp.

References SCH_LEGACY_PLUGIN_CACHE::LoadPart().

◆ saveBitmap()

◆ saveBusAlias()

void SCH_LEGACY_PLUGIN::saveBusAlias ( std::shared_ptr< BUS_ALIAS aAlias)
private

Definition at line 2038 of file sch_legacy_plugin.cpp.

References m_out, OUTPUTFORMATTER::Print(), and TO_UTF8.

Referenced by Format().

◆ saveBusEntry()

◆ saveField()

◆ saveJunction()

void SCH_LEGACY_PLUGIN::saveJunction ( SCH_JUNCTION aJunction)
private

◆ SaveLibrary()

void SCH_LEGACY_PLUGIN::SaveLibrary ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
overridevirtual

◆ saveLine()

◆ saveNoConnect()

void SCH_LEGACY_PLUGIN::saveNoConnect ( SCH_NO_CONNECT aNoConnect)
private

◆ SaveSchematicFile()

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

Write aSchematic to a storage file in a format that this SCH_PLUGIN 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 from SCH_PLUGIN.

Definition at line 1453 of file sch_legacy_plugin.cpp.

References Format(), SCH_SHEET::GetScreen(), init(), m_out, and SCH_SCREEN::SetFileExists().

◆ saveSheet()

◆ SaveSymbol()

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

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

Definition at line 2149 of file sch_legacy_plugin.cpp.

References SCH_LIB_PLUGIN_CACHE::AddSymbol(), cacheLib(), isBuffering(), m_cache, SCH_LEGACY_PLUGIN_CACHE::Save(), and writeDocFile().

◆ saveSymbol()

◆ saveText()

◆ SetLibTable()

virtual void SCH_PLUGIN::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_DATABASE_PLUGIN, and SCH_HTTP_LIB_PLUGIN.

Definition at line 510 of file sch_io_mgr.h.

Referenced by SYMBOL_LIB_TABLE::FindRow(), SYMBOL_LIB_TABLE::LoadSymbolLib(), and SYMBOL_LIB_TABLE_ROW::Refresh().

◆ SetProgressReporter()

void SCH_LEGACY_PLUGIN::SetProgressReporter ( PROGRESS_REPORTER aReporter)
inlineoverridevirtual

Set an optional progress reporter.

Reimplemented from SCH_PLUGIN.

Definition at line 93 of file sch_legacy_plugin.h.

References m_progressReporter.

◆ SetReporter()

virtual void SCH_PLUGIN::SetReporter ( REPORTER aReporter)
inlinevirtualinherited

Set an optional reporter for warnings/errors.

Reimplemented in SCH_ALTIUM_PLUGIN, CADSTAR_SCH_ARCHIVE_PLUGIN, SCH_EAGLE_PLUGIN, SCH_EASYEDA_PLUGIN, SCH_EASYEDAPRO_PLUGIN, and SCH_LTSPICE_PLUGIN.

Definition at line 158 of file sch_io_mgr.h.

Referenced by SCH_EDIT_FRAME::importFile().

◆ SupportsSubLibraries()

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

Reimplemented in SCH_DATABASE_PLUGIN, and SCH_HTTP_LIB_PLUGIN.

Definition at line 452 of file sch_io_mgr.h.

Referenced by SYMBOL_LIB_TABLE_ROW::SupportsSubLibraries().

◆ SymbolLibOptions()

void SCH_PLUGIN::SymbolLibOptions ( STRING_UTF8_MAP aListToAppendTo) const
virtualinherited

Append supported SCH_PLUGIN options to aListToAppenTo along with internationalized descriptions.

Options are typically appended so that a derived SCH_PLUGIN 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_PLUGINs.) 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_PLUGIN, which has been avoided to date.

Reimplemented in CADSTAR_SCH_ARCHIVE_PLUGIN.

Definition at line 204 of file sch_plugin.cpp.

Referenced by SYMBOL_GRID_TRICKS::optionsEditor().

◆ writeDocFile()

bool SCH_LEGACY_PLUGIN::writeDocFile ( const STRING_UTF8_MAP aProperties)
private

Definition at line 2063 of file sch_legacy_plugin.cpp.

References PropNoDocFile.

Referenced by CreateSymbolLib(), DeleteSymbol(), SaveLibrary(), and SaveSymbol().

Member Data Documentation

◆ m_appending

bool SCH_LEGACY_PLUGIN::m_appending
protected

Definition at line 189 of file sch_legacy_plugin.h.

Referenced by LoadSchematicFile(), and loadSymbol().

◆ m_cache

◆ m_currentPath

std::stack<wxString> SCH_LEGACY_PLUGIN::m_currentPath
protected

Stack to maintain nested sheet paths.

Definition at line 199 of file sch_legacy_plugin.h.

Referenced by loadHierarchy(), and LoadSchematicFile().

◆ m_currentSheet

SCH_SHEET* SCH_LEGACY_PLUGIN::m_currentSheet
protected

The sheet currently being loaded.

Definition at line 201 of file sch_legacy_plugin.h.

Referenced by init(), loadHierarchy(), and loadSymbol().

◆ m_error

wxString SCH_LEGACY_PLUGIN::m_error
protected

For throwing exceptions or errors on partial schematic loads.

Definition at line 191 of file sch_legacy_plugin.h.

Referenced by GetError(), loadHeader(), and loadHierarchy().

◆ m_lastProgressLine

unsigned SCH_LEGACY_PLUGIN::m_lastProgressLine
protected

Definition at line 195 of file sch_legacy_plugin.h.

Referenced by checkpoint().

◆ m_lineCount

unsigned SCH_LEGACY_PLUGIN::m_lineCount
protected

for progress reporting

Definition at line 196 of file sch_legacy_plugin.h.

Referenced by checkpoint(), and loadFile().

◆ m_lineReader

LINE_READER* SCH_LEGACY_PLUGIN::m_lineReader
protected

for progress reporting

Definition at line 194 of file sch_legacy_plugin.h.

Referenced by checkpoint(), and loadFile().

◆ m_out

OUTPUTFORMATTER* SCH_LEGACY_PLUGIN::m_out
protected

◆ m_path

wxString SCH_LEGACY_PLUGIN::m_path
protected

Root project path for loading child sheets.

Definition at line 198 of file sch_legacy_plugin.h.

Referenced by LoadSchematicFile().

◆ m_progressReporter

PROGRESS_REPORTER* SCH_LEGACY_PLUGIN::m_progressReporter
protected

optional; may be nullptr

Definition at line 193 of file sch_legacy_plugin.h.

Referenced by checkpoint(), loadFile(), and SetProgressReporter().

◆ m_rootSheet

SCH_SHEET* SCH_LEGACY_PLUGIN::m_rootSheet
protected

The root sheet of the schematic being loaded.

Definition at line 200 of file sch_legacy_plugin.h.

Referenced by init(), LoadContent(), loadHierarchy(), LoadSchematicFile(), and loadSymbol().

◆ m_schematic

SCHEMATIC* SCH_LEGACY_PLUGIN::m_schematic
protected

Definition at line 204 of file sch_legacy_plugin.h.

Referenced by Format(), init(), and loadHierarchy().

◆ m_version

int SCH_LEGACY_PLUGIN::m_version
protected

Version of file being loaded.

Indicate if we are appending the loaded schemitic or loading a full project.

Definition at line 186 of file sch_legacy_plugin.h.

Referenced by init(), LoadContent(), loadFile(), loadHeader(), loadSymbol(), and loadText().

◆ PropBuffering

const char * SCH_LEGACY_PLUGIN::PropBuffering = "buffering"
static

The property used internally by the plugin to enable cache buffering which prevents the library file from being written every time the cache is changed.

This is useful when writing the schematic cache library file or saving a library to a new file name.

Definition at line 103 of file sch_legacy_plugin.h.

Referenced by SYMBOL_LIB::EnableBuffering(), SYMBOL_LIB::IsBuffering(), isBuffering(), SCH_EAGLE_PLUGIN::LoadSchematicFile(), SYMBOL_LIB_TABLE_RESCUER::OpenRescueLibrary(), SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(), and SYMBOL_LIBRARY_MANAGER::SaveLibrary().

◆ PropNoDocFile

const char * SCH_LEGACY_PLUGIN::PropNoDocFile = "no_doc_file"
static

The property used internally by the plugin to disable writing the library documentation (.dcm) file when saving the library cache.

Definition at line 109 of file sch_legacy_plugin.h.

Referenced by SYMBOL_LIB::IsCache(), SYMBOL_LIB::Save(), SYMBOL_LIB::SetCache(), and writeDocFile().


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