|
KiCad PCB EDA Suite
|
A cache assistant for Altium symbol libraries. More...
#include <sch_io_altium_lib_cache.h>
Public Member Functions | |
| SCH_IO_ALTIUM_LIB_CACHE (const wxString &aLibraryPath) | |
| virtual | ~SCH_IO_ALTIUM_LIB_CACHE () |
| void | Load () override |
| void | IncrementModifyHash () |
| int | GetModifyHash () |
| virtual void | Save (const std::optional< bool > &aOpt=std::nullopt) |
| Save the entire library to file m_libFileName;. | |
| virtual void | AddSymbol (const LIB_SYMBOL *aSymbol) |
| virtual void | DeleteSymbol (const wxString &aName)=0 |
| virtual LIB_SYMBOL * | GetSymbol (const wxString &aName) |
| wxFileName | GetRealFile () const |
| long long | GetLibModificationTime () |
| bool | IsFile (const wxString &aFullPathAndFileName) const |
| bool | IsFileChanged () const |
| void | SetModified (bool aModified=true) |
| bool | HasParseError () const |
| void | SetParseError (bool aHasError=true) |
| Set the parse error state. | |
| wxString | GetLogicalName () const |
| void | SetFileName (const wxString &aFileName) |
| wxString | GetFileName () const |
| const LIB_SYMBOL_MAP & | GetSymbolMap () const |
Protected Member Functions | |
| LIB_SYMBOL * | removeSymbol (LIB_SYMBOL *aAlias) |
Protected Attributes | |
| int | m_modHash |
| std::mutex | m_modHashMutex |
| wxString | m_fileName |
| wxFileName | m_libFileName |
| long long | m_fileModTime |
| LIB_SYMBOL_MAP | m_symbols |
| std::map< wxString, wxString > | m_symbolSourceFiles |
| For folder-based libraries, track which source file each symbol was loaded from. | |
| bool | m_isWritable |
| bool | m_isModified |
| bool | m_hasParseError |
| SCH_LIB_TYPE | m_libType |
Private Attributes | |
| friend | SCH_IO_KICAD_SEXPR |
A cache assistant for Altium symbol libraries.
Definition at line 32 of file sch_io_altium_lib_cache.h.
| SCH_IO_ALTIUM_LIB_CACHE::SCH_IO_ALTIUM_LIB_CACHE | ( | const wxString & | aLibraryPath | ) |
|
virtual |
|
virtualinherited |
Definition at line 211 of file sch_io_lib_cache.cpp.
References LIB_SYMBOL::GetName(), IncrementModifyHash(), m_isModified, m_symbols, name, and removeSymbol().
|
pure virtualinherited |
Implemented in SCH_IO_KICAD_LEGACY_LIB_CACHE, and SCH_IO_KICAD_SEXPR_LIB_CACHE.
|
inlineinherited |
Definition at line 104 of file sch_io_lib_cache.h.
References m_libFileName.
|
inherited |
Definition at line 83 of file sch_io_lib_cache.cpp.
References GetRealFile(), FILEEXT::KiCadSymbolLibFileExtension, m_isWritable, and KIPLATFORM::IO::TimestampDir().
Referenced by SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Load(), and SCH_IO_KICAD_SEXPR_LIB_CACHE::Save().
|
inlineinherited |
Definition at line 100 of file sch_io_lib_cache.h.
References m_libFileName.
|
inlineinherited |
Definition at line 53 of file sch_io_lib_cache.h.
References m_modHash, and m_modHashMutex.
|
inherited |
Definition at line 66 of file sch_io_lib_cache.cpp.
References m_libFileName, and WX_FILENAME::ResolvePossibleSymlinks().
Referenced by GetLibModificationTime(), IsFileChanged(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), and SCH_IO_KICAD_SEXPR_LIB_CACHE::Save().
|
virtualinherited |
Definition at line 228 of file sch_io_lib_cache.cpp.
References m_symbols.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymExportSvg().
|
inlineinherited |
Definition at line 106 of file sch_io_lib_cache.h.
References m_symbols.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and EESCHEMA_JOBS_HANDLER::JobSymExportSvg().
|
inlineinherited |
When a parse error occurs, only symbols before the error are loaded. Saving a library in this state would permanently lose symbols after the error.
Definition at line 91 of file sch_io_lib_cache.h.
References m_hasParseError.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and SCH_IO_KICAD_SEXPR_LIB_CACHE::Save().
|
inlineinherited |
Definition at line 47 of file sch_io_lib_cache.h.
References m_modHash, and m_modHashMutex.
Referenced by AddSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol(), SCH_IO_KICAD_SEXPR_LIB_CACHE::DeleteSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Load(), and removeSymbol().
|
inherited |
Definition at line 103 of file sch_io_lib_cache.cpp.
References m_fileName.
|
inherited |
Definition at line 123 of file sch_io_lib_cache.cpp.
References GetRealFile(), FILEEXT::KiCadSymbolLibFileExtension, m_fileModTime, and KIPLATFORM::IO::TimestampDir().
|
overridevirtual |
Implements SCH_IO_LIB_CACHE.
|
protectedinherited |
Definition at line 144 of file sch_io_lib_cache.cpp.
References LIB_SYMBOL::AddDrawItem(), EDA_ITEM::Clone(), SCH_FIELD::GetCanonicalName(), LIB_SYMBOL::GetDrawItems(), LIB_SYMBOL::GetField(), LIB_SYMBOL::GetName(), IncrementModifyHash(), LIB_SYMBOL::IsRoot(), m_isModified, m_libFileName, m_symbols, SCH_FIELD_T, EDA_ITEM::SetParent(), and LIB_SYMBOL::SharedPtr().
Referenced by AddSymbol().
|
virtualinherited |
Save the entire library to file m_libFileName;.
Reimplemented in SCH_IO_KICAD_LEGACY_LIB_CACHE, and SCH_IO_KICAD_SEXPR_LIB_CACHE.
Definition at line 60 of file sch_io_lib_cache.cpp.
|
inherited |
Definition at line 109 of file sch_io_lib_cache.cpp.
References m_fileName, and m_libFileName.
Referenced by EESCHEMA_JOBS_HANDLER::JobSymUpgrade().
|
inlineinherited |
Definition at line 83 of file sch_io_lib_cache.h.
References m_isModified.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and EESCHEMA_JOBS_HANDLER::JobSymUpgrade().
|
inlineinherited |
Set the parse error state.
| aHasError | true if the library had a parse error during loading. |
Definition at line 98 of file sch_io_lib_cache.h.
References m_hasParseError.
Referenced by SCH_IO_KICAD_SEXPR_LIB_CACHE::Load().
|
protectedinherited |
Definition at line 116 of file sch_io_lib_cache.h.
Referenced by IsFileChanged(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Load(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Save(), and SCH_IO_LIB_CACHE().
|
protectedinherited |
Definition at line 114 of file sch_io_lib_cache.h.
Referenced by IsFile(), SCH_IO_LIB_CACHE(), and SetFileName().
|
protectedinherited |
Definition at line 127 of file sch_io_lib_cache.h.
Referenced by HasParseError(), SCH_IO_LIB_CACHE(), and SetParseError().
|
protectedinherited |
Definition at line 126 of file sch_io_lib_cache.h.
Referenced by AddSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol(), SCH_IO_KICAD_SEXPR_LIB_CACHE::DeleteSymbol(), removeSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Save(), SCH_IO_LIB_CACHE(), and SetModified().
|
protectedinherited |
Definition at line 125 of file sch_io_lib_cache.h.
Referenced by GetLibModificationTime(), and SCH_IO_LIB_CACHE().
|
protectedinherited |
Definition at line 115 of file sch_io_lib_cache.h.
Referenced by SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol(), SCH_IO_KICAD_SEXPR_LIB_CACHE::DeleteSymbol(), GetFileName(), GetLogicalName(), GetRealFile(), SCH_IO_KICAD_SEXPR_LIB_CACHE::isLibraryPathValid(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Load(), SCH_IO_KICAD_LEGACY_LIB_CACHE::loadDocs(), removeSymbol(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Save(), SCH_IO_KICAD_LEGACY_LIB_CACHE::saveDocFile(), SCH_IO_LIB_CACHE(), SetFileName(), and SCH_IO_KICAD_SEXPR_LIB_CACHE::updateParentSymbolLinks().
|
protectedinherited |
Definition at line 128 of file sch_io_lib_cache.h.
Referenced by SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), and SCH_IO_LIB_CACHE().
|
protectedinherited |
Definition at line 111 of file sch_io_lib_cache.h.
Referenced by GetModifyHash(), IncrementModifyHash(), and SCH_IO_LIB_CACHE().
|
protectedinherited |
Definition at line 112 of file sch_io_lib_cache.h.
Referenced by GetModifyHash(), and IncrementModifyHash().
|
protectedinherited |
Definition at line 117 of file sch_io_lib_cache.h.
Referenced by AddSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol(), SCH_IO_KICAD_SEXPR_LIB_CACHE::DeleteSymbol(), GetSymbol(), GetSymbolMap(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Load(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Load(), SCH_IO_KICAD_LEGACY_LIB_CACHE::loadDocs(), removeSymbol(), SCH_IO_KICAD_LEGACY_LIB_CACHE::Save(), SCH_IO_KICAD_SEXPR_LIB_CACHE::Save(), SCH_IO_KICAD_LEGACY_LIB_CACHE::saveDocFile(), SCH_IO_KICAD_SEXPR_LIB_CACHE::updateParentSymbolLinks(), and ~SCH_IO_LIB_CACHE().
|
protectedinherited |
For folder-based libraries, track which source file each symbol was loaded from.
Key is symbol name, value is the full path to the source file. This allows saving symbols back to their original files rather than creating individual files for each symbol.
Definition at line 123 of file sch_io_lib_cache.h.
Referenced by SCH_IO_KICAD_SEXPR_LIB_CACHE::Load(), and SCH_IO_KICAD_SEXPR_LIB_CACHE::Save().
|
private |
Definition at line 41 of file sch_io_altium_lib_cache.h.