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

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

#include <sch_io_kicad_legacy.h>

Inheritance diagram for SCH_IO_KICAD_LEGACY:
SCH_IO IO_BASE

Public Member Functions

 SCH_IO_KICAD_LEGACY ()
 
virtual ~SCH_IO_KICAD_LEGACY ()
 
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 std::map< std::string, UTF8 > *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 LoadContent (LINE_READER &aReader, SCH_SCREEN *aScreen, int version=EESCHEMA_VERSION)
 
void SaveSchematicFile (const wxString &aFileName, SCH_SHEET *aScreen, SCHEMATIC *aSchematic, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 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.
 
void Format (SCH_SHEET *aSheet)
 
void Format (SELECTION *aSelection, OUTPUTFORMATTER *aFormatter)
 
void EnumerateSymbolLib (wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *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 std::map< std::string, UTF8 > *aProperties=nullptr) override
 Populate a list of LIB_SYMBOL aliases contained within the library aLibraryPath.
 
LIB_SYMBOLLoadSymbol (const wxString &aLibraryPath, const wxString &aAliasName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this SCH_IO knows about.
 
void SaveSymbol (const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Write aSymbol to an existing library located at aLibraryPath.
 
void DeleteSymbol (const wxString &aLibraryPath, const wxString &aSymbolName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
 
void CreateLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 Create a new empty library at aLibraryPath empty.
 
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.
 
void SaveLibrary (const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
 
bool IsLibraryWritable (const wxString &aLibraryPath) override
 Return true if the library at aLibraryPath is writable.
 
const wxString & GetError () const override
 Return an error string to the caller.
 
virtual void GetLibraryOptions (std::map< std::string, UTF8 > *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 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 Report (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 
virtual void AdvanceProgressPhase ()
 

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

Protected Member Functions

void init (SCHEMATIC *aSchematic, const std::map< std::string, UTF8 > *aProperties=nullptr)
 initialize PLUGIN like a constructor would.
 

Protected Attributes

int m_version
 Version of file being loaded.
 
bool m_appending
 
wxString m_error
 For throwing exceptions or errors on partial schematic loads.
 
LINE_READERm_lineReader
 for progress reporting
 
unsigned m_lastProgressLine
 
unsigned m_lineCount
 for progress reporting
 
wxString m_path
 Root project path for loading child sheets.
 
std::stack< wxString > m_currentPath
 Stack to maintain nested sheet paths.
 
SCH_SHEETm_rootSheet
 The root sheet of the schematic being loaded.
 
SCH_SHEETm_currentSheet
 The sheet currently being loaded.
 
OUTPUTFORMATTERm_out
 The formatter for saving SCH_SCREEN objects.
 
SCH_IO_KICAD_LEGACY_LIB_CACHEm_cache
 
SCHEMATICm_schematic
 
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

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 (const 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 std::map< std::string, UTF8 > *aProperties)
 
bool writeDocFile (const std::map< std::string, UTF8 > *aProperties)
 
bool isBuffering (const std::map< std::string, UTF8 > *aProperties)
 

Detailed Description

A SCH_IO 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_IO there is no UI dependencies i.e. windowing calls allowed.

Definition at line 65 of file sch_io_kicad_legacy.h.

Constructor & Destructor Documentation

◆ SCH_IO_KICAD_LEGACY()

SCH_IO_KICAD_LEGACY::SCH_IO_KICAD_LEGACY ( )

Definition at line 77 of file sch_io_kicad_legacy.cpp.

References init().

◆ ~SCH_IO_KICAD_LEGACY()

SCH_IO_KICAD_LEGACY::~SCH_IO_KICAD_LEGACY ( )
virtual

Definition at line 87 of file sch_io_kicad_legacy.cpp.

References m_cache.

Member Function Documentation

◆ AdvanceProgressPhase()

void IO_BASE::AdvanceProgressPhase ( )
virtualinherited

◆ cacheLib()

void SCH_IO_KICAD_LEGACY::cacheLib ( const wxString &  aLibraryFileName,
const std::map< std::string, UTF8 > *  aProperties 
)
private

◆ CanReadLibrary()

bool SCH_IO_KICAD_LEGACY::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 2306 of file sch_io_kicad_legacy.cpp.

References IO_BASE::CanReadLibrary(), and IO_UTILS::fileStartsWithPrefix().

◆ CanReadSchematicFile()

bool SCH_IO_KICAD_LEGACY::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 2297 of file sch_io_kicad_legacy.cpp.

References SCH_IO::CanReadSchematicFile(), and IO_UTILS::fileStartsWithPrefix().

◆ checkpoint()

◆ CreateLibrary()

void SCH_IO_KICAD_LEGACY::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 2232 of file sch_io_kicad_legacy.cpp.

References _, SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), m_cache, SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), SCH_IO_LIB_CACHE::SetModified(), THROW_IO_ERROR, and writeDocFile().

◆ DeleteLibrary()

bool SCH_IO_KICAD_LEGACY::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 2251 of file sch_io_kicad_legacy.cpp.

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

◆ DeleteSymbol()

void SCH_IO_KICAD_LEGACY::DeleteSymbol ( const wxString &  aLibraryPath,
const wxString &  aSymbolName,
const std::map< std::string, UTF8 > *  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_IO.

Definition at line 2218 of file sch_io_kicad_legacy.cpp.

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

◆ EnumerateSymbolLib() [1/2]

void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib ( std::vector< LIB_SYMBOL * > &  aSymbolList,
const wxString &  aLibraryPath,
const std::map< std::string, UTF8 > *  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 2166 of file sch_io_kicad_legacy.cpp.

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

◆ EnumerateSymbolLib() [2/2]

void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib ( wxArrayString &  aSymbolNameList,
const wxString &  aLibraryPath,
const std::map< std::string, UTF8 > *  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 2145 of file sch_io_kicad_legacy.cpp.

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

◆ Format() [1/2]

◆ Format() [2/2]

◆ FormatPart()

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

◆ 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().

◆ 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_KICAD_LEGACY::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_IO.

Definition at line 138 of file sch_io_kicad_legacy.h.

References m_error.

◆ GetLibraryDesc()

const IO_BASE::IO_FILE_DESC SCH_IO_KICAD_LEGACY::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 78 of file sch_io_kicad_legacy.h.

References _HKI, and FILEEXT::LegacySymbolLibFileExtension.

◆ 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 SCH_IO::GetLibraryOptions ( std::map< std::string, UTF8 > *  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 124 of file sch_io.cpp.

References IO_BASE::GetLibraryOptions().

◆ GetModifyHash()

int SCH_IO_KICAD_LEGACY::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 2135 of file sch_io_kicad_legacy.cpp.

References SCH_IO_LIB_CACHE::GetModifyHash(), and m_cache.

◆ 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().

◆ GetSchematicFileDesc()

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

Returns schematic file description for the SCH_IO.

Reimplemented from SCH_IO.

Definition at line 72 of file sch_io_kicad_legacy.h.

References _HKI, and FILEEXT::LegacySchematicFileExtension.

◆ 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.

◆ init()

void SCH_IO_KICAD_LEGACY::init ( SCHEMATIC aSchematic,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
protected

initialize PLUGIN like a constructor would.

Definition at line 93 of file sch_io_kicad_legacy.cpp.

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

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

◆ isBuffering()

bool SCH_IO_KICAD_LEGACY::isBuffering ( const std::map< std::string, UTF8 > *  aProperties)
private

Definition at line 2129 of file sch_io_kicad_legacy.cpp.

References PropBuffering.

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

◆ IsLibraryWritable()

bool SCH_IO_KICAD_LEGACY::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 2315 of file sch_io_kicad_legacy.cpp.

◆ loadBitmap()

◆ loadBusAlias()

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

Definition at line 1482 of file sch_io_kicad_legacy.cpp.

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

Referenced by LoadContent().

◆ loadBusEntry()

SCH_BUS_ENTRY_BASE * SCH_IO_KICAD_LEGACY::loadBusEntry ( LINE_READER aReader)
private

◆ LoadContent()

◆ loadFile()

◆ loadHeader()

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

◆ loadHierarchy()

◆ loadJunction()

SCH_JUNCTION * SCH_IO_KICAD_LEGACY::loadJunction ( LINE_READER aReader)
private

◆ loadNoConnect()

SCH_NO_CONNECT * SCH_IO_KICAD_LEGACY::loadNoConnect ( LINE_READER aReader)
private

◆ loadPageSettings()

◆ LoadSchematicFile()

SCH_SHEET * SCH_IO_KICAD_LEGACY::LoadSchematicFile ( const wxString &  aFileName,
SCHEMATIC aSchematic,
SCH_SHEET aAppendToMe = nullptr,
const std::map< std::string, UTF8 > *  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.

Reimplemented from SCH_IO.

Definition at line 126 of file sch_io_kicad_legacy.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_IO_KICAD_LEGACY::LoadSymbol ( const wxString &  aLibraryPath,
const wxString &  aPartName,
const std::map< std::string, UTF8 > *  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 2187 of file sch_io_kicad_legacy.cpp.

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

◆ loadSymbol()

◆ loadText()

◆ loadWire()

◆ ParsePart()

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

◆ Report()

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

◆ saveBitmap()

◆ saveBusAlias()

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

Definition at line 2092 of file sch_io_kicad_legacy.cpp.

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

Referenced by Format().

◆ saveBusEntry()

◆ saveField()

◆ saveJunction()

void SCH_IO_KICAD_LEGACY::saveJunction ( SCH_JUNCTION aJunction)
private

◆ SaveLibrary()

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

◆ saveLine()

◆ saveNoConnect()

void SCH_IO_KICAD_LEGACY::saveNoConnect ( SCH_NO_CONNECT aNoConnect)
private

◆ SaveSchematicFile()

void SCH_IO_KICAD_LEGACY::SaveSchematicFile ( const wxString &  aFileName,
SCH_SHEET aSheet,
SCHEMATIC aSchematic,
const std::map< std::string, UTF8 > *  aProperties = nullptr 
)
overridevirtual

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

Definition at line 1507 of file sch_io_kicad_legacy.cpp.

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

◆ saveSheet()

◆ SaveSymbol()

void SCH_IO_KICAD_LEGACY::SaveSymbol ( const wxString &  aLibraryPath,
const LIB_SYMBOL aSymbol,
const std::map< std::string, UTF8 > *  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_IO.

Definition at line 2204 of file sch_io_kicad_legacy.cpp.

References SCH_IO_LIB_CACHE::AddSymbol(), cacheLib(), isBuffering(), m_cache, SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), and writeDocFile().

◆ saveSymbol()

◆ saveText()

◆ 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 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.

◆ 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.

◆ writeDocFile()

bool SCH_IO_KICAD_LEGACY::writeDocFile ( const std::map< std::string, UTF8 > *  aProperties)
private

Definition at line 2118 of file sch_io_kicad_legacy.cpp.

References PropNoDocFile.

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

Member Data Documentation

◆ m_appending

bool SCH_IO_KICAD_LEGACY::m_appending
protected

Definition at line 179 of file sch_io_kicad_legacy.h.

Referenced by LoadSchematicFile(), and loadSymbol().

◆ m_cache

◆ m_currentPath

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

Stack to maintain nested sheet paths.

Definition at line 188 of file sch_io_kicad_legacy.h.

Referenced by loadHierarchy(), and LoadSchematicFile().

◆ m_currentSheet

SCH_SHEET* SCH_IO_KICAD_LEGACY::m_currentSheet
protected

The sheet currently being loaded.

Definition at line 190 of file sch_io_kicad_legacy.h.

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

◆ m_error

wxString SCH_IO_KICAD_LEGACY::m_error
protected

For throwing exceptions or errors on partial schematic loads.

Definition at line 181 of file sch_io_kicad_legacy.h.

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

◆ m_lastProgressLine

unsigned SCH_IO_KICAD_LEGACY::m_lastProgressLine
protected

Definition at line 184 of file sch_io_kicad_legacy.h.

Referenced by checkpoint().

◆ m_lineCount

unsigned SCH_IO_KICAD_LEGACY::m_lineCount
protected

for progress reporting

Definition at line 185 of file sch_io_kicad_legacy.h.

Referenced by checkpoint(), and loadFile().

◆ m_lineReader

LINE_READER* SCH_IO_KICAD_LEGACY::m_lineReader
protected

for progress reporting

Definition at line 183 of file sch_io_kicad_legacy.h.

Referenced by checkpoint(), and loadFile().

◆ m_name

wxString IO_BASE::m_name
protectedinherited

Name of the IO loader.

Definition at line 215 of file io_base.h.

◆ m_out

OUTPUTFORMATTER* SCH_IO_KICAD_LEGACY::m_out
protected

◆ m_path

wxString SCH_IO_KICAD_LEGACY::m_path
protected

Root project path for loading child sheets.

Definition at line 187 of file sch_io_kicad_legacy.h.

Referenced by LoadSchematicFile().

◆ 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().

◆ m_rootSheet

SCH_SHEET* SCH_IO_KICAD_LEGACY::m_rootSheet
protected

The root sheet of the schematic being loaded.

Definition at line 189 of file sch_io_kicad_legacy.h.

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

◆ m_schematic

SCHEMATIC* SCH_IO_KICAD_LEGACY::m_schematic
protected

Definition at line 193 of file sch_io_kicad_legacy.h.

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

◆ m_version

int SCH_IO_KICAD_LEGACY::m_version
protected

Version of file being loaded.

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

Definition at line 176 of file sch_io_kicad_legacy.h.

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

◆ PropBuffering

const char * SCH_IO_KICAD_LEGACY::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 93 of file sch_io_kicad_legacy.h.

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

◆ PropNoDocFile

const char * SCH_IO_KICAD_LEGACY::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 99 of file sch_io_kicad_legacy.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: