KiCad PCB EDA Suite
|
A cache assistant for the KiCad s-expression symbol libraries. More...
#include <sch_io_kicad_sexpr_lib_cache.h>
Public Member Functions | |
SCH_IO_KICAD_SEXPR_LIB_CACHE (const wxString &aLibraryPath) | |
virtual | ~SCH_IO_KICAD_SEXPR_LIB_CACHE () |
void | Save (const std::optional< bool > &aOpt=std::nullopt) override |
Save the entire library to file m_libFileName;. | |
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, const wxString &aLibName=wxEmptyString, bool aIncludeData=true) |
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 (SCH_ITEM *aItem, OUTPUTFORMATTER &aFormatter) |
static void | saveField (SCH_FIELD *aField, OUTPUTFORMATTER &aFormatter) |
static void | savePin (SCH_PIN *aPin, OUTPUTFORMATTER &aFormatter) |
static void | saveText (SCH_TEXT *aText, OUTPUTFORMATTER &aFormatter) |
static void | saveTextBox (SCH_TEXTBOX *aTextBox, OUTPUTFORMATTER &aFormatter) |
static void | saveDcmInfoAsFields (LIB_SYMBOL *aSymbol, OUTPUTFORMATTER &aFormatter, int &aNextFreeFieldId) |
Private Attributes | |
friend | SCH_IO_KICAD_SEXPR |
int | m_fileFormatVersionAtLoad |
A cache assistant for the KiCad s-expression symbol libraries.
Definition at line 37 of file sch_io_kicad_sexpr_lib_cache.h.
SCH_IO_KICAD_SEXPR_LIB_CACHE::SCH_IO_KICAD_SEXPR_LIB_CACHE | ( | const wxString & | aLibraryPath | ) |
Definition at line 39 of file sch_io_kicad_sexpr_lib_cache.cpp.
References m_fileFormatVersionAtLoad.
|
virtual |
Definition at line 46 of file sch_io_kicad_sexpr_lib_cache.cpp.
|
virtualinherited |
Definition at line 161 of file sch_io_lib_cache.cpp.
References LIB_SYMBOL::GetName(), SCH_IO_LIB_CACHE::IncrementModifyHash(), SCH_IO_LIB_CACHE::m_isModified, SCH_IO_LIB_CACHE::m_symbols, name, and SCH_IO_LIB_CACHE::removeSymbol().
Referenced by SCH_IO_KICAD_LEGACY::SaveSymbol(), and SCH_IO_KICAD_SEXPR::SaveSymbol().
|
overridevirtual |
Implements SCH_IO_LIB_CACHE.
Definition at line 530 of file sch_io_kicad_sexpr_lib_cache.cpp.
References _, SCH_IO_LIB_CACHE::IncrementModifyHash(), LIB_SYMBOL::IsRoot(), SCH_IO_LIB_CACHE::m_isModified, SCH_IO_LIB_CACHE::m_libFileName, SCH_IO_LIB_CACHE::m_symbols, LIB_SYMBOL::SharedPtr(), and THROW_IO_ERROR.
Referenced by SCH_IO_KICAD_SEXPR::DeleteSymbol().
|
inline |
Definition at line 58 of file sch_io_kicad_sexpr_lib_cache.h.
References m_fileFormatVersionAtLoad.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymUpgrade().
|
inlineinherited |
Definition at line 88 of file sch_io_lib_cache.h.
References SCH_IO_LIB_CACHE::m_libFileName.
Referenced by SCH_IO_KICAD_LEGACY::SaveLibrary(), and SCH_IO_KICAD_SEXPR::SaveLibrary().
|
inherited |
Definition at line 65 of file sch_io_lib_cache.cpp.
References SCH_IO_LIB_CACHE::GetRealFile(), and SCH_IO_LIB_CACHE::m_isWritable.
Referenced by SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), and Load().
|
inlineinherited |
Definition at line 84 of file sch_io_lib_cache.h.
References SCH_IO_LIB_CACHE::m_libFileName.
|
inlineinherited |
Definition at line 52 of file sch_io_lib_cache.h.
References SCH_IO_LIB_CACHE::m_modHash, and SCH_IO_LIB_CACHE::m_modHashMutex.
Referenced by SCH_IO_KICAD_LEGACY::GetModifyHash(), and SCH_IO_KICAD_SEXPR::GetModifyHash().
|
inherited |
Definition at line 55 of file sch_io_lib_cache.cpp.
References SCH_IO_LIB_CACHE::m_libFileName, and WX_FILENAME::ResolvePossibleSymlinks().
Referenced by SCH_IO_LIB_CACHE::GetLibModificationTime(), SCH_IO_LIB_CACHE::IsFileChanged(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), and Save().
|
virtualinherited |
Definition at line 178 of file sch_io_lib_cache.cpp.
References SCH_IO_LIB_CACHE::m_symbols.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymExportSvg().
|
inlineinherited |
Definition at line 90 of file sch_io_lib_cache.h.
References SCH_IO_LIB_CACHE::m_symbols.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymExportSvg().
|
inlineinherited |
Definition at line 46 of file sch_io_lib_cache.h.
References SCH_IO_LIB_CACHE::m_modHash, and SCH_IO_LIB_CACHE::m_modHashMutex.
Referenced by SCH_IO_LIB_CACHE::AddSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol(), DeleteSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), Load(), and SCH_IO_LIB_CACHE::removeSymbol().
|
inherited |
Definition at line 77 of file sch_io_lib_cache.cpp.
References SCH_IO_LIB_CACHE::m_fileName.
Referenced by SCH_IO_KICAD_LEGACY::cacheLib(), SCH_IO_KICAD_SEXPR::cacheLib(), SCH_IO_KICAD_LEGACY::DeleteLibrary(), SCH_IO_KICAD_SEXPR::DeleteLibrary(), SCH_IO_KICAD_LEGACY::SaveLibrary(), and SCH_IO_KICAD_SEXPR::SaveLibrary().
|
inherited |
Definition at line 83 of file sch_io_lib_cache.cpp.
References SCH_IO_LIB_CACHE::GetRealFile(), and SCH_IO_LIB_CACHE::m_fileModTime.
Referenced by SCH_IO_KICAD_LEGACY::cacheLib(), and SCH_IO_KICAD_SEXPR::cacheLib().
|
overridevirtual |
Implements SCH_IO_LIB_CACHE.
Definition at line 51 of file sch_io_kicad_sexpr_lib_cache.cpp.
References _, SCH_IO_LIB_CACHE::GetLibModificationTime(), SCH_IO_KICAD_SEXPR_PARSER::GetParsedRequiredVersion(), SCH_IO_LIB_CACHE::IncrementModifyHash(), SCH_IO_LIB_CACHE::m_fileModTime, SCH_IO_LIB_CACHE::m_libFileName, SCH_IO_LIB_CACHE::m_symbols, SCH_IO_KICAD_SEXPR_PARSER::ParseLib(), SetFileFormatVersionAtLoad(), THROW_IO_ERROR, and traceSchLegacyPlugin.
Referenced by SCH_IO_KICAD_SEXPR::cacheLib(), SCH_IO_KICAD_SEXPR::CreateLibrary(), EESCHEMA_JOBS_HANDLER::JobSymExportSvg(), and EESCHEMA_JOBS_HANDLER::JobSymUpgrade().
|
protectedinherited |
Definition at line 94 of file sch_io_lib_cache.cpp.
References LIB_SYMBOL::AddDrawItem(), EDA_ITEM::Clone(), LIB_SYMBOL::FindField(), SCH_FIELD::GetCanonicalName(), LIB_SYMBOL::GetDrawItems(), LIB_SYMBOL::GetName(), SCH_IO_LIB_CACHE::IncrementModifyHash(), LIB_SYMBOL::IsRoot(), SCH_IO_LIB_CACHE::m_isModified, SCH_IO_LIB_CACHE::m_libFileName, SCH_IO_LIB_CACHE::m_symbols, SCH_FIELD_T, EDA_ITEM::SetParent(), and LIB_SYMBOL::SharedPtr().
Referenced by SCH_IO_LIB_CACHE::AddSymbol().
|
overridevirtual |
Save the entire library to file m_libFileName;.
Reimplemented from SCH_IO_LIB_CACHE.
Definition at line 84 of file sch_io_kicad_sexpr_lib_cache.cpp.
References GetMajorMinorVersion(), SCH_IO_LIB_CACHE::GetRealFile(), SCH_IO_LIB_CACHE::m_fileModTime, SCH_IO_LIB_CACHE::m_isModified, SCH_IO_LIB_CACHE::m_symbols, name, SaveSymbol(), and SEXPR_SYMBOL_LIB_FILE_VERSION.
Referenced by SCH_IO_KICAD_SEXPR::CreateLibrary(), SCH_IO_KICAD_SEXPR::DeleteSymbol(), EESCHEMA_JOBS_HANDLER::JobSymUpgrade(), SCH_IO_KICAD_SEXPR::SaveLibrary(), and SCH_IO_KICAD_SEXPR::SaveSymbol().
|
staticprivate |
Definition at line 303 of file sch_io_kicad_sexpr_lib_cache.cpp.
References EscapeString(), filter, LIB_SYMBOL::GetFPFilters(), LIB_SYMBOL::GetKeyWords(), saveField(), SCH_FIELD::SetText(), and EDA_TEXT::SetVisible().
Referenced by SaveSymbol().
|
staticprivate |
Definition at line 405 of file sch_io_kicad_sexpr_lib_cache.cpp.
References EDA_ANGLE::AsDegrees(), SCH_FIELD::CanAutoplace(), EDA_TEXT::Format(), EDA_UNIT_UTILS::FormatInternalUnits(), GetCanonicalFieldName(), SCH_FIELD::GetId(), SCH_FIELD::GetName(), SCH_FIELD::GetPosition(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), SCH_FIELD::IsMandatory(), SCH_FIELD::IsNameShown(), SCH_ITEM::IsPrivate(), OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), SCH_FIELD_T, schIUScale, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by saveDcmInfoAsFields(), and SaveSymbol().
|
staticprivate |
Definition at line 435 of file sch_io_kicad_sexpr_lib_cache.cpp.
References EDA_ITEM::ClearFlags(), EDA_UNIT_UTILS::FormatAngle(), KICAD_FORMAT::FormatBool(), EDA_UNIT_UTILS::FormatInternalUnits(), SCH_PIN::GetAlternates(), SCH_PIN::GetLength(), SCH_PIN::GetName(), SCH_PIN::GetNameTextSize(), SCH_PIN::GetNumber(), SCH_PIN::GetNumberTextSize(), SCH_PIN::GetOrientation(), getPinAngle(), getPinElectricalTypeToken(), getPinShapeToken(), SCH_PIN::GetPosition(), SCH_PIN::GetShape(), SCH_PIN::GetType(), IS_CHANGED, SCH_PIN::IsVisible(), OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), SCH_PIN_T, schIUScale, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by saveSymbolDrawItem().
|
static |
Definition at line 134 of file sch_io_kicad_sexpr_lib_cache.cpp.
References EMBEDDED_FILES::ClearEmbeddedFonts(), DEFAULT_PIN_NAME_OFFSET, EMBEDDED_FILES::EmbeddedFileMap(), LIB_SYMBOL::EmbedFonts(), KICAD_FORMAT::FormatBool(), EDA_UNIT_UTILS::FormatInternalUnits(), EMBEDDED_FILES::GetAreFontsEmbedded(), LIB_SYMBOL::GetEmbeddedFiles(), SYMBOL::GetExcludedFromBoard(), SYMBOL::GetExcludedFromBOM(), SYMBOL::GetExcludedFromSim(), LIB_SYMBOL::GetFields(), LIB_SYMBOL::GetLibId(), LIB_ID::GetLibItemName(), LIB_SYMBOL::GetNextAvailableFieldId(), LIB_SYMBOL::GetParent(), SYMBOL::GetPinNameOffset(), SYMBOL::GetShowPinNames(), SYMBOL::GetShowPinNumbers(), 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::UnitsLocked(), EMBEDDED_FILES::WriteEmbeddedFiles(), and UTF8::wx_str().
Referenced by SCH_IO_KICAD_SEXPR::Format(), SCH_IO_KICAD_SEXPR::FormatLibSymbol(), and Save().
|
staticprivate |
Definition at line 344 of file sch_io_kicad_sexpr_lib_cache.cpp.
References formatArc(), formatBezier(), formatCircle(), formatPoly(), formatRect(), SCH_ITEM::GetClass(), EDA_SHAPE::GetFillColor(), EDA_SHAPE::GetFillMode(), EDA_SHAPE::GetShape(), SCH_SHAPE::GetStroke(), SCH_ITEM::IsPrivate(), savePin(), saveText(), saveTextBox(), SCH_PIN_T, SCH_SHAPE_T, SCH_TEXT_T, SCH_TEXTBOX_T, EDA_SHAPE::SHAPE_T_asString(), EDA_ITEM::Type(), and UNIMPLEMENTED_FOR.
Referenced by SaveSymbol().
|
staticprivate |
Definition at line 483 of file sch_io_kicad_sexpr_lib_cache.cpp.
References EDA_ANGLE::AsTenthsOfADegree(), EDA_UNIT_UTILS::FormatInternalUnits(), SCH_TEXT::GetPosition(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), SCH_ITEM::IsPrivate(), OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), SCH_TEXT_T, schIUScale, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by saveSymbolDrawItem().
|
staticprivate |
Definition at line 501 of file sch_io_kicad_sexpr_lib_cache.cpp.
References STROKE_PARAMS::Format(), EDA_UNIT_UTILS::FormatAngle(), formatFill(), EDA_UNIT_UTILS::FormatInternalUnits(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetFillColor(), EDA_SHAPE::GetFillMode(), SCH_TEXTBOX::GetMarginBottom(), SCH_TEXTBOX::GetMarginLeft(), SCH_TEXTBOX::GetMarginRight(), SCH_TEXTBOX::GetMarginTop(), EDA_SHAPE::GetStart(), SCH_SHAPE::GetStroke(), EDA_TEXT::GetText(), EDA_TEXT::GetTextAngle(), SCH_ITEM::IsPrivate(), OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), SCH_TEXTBOX_T, schIUScale, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by saveSymbolDrawItem().
|
inline |
Definition at line 57 of file sch_io_kicad_sexpr_lib_cache.h.
References m_fileFormatVersionAtLoad.
Referenced by Load().
|
inlineinherited |
Definition at line 86 of file sch_io_lib_cache.h.
References SCH_IO_LIB_CACHE::m_libFileName.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymUpgrade(), SCH_IO_KICAD_LEGACY::SaveLibrary(), and SCH_IO_KICAD_SEXPR::SaveLibrary().
|
inlineinherited |
Definition at line 82 of file sch_io_lib_cache.h.
References SCH_IO_LIB_CACHE::m_isModified.
Referenced by SCH_IO_KICAD_LEGACY::CreateLibrary(), SCH_IO_KICAD_SEXPR::CreateLibrary(), EESCHEMA_JOBS_HANDLER::JobSymUpgrade(), SCH_IO_KICAD_LEGACY::SaveLibrary(), and SCH_IO_KICAD_SEXPR::SaveLibrary().
|
private |
Definition at line 63 of file sch_io_kicad_sexpr_lib_cache.h.
Referenced by GetFileFormatVersionAtLoad(), SCH_IO_KICAD_SEXPR_LIB_CACHE(), and SetFileFormatVersionAtLoad().
|
protectedinherited |
Definition at line 100 of file sch_io_lib_cache.h.
Referenced by SCH_IO_LIB_CACHE::IsFileChanged(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), Load(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), and Save().
|
protectedinherited |
Definition at line 98 of file sch_io_lib_cache.h.
Referenced by SCH_IO_LIB_CACHE::IsFile().
|
protectedinherited |
Definition at line 103 of file sch_io_lib_cache.h.
Referenced by SCH_IO_LIB_CACHE::AddSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol(), DeleteSymbol(), SCH_IO_LIB_CACHE::removeSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), Save(), and SCH_IO_LIB_CACHE::SetModified().
|
protectedinherited |
Definition at line 102 of file sch_io_lib_cache.h.
Referenced by SCH_IO_LIB_CACHE::GetLibModificationTime().
|
protectedinherited |
Definition at line 99 of file sch_io_lib_cache.h.
Referenced by SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol(), DeleteSymbol(), SCH_IO_LIB_CACHE::GetFileName(), SCH_IO_LIB_CACHE::GetLogicalName(), SCH_IO_LIB_CACHE::GetRealFile(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), Load(), SCH_IO_KICAD_LEGACY_LIB_CACHE::loadDocs(), SCH_IO_LIB_CACHE::removeSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::saveDocFile(), and SCH_IO_LIB_CACHE::SetFileName().
|
protectedinherited |
Definition at line 104 of file sch_io_lib_cache.h.
Referenced by SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), and SCH_IO_LIB_CACHE::SCH_IO_LIB_CACHE().
|
protectedinherited |
Definition at line 95 of file sch_io_lib_cache.h.
Referenced by SCH_IO_LIB_CACHE::GetModifyHash(), and SCH_IO_LIB_CACHE::IncrementModifyHash().
|
protectedinherited |
Definition at line 96 of file sch_io_lib_cache.h.
Referenced by SCH_IO_LIB_CACHE::GetModifyHash(), and SCH_IO_LIB_CACHE::IncrementModifyHash().
|
protectedinherited |
Definition at line 101 of file sch_io_lib_cache.h.
Referenced by SCH_IO_LIB_CACHE::AddSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol(), DeleteSymbol(), SCH_IO_KICAD_LEGACY::EnumerateSymbolLib(), SCH_IO_KICAD_SEXPR::EnumerateSymbolLib(), SCH_IO_KICAD_SEXPR::GetAvailableSymbolFields(), SCH_IO_LIB_CACHE::GetSymbol(), SCH_IO_LIB_CACHE::GetSymbolMap(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), Load(), SCH_IO_KICAD_LEGACY_LIB_CACHE::loadDocs(), SCH_IO_KICAD_LEGACY::LoadSymbol(), SCH_IO_KICAD_SEXPR::LoadSymbol(), SCH_IO_LIB_CACHE::removeSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), Save(), SCH_IO_KICAD_LEGACY_LIB_CACHE::saveDocFile(), and SCH_IO_LIB_CACHE::~SCH_IO_LIB_CACHE().
|
private |
Definition at line 61 of file sch_io_kicad_sexpr_lib_cache.h.