KiCad PCB EDA Suite
|
A cache assistant for the KiCad s-expression symbol libraries. More...
#include <sch_sexpr_lib_plugin_cache.h>
Public Member Functions | |
SCH_SEXPR_PLUGIN_CACHE (const wxString &aLibraryPath) | |
virtual | ~SCH_SEXPR_PLUGIN_CACHE () |
void | Save (const std::optional< bool > &aOpt=std::nullopt) override |
Save the entire library to file m_libFileName;. More... | |
void | Load () override |
void | DeleteSymbol (const wxString &aName) override |
void | SetFileFormatVersionAtLoad (int aVersion) |
int | GetFileFormatVersionAtLoad () const |
void | IncrementModifyHash () |
int | GetModifyHash () |
virtual void | AddSymbol (const LIB_SYMBOL *aSymbol) |
virtual LIB_SYMBOL * | GetSymbol (const wxString &aName) |
wxFileName | GetRealFile () const |
wxDateTime | GetLibModificationTime () |
bool | IsFile (const wxString &aFullPathAndFileName) const |
bool | IsFileChanged () const |
void | SetModified (bool aModified=true) |
wxString | GetLogicalName () const |
void | SetFileName (const wxString &aFileName) |
wxString | GetFileName () const |
const LIB_SYMBOL_MAP & | GetSymbolMap () const |
Static Public Member Functions | |
static void | SaveSymbol (LIB_SYMBOL *aSymbol, OUTPUTFORMATTER &aFormatter, int aNestLevel=0, const wxString &aLibName=wxEmptyString) |
Protected Member Functions | |
LIB_SYMBOL * | removeSymbol (LIB_SYMBOL *aAlias) |
Protected Attributes | |
int | m_modHash |
std::mutex | m_modHashMutex |
wxString | m_fileName |
wxFileName | m_libFileName |
wxDateTime | m_fileModTime |
LIB_SYMBOL_MAP | m_symbols |
bool | m_isWritable |
bool | m_isModified |
SCH_LIB_TYPE | m_libType |
Static Private Member Functions | |
static void | saveSymbolDrawItem (LIB_ITEM *aItem, OUTPUTFORMATTER &aFormatter, int aNestLevel) |
static void | saveField (LIB_FIELD *aField, OUTPUTFORMATTER &aFormatter, int aNestLevel) |
static void | savePin (LIB_PIN *aPin, OUTPUTFORMATTER &aFormatter, int aNestLevel=0) |
static void | saveText (LIB_TEXT *aText, OUTPUTFORMATTER &aFormatter, int aNestLevel=0) |
static void | saveTextBox (LIB_TEXTBOX *aTextBox, OUTPUTFORMATTER &aFormatter, int aNestLevel=0) |
static void | saveDcmInfoAsFields (LIB_SYMBOL *aSymbol, OUTPUTFORMATTER &aFormatter, int &aNextFreeFieldId, int aNestLevel) |
Private Attributes | |
friend | SCH_SEXPR_PLUGIN |
int | m_fileFormatVersionAtLoad |
A cache assistant for the KiCad s-expression symbol libraries.
Definition at line 39 of file sch_sexpr_lib_plugin_cache.h.
SCH_SEXPR_PLUGIN_CACHE::SCH_SEXPR_PLUGIN_CACHE | ( | const wxString & | aLibraryPath | ) |
Definition at line 39 of file sch_sexpr_lib_plugin_cache.cpp.
References m_fileFormatVersionAtLoad.
|
virtual |
Definition at line 46 of file sch_sexpr_lib_plugin_cache.cpp.
|
virtualinherited |
Definition at line 161 of file sch_lib_plugin_cache.cpp.
References LIB_SYMBOL::GetName(), SCH_LIB_PLUGIN_CACHE::IncrementModifyHash(), SCH_LIB_PLUGIN_CACHE::m_isModified, SCH_LIB_PLUGIN_CACHE::m_symbols, name, and SCH_LIB_PLUGIN_CACHE::removeSymbol().
Referenced by SCH_SEXPR_PLUGIN::SaveSymbol(), and SCH_LEGACY_PLUGIN::SaveSymbol().
|
overridevirtual |
Implements SCH_LIB_PLUGIN_CACHE.
Definition at line 506 of file sch_sexpr_lib_plugin_cache.cpp.
References _, LIB_SYMBOL::IsRoot(), SCH_LIB_PLUGIN_CACHE::m_isModified, SCH_LIB_PLUGIN_CACHE::m_libFileName, SCH_LIB_PLUGIN_CACHE::m_modHash, SCH_LIB_PLUGIN_CACHE::m_symbols, LIB_SYMBOL::SharedPtr(), and THROW_IO_ERROR.
Referenced by SCH_SEXPR_PLUGIN::DeleteSymbol().
|
inline |
Definition at line 60 of file sch_sexpr_lib_plugin_cache.h.
References m_fileFormatVersionAtLoad.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymUpgrade().
|
inlineinherited |
Definition at line 88 of file sch_lib_plugin_cache.h.
References SCH_LIB_PLUGIN_CACHE::m_libFileName.
Referenced by SCH_SEXPR_PLUGIN::SaveLibrary(), and SCH_LEGACY_PLUGIN::SaveLibrary().
|
inherited |
Definition at line 65 of file sch_lib_plugin_cache.cpp.
References SCH_LIB_PLUGIN_CACHE::GetRealFile(), and SCH_LIB_PLUGIN_CACHE::m_isWritable.
Referenced by Load(), and SCH_LEGACY_PLUGIN_CACHE::Load().
|
inlineinherited |
Definition at line 84 of file sch_lib_plugin_cache.h.
References SCH_LIB_PLUGIN_CACHE::m_libFileName.
|
inlineinherited |
Definition at line 52 of file sch_lib_plugin_cache.h.
References SCH_LIB_PLUGIN_CACHE::m_modHash, and SCH_LIB_PLUGIN_CACHE::m_modHashMutex.
Referenced by SCH_SEXPR_PLUGIN::GetModifyHash(), and SCH_LEGACY_PLUGIN::GetModifyHash().
|
inherited |
Definition at line 55 of file sch_lib_plugin_cache.cpp.
References SCH_LIB_PLUGIN_CACHE::m_libFileName, and WX_FILENAME::ResolvePossibleSymlinks().
Referenced by SCH_LIB_PLUGIN_CACHE::GetLibModificationTime(), SCH_LIB_PLUGIN_CACHE::IsFileChanged(), SCH_LEGACY_PLUGIN_CACHE::Save(), and Save().
|
virtualinherited |
Definition at line 178 of file sch_lib_plugin_cache.cpp.
References SCH_LIB_PLUGIN_CACHE::m_symbols.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymExportSvg().
|
inlineinherited |
Definition at line 90 of file sch_lib_plugin_cache.h.
References SCH_LIB_PLUGIN_CACHE::m_symbols.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymExportSvg().
|
inlineinherited |
Definition at line 46 of file sch_lib_plugin_cache.h.
References SCH_LIB_PLUGIN_CACHE::m_modHash, and SCH_LIB_PLUGIN_CACHE::m_modHashMutex.
Referenced by SCH_LIB_PLUGIN_CACHE::AddSymbol(), SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol(), SCH_LEGACY_PLUGIN_CACHE::Load(), and SCH_LIB_PLUGIN_CACHE::removeSymbol().
|
inherited |
Definition at line 77 of file sch_lib_plugin_cache.cpp.
References SCH_LIB_PLUGIN_CACHE::m_fileName.
Referenced by SCH_SEXPR_PLUGIN::cacheLib(), SCH_LEGACY_PLUGIN::cacheLib(), SCH_SEXPR_PLUGIN::DeleteSymbolLib(), SCH_LEGACY_PLUGIN::DeleteSymbolLib(), SCH_SEXPR_PLUGIN::SaveLibrary(), and SCH_LEGACY_PLUGIN::SaveLibrary().
|
inherited |
Definition at line 83 of file sch_lib_plugin_cache.cpp.
References SCH_LIB_PLUGIN_CACHE::GetRealFile(), and SCH_LIB_PLUGIN_CACHE::m_fileModTime.
Referenced by SCH_SEXPR_PLUGIN::cacheLib(), and SCH_LEGACY_PLUGIN::cacheLib().
|
overridevirtual |
Implements SCH_LIB_PLUGIN_CACHE.
Definition at line 51 of file sch_sexpr_lib_plugin_cache.cpp.
References _, SCH_LIB_PLUGIN_CACHE::GetLibModificationTime(), SCH_SEXPR_PARSER::GetParsedRequiredVersion(), SCH_LIB_PLUGIN_CACHE::m_fileModTime, SCH_LIB_PLUGIN_CACHE::m_libFileName, SCH_LIB_PLUGIN_CACHE::m_modHash, SCH_LIB_PLUGIN_CACHE::m_symbols, SCH_SEXPR_PARSER::ParseLib(), SetFileFormatVersionAtLoad(), THROW_IO_ERROR, and traceSchLegacyPlugin.
Referenced by SCH_SEXPR_PLUGIN::cacheLib(), SCH_SEXPR_PLUGIN::CreateSymbolLib(), EESCHEMA_JOBS_HANDLER::JobSymExportSvg(), and EESCHEMA_JOBS_HANDLER::JobSymUpgrade().
|
protectedinherited |
Definition at line 94 of file sch_lib_plugin_cache.cpp.
References LIB_SYMBOL::AddDrawItem(), EDA_ITEM::Clone(), LIB_SYMBOL::FindField(), LIB_FIELD::GetCanonicalName(), LIB_SYMBOL::GetDrawItems(), LIB_SYMBOL::GetName(), SCH_LIB_PLUGIN_CACHE::IncrementModifyHash(), LIB_SYMBOL::IsRoot(), LIB_FIELD_T, SCH_LIB_PLUGIN_CACHE::m_isModified, SCH_LIB_PLUGIN_CACHE::m_libFileName, SCH_LIB_PLUGIN_CACHE::m_symbols, EDA_ITEM::SetParent(), and LIB_SYMBOL::SharedPtr().
Referenced by SCH_LIB_PLUGIN_CACHE::AddSymbol().
|
overridevirtual |
Save the entire library to file m_libFileName;.
Reimplemented from SCH_LIB_PLUGIN_CACHE.
Definition at line 84 of file sch_sexpr_lib_plugin_cache.cpp.
References GetMajorMinorVersion(), SCH_LIB_PLUGIN_CACHE::GetRealFile(), SCH_LIB_PLUGIN_CACHE::m_fileModTime, SCH_LIB_PLUGIN_CACHE::m_isModified, SCH_LIB_PLUGIN_CACHE::m_symbols, name, SaveSymbol(), and SEXPR_SYMBOL_LIB_FILE_VERSION.
Referenced by SCH_SEXPR_PLUGIN::CreateSymbolLib(), SCH_SEXPR_PLUGIN::DeleteSymbol(), EESCHEMA_JOBS_HANDLER::JobSymUpgrade(), SCH_SEXPR_PLUGIN::SaveLibrary(), and SCH_SEXPR_PLUGIN::SaveSymbol().
|
staticprivate |
Definition at line 285 of file sch_sexpr_lib_plugin_cache.cpp.
References EscapeString(), filter, LIB_SYMBOL::GetFPFilters(), LIB_SYMBOL::GetKeyWords(), saveField(), EDA_TEXT::SetText(), and EDA_TEXT::SetVisible().
Referenced by SaveSymbol().
|
staticprivate |
Definition at line 387 of file sch_sexpr_lib_plugin_cache.cpp.
References EDA_ANGLE::AsDegrees(), LIB_FIELD::CanAutoplace(), EDA_TEXT::Format(), EDA_UNIT_UTILS::FormatInternalUnits(), GetCanonicalFieldName(), LIB_FIELD::GetId(), LIB_FIELD::GetName(), LIB_FIELD::GetPosition(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), LIB_FIELD::IsNameShown(), LIB_FIELD_T, MANDATORY_FIELDS, OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), schIUScale, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by saveDcmInfoAsFields(), and SaveSymbol().
|
staticprivate |
Definition at line 416 of file sch_sexpr_lib_plugin_cache.cpp.
References EDA_ITEM::ClearFlags(), EDA_UNIT_UTILS::FormatAngle(), EDA_UNIT_UTILS::FormatInternalUnits(), LIB_PIN::GetAlternates(), LIB_PIN::GetLength(), LIB_PIN::GetName(), LIB_PIN::GetNameTextSize(), LIB_PIN::GetNumber(), LIB_PIN::GetNumberTextSize(), LIB_PIN::GetOrientation(), getPinAngle(), getPinElectricalTypeToken(), getPinShapeToken(), LIB_PIN::GetPosition(), LIB_PIN::GetShape(), LIB_PIN::GetType(), IS_CHANGED, LIB_PIN::IsVisible(), LIB_PIN_T, OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), schIUScale, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by saveSymbolDrawItem().
|
static |
Definition at line 132 of file sch_sexpr_lib_plugin_cache.cpp.
References DEFAULT_PIN_NAME_OFFSET, EDA_UNIT_UTILS::FormatInternalUnits(), LIB_SYMBOL::GetExcludedFromBoard(), LIB_SYMBOL::GetExcludedFromBOM(), LIB_SYMBOL::GetExcludedFromSim(), LIB_SYMBOL::GetFields(), LIB_SYMBOL::GetLibId(), LIB_ID::GetLibItemName(), LIB_SYMBOL::GetNextAvailableFieldId(), LIB_SYMBOL::GetParent(), LIB_SYMBOL::GetPinNameOffset(), LIB_SYMBOL::GetUnitDisplayName(), LIB_SYMBOL::GetUnitDrawItems(), LIB_SYMBOL::HasUnitDisplayName(), LIB_SYMBOL::IsPower(), LIB_SYMBOL::IsRoot(), locked, MANDATORY_FIELDS, EDA_IU_SCALE::MilsToIU(), name, LIB_ID::Parse(), OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotes(), OUTPUTFORMATTER::Quotew(), saveDcmInfoAsFields(), saveField(), saveSymbolDrawItem(), schIUScale, LIB_SYMBOL::ShowPinNames(), LIB_SYMBOL::ShowPinNumbers(), LIB_SYMBOL::UnitsLocked(), and UTF8::wx_str().
Referenced by SCH_SEXPR_PLUGIN::Format(), SCH_SEXPR_PLUGIN::FormatLibSymbol(), and Save().
|
staticprivate |
Definition at line 325 of file sch_sexpr_lib_plugin_cache.cpp.
References formatArc(), formatBezier(), formatCircle(), formatPoly(), formatRect(), EDA_ITEM::GetClass(), EDA_SHAPE::GetFillColor(), EDA_SHAPE::GetFillMode(), EDA_SHAPE::GetShape(), LIB_SHAPE::GetStroke(), LIB_ITEM::IsPrivate(), LIB_PIN_T, LIB_SHAPE_T, LIB_TEXT_T, LIB_TEXTBOX_T, savePin(), saveText(), saveTextBox(), EDA_SHAPE::SHAPE_T_asString(), EDA_ITEM::Type(), and UNIMPLEMENTED_FOR.
Referenced by SaveSymbol().
|
staticprivate |
Definition at line 459 of file sch_sexpr_lib_plugin_cache.cpp.
References EDA_ANGLE::AsTenthsOfADegree(), EDA_UNIT_UTILS::FormatInternalUnits(), LIB_TEXT::GetPosition(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), LIB_ITEM::IsPrivate(), LIB_TEXT_T, OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), schIUScale, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by saveSymbolDrawItem().
|
staticprivate |
Definition at line 476 of file sch_sexpr_lib_plugin_cache.cpp.
References STROKE_PARAMS::Format(), EDA_UNIT_UTILS::FormatAngle(), formatFill(), EDA_UNIT_UTILS::FormatInternalUnits(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetFillColor(), EDA_SHAPE::GetFillMode(), EDA_SHAPE::GetStart(), LIB_SHAPE::GetStroke(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), LIB_ITEM::IsPrivate(), LIB_TEXTBOX_T, OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), schIUScale, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by saveSymbolDrawItem().
|
inline |
Definition at line 59 of file sch_sexpr_lib_plugin_cache.h.
References m_fileFormatVersionAtLoad.
Referenced by Load().
|
inlineinherited |
Definition at line 86 of file sch_lib_plugin_cache.h.
References SCH_LIB_PLUGIN_CACHE::m_libFileName.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymUpgrade(), SCH_SEXPR_PLUGIN::SaveLibrary(), and SCH_LEGACY_PLUGIN::SaveLibrary().
|
inlineinherited |
Definition at line 82 of file sch_lib_plugin_cache.h.
References SCH_LIB_PLUGIN_CACHE::m_isModified.
Referenced by SCH_SEXPR_PLUGIN::CreateSymbolLib(), SCH_LEGACY_PLUGIN::CreateSymbolLib(), EESCHEMA_JOBS_HANDLER::JobSymUpgrade(), SCH_SEXPR_PLUGIN::SaveLibrary(), and SCH_LEGACY_PLUGIN::SaveLibrary().
|
private |
Definition at line 65 of file sch_sexpr_lib_plugin_cache.h.
Referenced by GetFileFormatVersionAtLoad(), SCH_SEXPR_PLUGIN_CACHE(), and SetFileFormatVersionAtLoad().
|
protectedinherited |
Definition at line 100 of file sch_lib_plugin_cache.h.
Referenced by SCH_LIB_PLUGIN_CACHE::IsFileChanged(), Load(), SCH_LEGACY_PLUGIN_CACHE::Load(), SCH_LEGACY_PLUGIN_CACHE::Save(), and Save().
|
protectedinherited |
Definition at line 98 of file sch_lib_plugin_cache.h.
Referenced by SCH_LIB_PLUGIN_CACHE::IsFile().
|
protectedinherited |
Definition at line 103 of file sch_lib_plugin_cache.h.
Referenced by SCH_LIB_PLUGIN_CACHE::AddSymbol(), DeleteSymbol(), SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::Save(), Save(), and SCH_LIB_PLUGIN_CACHE::SetModified().
|
protectedinherited |
Definition at line 102 of file sch_lib_plugin_cache.h.
Referenced by SCH_LIB_PLUGIN_CACHE::GetLibModificationTime().
|
protectedinherited |
Definition at line 99 of file sch_lib_plugin_cache.h.
Referenced by DeleteSymbol(), SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol(), SCH_LIB_PLUGIN_CACHE::GetFileName(), SCH_LIB_PLUGIN_CACHE::GetLogicalName(), SCH_LIB_PLUGIN_CACHE::GetRealFile(), Load(), SCH_LEGACY_PLUGIN_CACHE::Load(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::saveDocFile(), and SCH_LIB_PLUGIN_CACHE::SetFileName().
|
protectedinherited |
Definition at line 104 of file sch_lib_plugin_cache.h.
Referenced by SCH_LEGACY_PLUGIN_CACHE::Load(), and SCH_LIB_PLUGIN_CACHE::SCH_LIB_PLUGIN_CACHE().
|
protectedinherited |
Definition at line 95 of file sch_lib_plugin_cache.h.
Referenced by DeleteSymbol(), SCH_LIB_PLUGIN_CACHE::GetModifyHash(), SCH_LIB_PLUGIN_CACHE::IncrementModifyHash(), and Load().
|
protectedinherited |
Definition at line 96 of file sch_lib_plugin_cache.h.
Referenced by SCH_LIB_PLUGIN_CACHE::GetModifyHash(), and SCH_LIB_PLUGIN_CACHE::IncrementModifyHash().
|
protectedinherited |
Definition at line 101 of file sch_lib_plugin_cache.h.
Referenced by SCH_LIB_PLUGIN_CACHE::AddSymbol(), DeleteSymbol(), SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol(), SCH_SEXPR_PLUGIN::EnumerateSymbolLib(), SCH_LEGACY_PLUGIN::EnumerateSymbolLib(), SCH_SEXPR_PLUGIN::GetAvailableSymbolFields(), SCH_LIB_PLUGIN_CACHE::GetSymbol(), SCH_LIB_PLUGIN_CACHE::GetSymbolMap(), Load(), SCH_LEGACY_PLUGIN_CACHE::Load(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), SCH_SEXPR_PLUGIN::LoadSymbol(), SCH_LEGACY_PLUGIN::LoadSymbol(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), SCH_LEGACY_PLUGIN_CACHE::Save(), Save(), SCH_LEGACY_PLUGIN_CACHE::saveDocFile(), and SCH_LIB_PLUGIN_CACHE::~SCH_LIB_PLUGIN_CACHE().
|
private |
Definition at line 63 of file sch_sexpr_lib_plugin_cache.h.