KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_IO_KICAD_SEXPR_LIB_CACHE Class Reference

A cache assistant for the KiCad s-expression symbol libraries. More...

#include <sch_io_kicad_sexpr_lib_cache.h>

Inheritance diagram for SCH_IO_KICAD_SEXPR_LIB_CACHE:
SCH_IO_LIB_CACHE

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_SYMBOLGetSymbol (const wxString &aName)
 
wxFileName GetRealFile () const
 
long long 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_MAPGetSymbolMap () const
 

Static Public Member Functions

static void SaveSymbol (LIB_SYMBOL *aSymbol, OUTPUTFORMATTER &aFormatter, const wxString &aLibName=wxEmptyString, bool aIncludeData=true)
 

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
 
bool m_isWritable
 
bool m_isModified
 
SCH_LIB_TYPE m_libType
 

Private Member Functions

void updateParentSymbolLinks ()
 Update the parent symbol links for derived symbols.
 
void formatLibraryHeader (OUTPUTFORMATTER &aFormatter)
 
bool isLibraryPathValid () const
 

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)
 

Private Attributes

friend SCH_IO_KICAD_SEXPR
 
int m_fileFormatVersionAtLoad
 

Detailed Description

A cache assistant for the KiCad s-expression symbol libraries.

Definition at line 37 of file sch_io_kicad_sexpr_lib_cache.h.

Constructor & Destructor Documentation

◆ SCH_IO_KICAD_SEXPR_LIB_CACHE()

SCH_IO_KICAD_SEXPR_LIB_CACHE::SCH_IO_KICAD_SEXPR_LIB_CACHE ( const wxString & aLibraryPath)

◆ ~SCH_IO_KICAD_SEXPR_LIB_CACHE()

SCH_IO_KICAD_SEXPR_LIB_CACHE::~SCH_IO_KICAD_SEXPR_LIB_CACHE ( )
virtual

Definition at line 50 of file sch_io_kicad_sexpr_lib_cache.cpp.

Member Function Documentation

◆ AddSymbol()

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

◆ DeleteSymbol()

void SCH_IO_KICAD_SEXPR_LIB_CACHE::DeleteSymbol ( const wxString & aName)
overridevirtual

◆ formatLibraryHeader()

void SCH_IO_KICAD_SEXPR_LIB_CACHE::formatLibraryHeader ( OUTPUTFORMATTER & aFormatter)
private

◆ GetFileFormatVersionAtLoad()

int SCH_IO_KICAD_SEXPR_LIB_CACHE::GetFileFormatVersionAtLoad ( ) const
inline

◆ GetFileName()

wxString SCH_IO_LIB_CACHE::GetFileName ( ) const
inlineinherited

Definition at line 88 of file sch_io_lib_cache.h.

References m_libFileName.

◆ GetLibModificationTime()

long long SCH_IO_LIB_CACHE::GetLibModificationTime ( )
inherited

◆ GetLogicalName()

wxString SCH_IO_LIB_CACHE::GetLogicalName ( ) const
inlineinherited

Definition at line 84 of file sch_io_lib_cache.h.

References m_libFileName.

◆ GetModifyHash()

int SCH_IO_LIB_CACHE::GetModifyHash ( )
inlineinherited

Definition at line 52 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 195 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

Definition at line 90 of file sch_io_lib_cache.h.

References m_symbols.

Referenced by EESCHEMA_JOBS_HANDLER::JobSymExportSvg().

◆ IncrementModifyHash()

◆ IsFile()

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

Definition at line 87 of file sch_io_lib_cache.cpp.

References m_fileName.

◆ IsFileChanged()

bool SCH_IO_LIB_CACHE::IsFileChanged ( ) const
inherited

◆ isLibraryPathValid()

bool SCH_IO_KICAD_SEXPR_LIB_CACHE::isLibraryPathValid ( ) const
private

Definition at line 712 of file sch_io_kicad_sexpr_lib_cache.cpp.

References SCH_IO_LIB_CACHE::m_libFileName.

Referenced by Load().

◆ Load()

◆ removeSymbol()

◆ Save()

void SCH_IO_KICAD_SEXPR_LIB_CACHE::Save ( const std::optional< bool > & aOpt = std::nullopt)
overridevirtual

◆ saveDcmInfoAsFields()

void SCH_IO_KICAD_SEXPR_LIB_CACHE::saveDcmInfoAsFields ( LIB_SYMBOL * aSymbol,
OUTPUTFORMATTER & aFormatter )
staticprivate

◆ saveField()

◆ savePin()

◆ SaveSymbol()

void SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol ( LIB_SYMBOL * aSymbol,
OUTPUTFORMATTER & aFormatter,
const wxString & aLibName = wxEmptyString,
bool aIncludeData = true )
static

◆ saveSymbolDrawItem()

◆ saveText()

◆ saveTextBox()

◆ SetFileFormatVersionAtLoad()

void SCH_IO_KICAD_SEXPR_LIB_CACHE::SetFileFormatVersionAtLoad ( int aVersion)
inline

Definition at line 57 of file sch_io_kicad_sexpr_lib_cache.h.

References m_fileFormatVersionAtLoad.

Referenced by Load().

◆ SetFileName()

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

Definition at line 86 of file sch_io_lib_cache.h.

References m_libFileName.

Referenced by EESCHEMA_JOBS_HANDLER::JobSymUpgrade().

◆ SetModified()

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

Definition at line 82 of file sch_io_lib_cache.h.

References m_isModified.

Referenced by EESCHEMA_JOBS_HANDLER::JobSymUpgrade().

◆ updateParentSymbolLinks()

void SCH_IO_KICAD_SEXPR_LIB_CACHE::updateParentSymbolLinks ( )
private

Update the parent symbol links for derived symbols.

This is now performed post library load because the symbol load order cannot be controlled when the symbol library is saved as a single symbol per file in a folder.

Exceptions
IO_ERRORif a parent symbol name cannot be found for any symbols in the library.

Definition at line 680 of file sch_io_kicad_sexpr_lib_cache.cpp.

References _, SCH_IO_LIB_CACHE::m_libFileName, SCH_IO_LIB_CACHE::m_symbols, name, and THROW_IO_ERROR.

Referenced by Load().

Member Data Documentation

◆ m_fileFormatVersionAtLoad

int SCH_IO_KICAD_SEXPR_LIB_CACHE::m_fileFormatVersionAtLoad
private

◆ m_fileModTime

◆ m_fileName

wxString SCH_IO_LIB_CACHE::m_fileName
protectedinherited

Definition at line 98 of file sch_io_lib_cache.h.

Referenced by IsFile(), and SCH_IO_LIB_CACHE().

◆ m_isModified

◆ m_isWritable

bool SCH_IO_LIB_CACHE::m_isWritable
protectedinherited

Definition at line 102 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 104 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 95 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 96 of file sch_io_lib_cache.h.

Referenced by GetModifyHash(), and IncrementModifyHash().

◆ m_symbols

◆ SCH_IO_KICAD_SEXPR

friend SCH_IO_KICAD_SEXPR_LIB_CACHE::SCH_IO_KICAD_SEXPR
private

Definition at line 61 of file sch_io_kicad_sexpr_lib_cache.h.


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