KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_IO_ALTIUM_LIB_CACHE Class Referenceabstract

A cache assistant for Altium symbol libraries. More...

#include <sch_io_altium_lib_cache.h>

Inheritance diagram for SCH_IO_ALTIUM_LIB_CACHE:
SCH_IO_LIB_CACHE

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_SYMBOLGetSymbol (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_MAPGetSymbolMap () const
 

Protected Member Functions

LIB_SYMBOLremoveSymbol (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
 

Detailed Description

A cache assistant for Altium symbol libraries.

Definition at line 32 of file sch_io_altium_lib_cache.h.

Constructor & Destructor Documentation

◆ SCH_IO_ALTIUM_LIB_CACHE()

SCH_IO_ALTIUM_LIB_CACHE::SCH_IO_ALTIUM_LIB_CACHE ( const wxString & aLibraryPath)

◆ ~SCH_IO_ALTIUM_LIB_CACHE()

virtual SCH_IO_ALTIUM_LIB_CACHE::~SCH_IO_ALTIUM_LIB_CACHE ( )
virtual

Member Function Documentation

◆ AddSymbol()

void SCH_IO_LIB_CACHE::AddSymbol ( const LIB_SYMBOL * aSymbol)
virtualinherited

◆ DeleteSymbol()

virtual void SCH_IO_LIB_CACHE::DeleteSymbol ( const wxString & aName)
pure virtualinherited

◆ GetFileName()

wxString SCH_IO_LIB_CACHE::GetFileName ( ) const
inlineinherited

Definition at line 104 of file sch_io_lib_cache.h.

References m_libFileName.

◆ GetLibModificationTime()

◆ GetLogicalName()

wxString SCH_IO_LIB_CACHE::GetLogicalName ( ) const
inlineinherited

Definition at line 100 of file sch_io_lib_cache.h.

References m_libFileName.

◆ GetModifyHash()

int SCH_IO_LIB_CACHE::GetModifyHash ( )
inlineinherited

Definition at line 53 of file sch_io_lib_cache.h.

References m_modHash, and m_modHashMutex.

◆ GetRealFile()

wxFileName SCH_IO_LIB_CACHE::GetRealFile ( ) const
inherited

◆ GetSymbol()

LIB_SYMBOL * SCH_IO_LIB_CACHE::GetSymbol ( const wxString & aName)
virtualinherited

Definition at line 228 of file sch_io_lib_cache.cpp.

References m_symbols.

Referenced by EESCHEMA_JOBS_HANDLER::JobSymExportSvg().

◆ GetSymbolMap()

const LIB_SYMBOL_MAP & SCH_IO_LIB_CACHE::GetSymbolMap ( ) const
inlineinherited

◆ HasParseError()

bool SCH_IO_LIB_CACHE::HasParseError ( ) const
inlineinherited
Returns
true if the library had a parse error during loading.

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().

◆ IncrementModifyHash()

◆ IsFile()

bool SCH_IO_LIB_CACHE::IsFile ( const wxString & aFullPathAndFileName) const
inherited

Definition at line 103 of file sch_io_lib_cache.cpp.

References m_fileName.

◆ IsFileChanged()

bool SCH_IO_LIB_CACHE::IsFileChanged ( ) const
inherited

◆ Load()

void SCH_IO_ALTIUM_LIB_CACHE::Load ( )
overridevirtual

Implements SCH_IO_LIB_CACHE.

◆ removeSymbol()

◆ Save()

void SCH_IO_LIB_CACHE::Save ( const std::optional< bool > & aOpt = std::nullopt)
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.

◆ SetFileName()

void SCH_IO_LIB_CACHE::SetFileName ( const wxString & aFileName)
inherited

Definition at line 109 of file sch_io_lib_cache.cpp.

References m_fileName, and m_libFileName.

Referenced by EESCHEMA_JOBS_HANDLER::JobSymUpgrade().

◆ SetModified()

void SCH_IO_LIB_CACHE::SetModified ( bool aModified = true)
inlineinherited

◆ SetParseError()

void SCH_IO_LIB_CACHE::SetParseError ( bool aHasError = true)
inlineinherited

Set the parse error state.

Parameters
aHasErrortrue 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().

Member Data Documentation

◆ m_fileModTime

◆ m_fileName

wxString SCH_IO_LIB_CACHE::m_fileName
protectedinherited

Definition at line 114 of file sch_io_lib_cache.h.

Referenced by IsFile(), SCH_IO_LIB_CACHE(), and SetFileName().

◆ m_hasParseError

bool SCH_IO_LIB_CACHE::m_hasParseError
protectedinherited

Definition at line 127 of file sch_io_lib_cache.h.

Referenced by HasParseError(), SCH_IO_LIB_CACHE(), and SetParseError().

◆ m_isModified

◆ m_isWritable

bool SCH_IO_LIB_CACHE::m_isWritable
protectedinherited

Definition at line 125 of file sch_io_lib_cache.h.

Referenced by GetLibModificationTime(), and SCH_IO_LIB_CACHE().

◆ m_libFileName

◆ m_libType

SCH_LIB_TYPE SCH_IO_LIB_CACHE::m_libType
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().

◆ m_modHash

int SCH_IO_LIB_CACHE::m_modHash
protectedinherited

Definition at line 111 of file sch_io_lib_cache.h.

Referenced by GetModifyHash(), IncrementModifyHash(), and SCH_IO_LIB_CACHE().

◆ m_modHashMutex

std::mutex SCH_IO_LIB_CACHE::m_modHashMutex
protectedinherited

Definition at line 112 of file sch_io_lib_cache.h.

Referenced by GetModifyHash(), and IncrementModifyHash().

◆ m_symbols

◆ m_symbolSourceFiles

std::map<wxString, wxString> SCH_IO_LIB_CACHE::m_symbolSourceFiles
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().

◆ SCH_IO_KICAD_SEXPR

friend SCH_IO_ALTIUM_LIB_CACHE::SCH_IO_KICAD_SEXPR
private

Definition at line 41 of file sch_io_altium_lib_cache.h.


The documentation for this class was generated from the following file: