KiCad PCB EDA Suite
|
Object used to load, save, search, and otherwise manipulate symbol library files. More...
#include <symbol_library.h>
Public Member Functions | |
SYMBOL_LIB (SCH_LIB_TYPE aType, const wxString &aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType=SCH_IO_MGR::SCH_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 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 175 of file symbol_library.h.
SYMBOL_LIB::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 symbol_library.cpp.
References fileName, isModified, m_mod_hash, m_plugin, m_pluginType, m_properties, timeStamp, type, versionMajor, and versionMinor.
SYMBOL_LIB::~SYMBOL_LIB | ( | ) |
Definition at line 69 of file symbol_library.cpp.
void 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 symbol_library.cpp.
References fileName, IsBuffering(), isModified, m_mod_hash, m_plugin, m_properties, and LIB_SYMBOL::SharedPtr().
void SYMBOL_LIB::Create | ( | const wxString & | aFileName = wxEmptyString | ) |
Definition at line 90 of file symbol_library.cpp.
References fileName, m_plugin, and m_properties.
void SYMBOL_LIB::EnableBuffering | ( | bool | aEnable = true | ) |
Definition at line 129 of file symbol_library.cpp.
References m_properties, and SCH_IO_KICAD_LEGACY::PropBuffering.
LIB_SYMBOL * SYMBOL_LIB::FindSymbol | ( | const LIB_ID & | aLibId | ) | const |
Definition at line 177 of file symbol_library.cpp.
References FindSymbol(), LIB_ID::Format(), and UTF8::wx_str().
LIB_SYMBOL * 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 symbol_library.cpp.
References fileName, LIB_SYMBOL::GetLib(), m_plugin, m_properties, and LIB_SYMBOL::SetLib().
Referenced by SYMBOL_LIBS::FindLibraryNearEntries(), SYMBOL_LIBS::FindLibSymbol(), FindSymbol(), SchGetLibSymbol(), and SCH_SCREEN::UpdateSymbolLinks().
|
inline |
Return the full file library name with path and extension.
Definition at line 285 of file symbol_library.h.
References fileName.
|
inline |
Return the logical name of the library.
Definition at line 292 of file symbol_library.h.
References fileName.
|
inline |
Definition at line 185 of file symbol_library.h.
References m_mod_hash.
|
inline |
Return the file name without path or extension.
Definition at line 278 of file symbol_library.h.
References fileName.
Referenced by SYMBOL_LIBS::FindLibraryNearEntries(), SYMBOL_LIBS::FindLibSymbol(), LIB_SYMBOL::GetLibraryName(), and SYMBOL_LIBS::GetLibraryNames().
|
inline |
Definition at line 187 of file symbol_library.h.
References m_pluginType.
void 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 symbol_library.cpp.
References fileName, m_plugin, and m_properties.
Referenced by SYMBOL_LIBS::FindLibraryNearEntries().
void 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 symbol_library.cpp.
References fileName, m_plugin, and m_properties.
Referenced by LEGACY_RESCUER::OpenRescueLibrary().
bool SYMBOL_LIB::IsBuffering | ( | ) | const |
Definition at line 123 of file symbol_library.cpp.
References m_properties, and SCH_IO_KICAD_LEGACY::PropBuffering.
Referenced by AddSymbol(), RemoveSymbol(), and ReplaceSymbol().
bool SYMBOL_LIB::IsCache | ( | ) | const |
Definition at line 111 of file symbol_library.cpp.
References m_properties, and SCH_IO_KICAD_LEGACY::PropNoDocFile.
Referenced by SYMBOL_LIBS::GetLibraryNames(), SchGetLibSymbol(), and SCH_SCREEN::UpdateSymbolLinks().
|
inline |
Definition at line 195 of file symbol_library.h.
References isModified.
|
inline |
Definition at line 213 of file 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 symbol_library.cpp.
References LIB_SYMBOL::SetLib().
Referenced by SYMBOL_LIBS::AddLibrary(), and SYMBOL_LIBS::ReloadLibrary().
LIB_SYMBOL * 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 symbol_library.cpp.
References fileName, LIB_SYMBOL::GetName(), IsBuffering(), isModified, m_mod_hash, m_plugin, and m_properties.
LIB_SYMBOL * 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 symbol_library.cpp.
References fileName, LIB_SYMBOL::GetName(), IsBuffering(), isModified, m_mod_hash, m_plugin, and m_properties.
void SYMBOL_LIB::Save | ( | bool | aSaveDocFile = true | ) |
Definition at line 74 of file symbol_library.cpp.
References fileName, isModified, m_plugin, and SCH_IO_KICAD_LEGACY::PropNoDocFile.
void SYMBOL_LIB::SetCache | ( | ) |
Definition at line 117 of file symbol_library.cpp.
References SCH_IO_KICAD_LEGACY::PropNoDocFile.
Referenced by SYMBOL_LIBS::LoadAllLibraries().
|
inline |
Definition at line 193 of file symbol_library.h.
References fileName.
void SYMBOL_LIB::SetPluginType | ( | SCH_IO_MGR::SCH_FILE_T | aPluginType | ) |
Definition at line 101 of file symbol_library.cpp.
References m_plugin, and m_pluginType.
|
private |
Library file name.
Definition at line 316 of file symbol_library.h.
Referenced by AddSymbol(), Create(), FindSymbol(), GetFullFileName(), GetLogicalName(), GetName(), GetSymbolNames(), GetSymbols(), IsReadOnly(), RemoveSymbol(), ReplaceSymbol(), Save(), SetFileName(), and SYMBOL_LIB().
|
private |
first line of loaded library.
Definition at line 320 of file symbol_library.h.
|
private |
Library modification status.
Definition at line 321 of file symbol_library.h.
Referenced by AddSymbol(), IsModified(), RemoveSymbol(), ReplaceSymbol(), Save(), and SYMBOL_LIB().
|
private |
incremented each time library is changed.
Definition at line 322 of file symbol_library.h.
Referenced by AddSymbol(), GetModHash(), RemoveSymbol(), ReplaceSymbol(), and SYMBOL_LIB().
|
private |
Definition at line 325 of file symbol_library.h.
Referenced by AddSymbol(), Create(), FindSymbol(), GetSymbolNames(), GetSymbols(), RemoveSymbol(), ReplaceSymbol(), Save(), SetPluginType(), and SYMBOL_LIB().
|
private |
Definition at line 324 of file symbol_library.h.
Referenced by GetPluginType(), SetPluginType(), and SYMBOL_LIB().
|
private |
Library properties.
Definition at line 326 of file symbol_library.h.
Referenced by AddSymbol(), Create(), EnableBuffering(), FindSymbol(), GetSymbolNames(), GetSymbols(), IsBuffering(), IsCache(), RemoveSymbol(), ReplaceSymbol(), and SYMBOL_LIB().
|
private |
Library save time and date.
Definition at line 317 of file symbol_library.h.
Referenced by SYMBOL_LIB().
|
private |
Library type indicator.
Definition at line 315 of file symbol_library.h.
Referenced by SYMBOL_LIB().
|
private |
Library major version number.
Definition at line 318 of file symbol_library.h.
Referenced by SYMBOL_LIB().
|
private |
Library minor version number.
Definition at line 319 of file symbol_library.h.
Referenced by SYMBOL_LIB().