KiCad PCB EDA Suite
|
Object used to load, save, search, and otherwise manipulate symbol library files. More...
#include <legacy_symbol_library.h>
Public Member Functions | |
LEGACY_SYMBOL_LIB (SCH_LIB_TYPE aType, const wxString &aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType=SCH_IO_MGR::SCH_LEGACY) | |
~LEGACY_SYMBOL_LIB () | |
int | GetModHash () const |
SCH_IO_MGR::SCH_FILE_T | GetPluginType () const |
void | SetPluginType (SCH_IO_MGR::SCH_FILE_T aPluginType) |
void | Create (const wxString &aFileName=wxEmptyString) |
void | SetFileName (const wxString &aFileName) |
bool | IsModified () const |
bool | IsCache () const |
void | SetCache () |
bool | IsBuffering () const |
void | EnableBuffering (bool aEnable=true) |
void | Save (bool aSaveDocFile=true) |
bool | IsReadOnly () const |
void | GetSymbolNames (wxArrayString &aNames) const |
Load a string array with the names of all the entries in this library. | |
void | GetSymbols (std::vector< LIB_SYMBOL * > &aSymbols) const |
Load a vector with all the entries in this library. | |
LIB_SYMBOL * | FindSymbol (const wxString &aName) const |
Find LIB_SYMBOL by aName. | |
LIB_SYMBOL * | FindSymbol (const LIB_ID &aLibId) const |
void | AddSymbol (LIB_SYMBOL *aSymbol) |
Add aSymbol entry to library. | |
LIB_SYMBOL * | RemoveSymbol (LIB_SYMBOL *aEntry) |
Safely remove aEntry from the library and return the next entry. | |
LIB_SYMBOL * | ReplaceSymbol (LIB_SYMBOL *aOldSymbol, LIB_SYMBOL *aNewSymbol) |
Replace an existing symbol entry in the library. | |
const wxString | GetName () const |
Return the file name without path or extension. | |
wxString | GetFullFileName () const |
Return the full file library name with path and extension. | |
const wxString | GetLogicalName () const |
Return the logical name of the library. | |
Static Public Member Functions | |
static LEGACY_SYMBOL_LIB * | LoadSymbolLibrary (const wxString &aFileName) |
Allocate and load a symbol library file. | |
Private Attributes | |
SCH_LIB_TYPE | type |
Library type indicator. | |
wxFileName | fileName |
Library file name. | |
wxDateTime | timeStamp |
Library save time and date. | |
int | versionMajor |
Library major version number. | |
int | versionMinor |
Library minor version number. | |
wxString | header |
first line of loaded library. | |
bool | isModified |
Library modification status. | |
int | m_mod_hash |
incremented each time library is changed. | |
SCH_IO_MGR::SCH_FILE_T | m_pluginType |
std::unique_ptr< SCH_IO > | m_plugin |
std::unique_ptr< std::map< std::string, UTF8 > > | m_properties |
Library properties. | |
Object used to load, save, search, and otherwise manipulate symbol library files.
Definition at line 171 of file legacy_symbol_library.h.
LEGACY_SYMBOL_LIB::LEGACY_SYMBOL_LIB | ( | SCH_LIB_TYPE | aType, |
const wxString & | aFileName, | ||
SCH_IO_MGR::SCH_FILE_T | aPluginType = SCH_IO_MGR::SCH_LEGACY ) |
Definition at line 47 of file legacy_symbol_library.cpp.
References fileName, isModified, m_mod_hash, m_plugin, m_pluginType, m_properties, timeStamp, type, versionMajor, and versionMinor.
Referenced by FindSymbol(), and LoadSymbolLibrary().
LEGACY_SYMBOL_LIB::~LEGACY_SYMBOL_LIB | ( | ) |
Definition at line 69 of file legacy_symbol_library.cpp.
void LEGACY_SYMBOL_LIB::AddSymbol | ( | LIB_SYMBOL * | aSymbol | ) |
Add aSymbol entry to library.
aSymbol | is the symbol to add, caller retains ownership, a clone is added. |
Definition at line 183 of file legacy_symbol_library.cpp.
References fileName, IsBuffering(), isModified, m_mod_hash, m_plugin, m_properties, and LIB_SYMBOL::SharedPtr().
void LEGACY_SYMBOL_LIB::Create | ( | const wxString & | aFileName = wxEmptyString | ) |
Definition at line 90 of file legacy_symbol_library.cpp.
References fileName, m_plugin, and m_properties.
void LEGACY_SYMBOL_LIB::EnableBuffering | ( | bool | aEnable = true | ) |
Definition at line 129 of file legacy_symbol_library.cpp.
References m_properties, and SCH_IO_KICAD_LEGACY::PropBuffering.
LIB_SYMBOL * LEGACY_SYMBOL_LIB::FindSymbol | ( | const LIB_ID & | aLibId | ) | const |
Definition at line 177 of file legacy_symbol_library.cpp.
References FindSymbol(), LIB_ID::Format(), and UTF8::wx_str().
LIB_SYMBOL * LEGACY_SYMBOL_LIB::FindSymbol | ( | const wxString & | aName | ) | const |
Find LIB_SYMBOL by aName.
aName | is the name of the symbol, case sensitive. |
Definition at line 158 of file legacy_symbol_library.cpp.
References fileName, LIB_SYMBOL::GetLib(), LEGACY_SYMBOL_LIB(), m_plugin, m_properties, SIM_MODEL::MigrateSimModel(), and LIB_SYMBOL::SetLib().
Referenced by LEGACY_SYMBOL_LIBS::FindLibraryNearEntries(), LEGACY_SYMBOL_LIBS::FindLibSymbol(), FindSymbol(), SchGetLibSymbol(), and SCH_SCREEN::UpdateSymbolLinks().
|
inline |
Return the full file library name with path and extension.
Definition at line 281 of file legacy_symbol_library.h.
References fileName.
|
inline |
Return the logical name of the library.
Definition at line 288 of file legacy_symbol_library.h.
References fileName.
|
inline |
Definition at line 181 of file legacy_symbol_library.h.
References m_mod_hash.
|
inline |
Return the file name without path or extension.
Definition at line 274 of file legacy_symbol_library.h.
References fileName.
Referenced by LEGACY_SYMBOL_LIBS::FindLibraryNearEntries(), LEGACY_SYMBOL_LIBS::FindLibSymbol(), and LEGACY_SYMBOL_LIBS::GetLibraryNames().
|
inline |
Definition at line 183 of file legacy_symbol_library.h.
References m_pluginType.
void LEGACY_SYMBOL_LIB::GetSymbolNames | ( | wxArrayString & | aNames | ) | const |
Load a string array with the names of all the entries in this library.
aNames | is the array to place entry names into. |
Definition at line 138 of file legacy_symbol_library.cpp.
References fileName, m_plugin, and m_properties.
Referenced by LEGACY_SYMBOL_LIBS::FindLibraryNearEntries().
void LEGACY_SYMBOL_LIB::GetSymbols | ( | std::vector< LIB_SYMBOL * > & | aSymbols | ) | const |
Load a vector with all the entries in this library.
aSymbols | is a vector to receive the aliases. |
Definition at line 146 of file legacy_symbol_library.cpp.
References fileName, m_plugin, and m_properties.
Referenced by LEGACY_RESCUER::OpenRescueLibrary().
bool LEGACY_SYMBOL_LIB::IsBuffering | ( | ) | const |
Definition at line 123 of file legacy_symbol_library.cpp.
References m_properties, and SCH_IO_KICAD_LEGACY::PropBuffering.
Referenced by AddSymbol(), RemoveSymbol(), and ReplaceSymbol().
bool LEGACY_SYMBOL_LIB::IsCache | ( | ) | const |
Definition at line 111 of file legacy_symbol_library.cpp.
References m_properties, and SCH_IO_KICAD_LEGACY::PropNoDocFile.
Referenced by LEGACY_SYMBOL_LIBS::GetLibraryNames(), SchGetLibSymbol(), and SCH_SCREEN::UpdateSymbolLinks().
|
inline |
Definition at line 191 of file legacy_symbol_library.h.
References isModified.
|
inline |
Definition at line 209 of file legacy_symbol_library.h.
References fileName.
|
static |
Allocate and load a symbol library file.
aFileName | is the file name of the symbol library to load. |
IO_ERROR | if there's any problem loading the library. |
Definition at line 236 of file legacy_symbol_library.cpp.
References LEGACY_SYMBOL_LIB(), LT_EESCHEMA, and LIB_SYMBOL::SetLib().
Referenced by LEGACY_SYMBOL_LIBS::AddLibrary(), LEGACY_SYMBOL_LIBS::AddLibrary(), and LEGACY_SYMBOL_LIBS::ReloadLibrary().
LIB_SYMBOL * LEGACY_SYMBOL_LIB::RemoveSymbol | ( | LIB_SYMBOL * | aEntry | ) |
Safely remove aEntry from the library and return the next entry.
The next entry returned depends on the entry being removed. If the entry being remove also removes the symbol, then the next entry from the list is returned. If the entry being used only removes an alias from a symbol, then the next alias of the symbol is returned.
aEntry | is the entry to remove from library. |
Definition at line 199 of file legacy_symbol_library.cpp.
References fileName, LIB_SYMBOL::GetName(), IsBuffering(), isModified, m_mod_hash, m_plugin, and m_properties.
LIB_SYMBOL * LEGACY_SYMBOL_LIB::ReplaceSymbol | ( | LIB_SYMBOL * | aOldSymbol, |
LIB_SYMBOL * | aNewSymbol ) |
Replace an existing symbol entry in the library.
aOldSymbol | is the symbol to replace. |
aNewSymbol | is the new symbol. |
Definition at line 215 of file legacy_symbol_library.cpp.
References fileName, LIB_SYMBOL::GetName(), IsBuffering(), isModified, m_mod_hash, m_plugin, and m_properties.
void LEGACY_SYMBOL_LIB::Save | ( | bool | aSaveDocFile = true | ) |
Definition at line 74 of file legacy_symbol_library.cpp.
References fileName, isModified, m_plugin, and SCH_IO_KICAD_LEGACY::PropNoDocFile.
void LEGACY_SYMBOL_LIB::SetCache | ( | ) |
Definition at line 117 of file legacy_symbol_library.cpp.
References SCH_IO_KICAD_LEGACY::PropNoDocFile.
Referenced by LEGACY_SYMBOL_LIBS::LoadAllLibraries().
|
inline |
Definition at line 189 of file legacy_symbol_library.h.
References fileName.
void LEGACY_SYMBOL_LIB::SetPluginType | ( | SCH_IO_MGR::SCH_FILE_T | aPluginType | ) |
Definition at line 101 of file legacy_symbol_library.cpp.
References m_plugin, and m_pluginType.
|
private |
Library file name.
Definition at line 312 of file legacy_symbol_library.h.
Referenced by AddSymbol(), Create(), FindSymbol(), GetFullFileName(), GetLogicalName(), GetName(), GetSymbolNames(), GetSymbols(), IsReadOnly(), LEGACY_SYMBOL_LIB(), RemoveSymbol(), ReplaceSymbol(), Save(), and SetFileName().
|
private |
first line of loaded library.
Definition at line 316 of file legacy_symbol_library.h.
|
private |
Library modification status.
Definition at line 317 of file legacy_symbol_library.h.
Referenced by AddSymbol(), IsModified(), LEGACY_SYMBOL_LIB(), RemoveSymbol(), ReplaceSymbol(), and Save().
|
private |
incremented each time library is changed.
Definition at line 318 of file legacy_symbol_library.h.
Referenced by AddSymbol(), GetModHash(), LEGACY_SYMBOL_LIB(), RemoveSymbol(), and ReplaceSymbol().
|
private |
Definition at line 321 of file legacy_symbol_library.h.
Referenced by AddSymbol(), Create(), FindSymbol(), GetSymbolNames(), GetSymbols(), LEGACY_SYMBOL_LIB(), RemoveSymbol(), ReplaceSymbol(), Save(), and SetPluginType().
|
private |
Definition at line 320 of file legacy_symbol_library.h.
Referenced by GetPluginType(), LEGACY_SYMBOL_LIB(), and SetPluginType().
|
private |
Library properties.
Definition at line 322 of file legacy_symbol_library.h.
Referenced by AddSymbol(), Create(), EnableBuffering(), FindSymbol(), GetSymbolNames(), GetSymbols(), IsBuffering(), IsCache(), LEGACY_SYMBOL_LIB(), RemoveSymbol(), and ReplaceSymbol().
|
private |
Library save time and date.
Definition at line 313 of file legacy_symbol_library.h.
Referenced by LEGACY_SYMBOL_LIB().
|
private |
Library type indicator.
Definition at line 311 of file legacy_symbol_library.h.
Referenced by LEGACY_SYMBOL_LIB().
|
private |
Library major version number.
Definition at line 314 of file legacy_symbol_library.h.
Referenced by LEGACY_SYMBOL_LIB().
|
private |
Library minor version number.
Definition at line 315 of file legacy_symbol_library.h.
Referenced by LEGACY_SYMBOL_LIB().