KiCad PCB EDA Suite
|
Object used to load, save, search, and otherwise manipulate symbol library files. More...
#include <class_library.h>
Public Member Functions | |
PART_LIB (int aType, const wxString &aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType=SCH_IO_MGR::SCH_LEGACY) | |
~PART_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 | IsEmpty () const |
Get library entry status. More... | |
int | GetCount () const |
Return the number of entries in the library. More... | |
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 | GetAliasNames (wxArrayString &aNames) const |
Load a string array with the names of all the entries in this library. More... | |
void | GetAliases (std::vector< LIB_ALIAS * > &aAliases) const |
Load a vector with all the entries in this library. More... | |
void | GetEntryTypePowerNames (wxArrayString &aNames) const |
Load a string array with the names of entries of type POWER in this library. More... | |
LIB_ALIAS * | FindAlias (const wxString &aName) const |
Find LIB_ALIAS by aName. More... | |
LIB_ALIAS * | FindAlias (const LIB_ID &aLibId) const |
LIB_PART * | FindPart (const wxString &aName) const |
Find part by aName. More... | |
LIB_PART * | FindPart (const LIB_ID &aLibId) const |
void | AddPart (LIB_PART *aPart) |
Add aPart entry to library. More... | |
LIB_ALIAS * | RemoveAlias (LIB_ALIAS *aEntry) |
Safely remove aEntry from the library and return the next entry. More... | |
LIB_PART * | ReplacePart (LIB_PART *aOldPart, LIB_PART *aNewPart) |
Replace an existing part entry in the library. More... | |
const wxString | GetName () const |
Return the file name without path or extension. More... | |
wxString | GetFullFileName () const |
Return the full file library name with path and extension. More... | |
const wxString | GetLogicalName () const |
Return the logical name of the library. More... | |
bool | HasPowerParts () const |
Static Public Member Functions | |
static PART_LIB * | LoadLibrary (const wxString &aFileName) |
Allocate and load a symbol library file. More... | |
Private Attributes | |
int | type |
Library type indicator. More... | |
wxFileName | fileName |
Library file name. More... | |
wxDateTime | timeStamp |
Library save time and date. More... | |
int | versionMajor |
Library major version number. More... | |
int | versionMinor |
Library minor version number. More... | |
wxString | header |
first line of loaded library. More... | |
bool | isModified |
Library modification status. More... | |
int | m_mod_hash |
incremented each time library is changed. More... | |
SCH_IO_MGR::SCH_FILE_T | m_pluginType |
std::unique_ptr< SCH_PLUGIN > | m_plugin |
std::unique_ptr< PROPERTIES > | m_properties |
Library properties. More... | |
Object used to load, save, search, and otherwise manipulate symbol library files.
Definition at line 313 of file class_library.h.
PART_LIB::PART_LIB | ( | int | aType, |
const wxString & | aFileName, | ||
SCH_IO_MGR::SCH_FILE_T | aPluginType = SCH_IO_MGR::SCH_LEGACY |
||
) |
Definition at line 58 of file class_library.cpp.
References fileName, isModified, m_plugin, m_pluginType, m_properties, timeStamp, type, versionMajor, and versionMinor.
Referenced by LoadLibrary().
PART_LIB::~PART_LIB | ( | ) |
Definition at line 81 of file class_library.cpp.
void PART_LIB::AddPart | ( | LIB_PART * | aPart | ) |
Add aPart entry to library.
aPart | - Part to add, caller retains ownership, a clone is added. |
Definition at line 247 of file class_library.cpp.
References fileName, IsBuffering(), isModified, m_mod_hash, m_plugin, and m_properties.
void PART_LIB::Create | ( | const wxString & | aFileName = wxEmptyString | ) |
Definition at line 101 of file class_library.cpp.
References fileName, m_plugin, and m_properties.
void PART_LIB::EnableBuffering | ( | bool | aEnable = true | ) |
Definition at line 140 of file class_library.cpp.
References m_properties, and SCH_LEGACY_PLUGIN::PropBuffering.
LIB_ALIAS * PART_LIB::FindAlias | ( | const wxString & | aName | ) | const |
Find LIB_ALIAS by aName.
aName | - Name of entry, case sensitive. |
Definition at line 189 of file class_library.cpp.
References fileName, LIB_PART::GetLib(), LIB_ALIAS::GetPart(), m_plugin, m_properties, and LIB_PART::SetLib().
Referenced by FindAlias(), PART_LIBS::FindLibraryAlias(), PART_LIBS::FindLibraryNearEntries(), FindPart(), SCH_COMPONENT::Resolve(), SchGetLibAlias(), and SCH_COMPONENT::SetLibId().
Definition at line 203 of file class_library.cpp.
References FindAlias(), LIB_ID::Format(), and UTF8::wx_str().
LIB_PART * PART_LIB::FindPart | ( | const wxString & | aName | ) | const |
Find part by aName.
This is a helper for FindEntry so casting a LIB_ALIAS pointer to a LIB_PART pointer is not required.
aName | - Name of part, case sensitive. |
Definition at line 209 of file class_library.cpp.
References FindAlias(), and LIB_ALIAS::GetPart().
Referenced by PART_LIBS::FindLibPart(), and FindPart().
Definition at line 220 of file class_library.cpp.
References FindPart(), LIB_ID::Format(), and UTF8::wx_str().
void PART_LIB::GetAliases | ( | std::vector< LIB_ALIAS * > & | aAliases | ) | const |
Load a vector with all the entries in this library.
aAliases | - vector to receive the aliases. |
Definition at line 157 of file class_library.cpp.
References fileName, LIB_ALIAS::GetName(), numEval::lhs, m_plugin, and m_properties.
Referenced by LEGACY_RESCUER::OpenRescueLibrary().
void PART_LIB::GetAliasNames | ( | wxArrayString & | aNames | ) | const |
Load a string array with the names of all the entries in this library.
aNames | - String array to place entry names into. |
Definition at line 149 of file class_library.cpp.
References fileName, m_plugin, and m_properties.
Referenced by PART_LIBS::FindLibraryNearEntries().
|
inline |
Return the number of entries in the library.
Definition at line 361 of file class_library.h.
void PART_LIB::GetEntryTypePowerNames | ( | wxArrayString & | aNames | ) | const |
Load a string array with the names of entries of type POWER in this library.
aNames | - String array to place entry names into. |
Definition at line 167 of file class_library.cpp.
References fileName, LIB_ALIAS::GetName(), LIB_ALIAS::GetPart(), i, LIB_PART::IsPower(), m_plugin, and EDA_ITEM::Sort().
|
inline |
Return the full file library name with path and extension.
Definition at line 474 of file class_library.h.
|
inline |
Return the logical name of the library.
Definition at line 481 of file class_library.h.
References operator!=(), and operator==().
|
inline |
Definition at line 336 of file class_library.h.
|
inline |
Return the file name without path or extension.
Definition at line 467 of file class_library.h.
Referenced by PART_LIBS::FindLibPart(), PART_LIBS::FindLibraryAlias(), PART_LIBS::FindLibraryNearEntries(), LIB_PART::GetLibraryName(), and PART_LIBS::GetLibraryNames().
|
inline |
Definition at line 338 of file class_library.h.
bool PART_LIB::HasPowerParts | ( | ) | const |
Definition at line 226 of file class_library.cpp.
References fileName, LIB_ALIAS::GetPart(), i, LIB_PART::IsPower(), m_plugin, and m_properties.
bool PART_LIB::IsBuffering | ( | ) | const |
Definition at line 134 of file class_library.cpp.
References m_properties, and SCH_LEGACY_PLUGIN::PropBuffering.
Referenced by AddPart(), RemoveAlias(), and ReplacePart().
bool PART_LIB::IsCache | ( | ) | const |
Definition at line 122 of file class_library.cpp.
References m_properties, and SCH_LEGACY_PLUGIN::PropNoDocFile.
Referenced by PART_LIBS::GetLibraryNames(), and SCH_COMPONENT::GetMsgPanelInfo().
|
inline |
Get library entry status.
Definition at line 351 of file class_library.h.
|
inline |
|
inline |
Definition at line 384 of file class_library.h.
|
static |
Allocate and load a symbol library file.
aFileName | - File name of the part library to load. |
IO_ERROR | if there's any problem loading the library. |
Definition at line 298 of file class_library.cpp.
References LIB_ALIAS::GetPart(), LIBRARY_TYPE_EESCHEMA, PART_LIB(), and LIB_PART::SetLib().
Referenced by PART_LIBS::AddLibrary().
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 part, then the next entry from the list is returned. If the entry being used only removes an alias from a part, then the next alias of the part is returned.
aEntry | - Entry to remove from library. |
Definition at line 261 of file class_library.cpp.
References fileName, LIB_ALIAS::GetName(), IsBuffering(), isModified, m_mod_hash, m_plugin, and m_properties.
Replace an existing part entry in the library.
Note a part can have an alias list, so these alias will be added in library (and previously existing alias removed)
aOldPart | - The part to replace. |
aNewPart | - The new part. |
Definition at line 277 of file class_library.cpp.
References fileName, LIB_PART::GetName(), IsBuffering(), isModified, m_mod_hash, m_plugin, and m_properties.
void PART_LIB::Save | ( | bool | aSaveDocFile = true | ) |
Definition at line 86 of file class_library.cpp.
References fileName, Format(), isModified, m_plugin, and SCH_LEGACY_PLUGIN::PropNoDocFile.
void PART_LIB::SetCache | ( | ) |
Definition at line 128 of file class_library.cpp.
References SCH_LEGACY_PLUGIN::PropNoDocFile.
|
inline |
Definition at line 344 of file class_library.h.
void PART_LIB::SetPluginType | ( | SCH_IO_MGR::SCH_FILE_T | aPluginType | ) |
|
private |
Library file name.
Definition at line 316 of file class_library.h.
Referenced by AddPart(), Create(), FindAlias(), GetAliases(), GetAliasNames(), GetEntryTypePowerNames(), HasPowerParts(), PART_LIB(), RemoveAlias(), ReplacePart(), and Save().
|
private |
first line of loaded library.
Definition at line 320 of file class_library.h.
|
private |
Library modification status.
Definition at line 321 of file class_library.h.
Referenced by AddPart(), PART_LIB(), RemoveAlias(), ReplacePart(), and Save().
|
private |
incremented each time library is changed.
Definition at line 322 of file class_library.h.
Referenced by AddPart(), RemoveAlias(), and ReplacePart().
|
private |
Definition at line 325 of file class_library.h.
Referenced by AddPart(), Create(), FindAlias(), GetAliases(), GetAliasNames(), GetEntryTypePowerNames(), HasPowerParts(), PART_LIB(), RemoveAlias(), ReplacePart(), Save(), and SetPluginType().
|
private |
Definition at line 324 of file class_library.h.
Referenced by PART_LIB(), and SetPluginType().
|
private |
Library properties.
Definition at line 326 of file class_library.h.
Referenced by AddPart(), Create(), EnableBuffering(), FindAlias(), GetAliases(), GetAliasNames(), HasPowerParts(), IsBuffering(), IsCache(), PART_LIB(), RemoveAlias(), and ReplacePart().
|
private |
Library save time and date.
Definition at line 317 of file class_library.h.
Referenced by PART_LIB().
|
private |
|
private |
Library major version number.
Definition at line 318 of file class_library.h.
Referenced by PART_LIB().
|
private |
Library minor version number.
Definition at line 319 of file class_library.h.
Referenced by PART_LIB().