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

Object used to load, save, search, and otherwise manipulate symbol library files. More...

#include <legacy_symbol_library.h>

Public Member Functions

 LEGACY_SYMBOL_LIB (SCH_LIB_TYPE aType, const wxString &aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType=SCH_IO_MGR::SCH_LEGACY)
 
 ~LEGACY_SYMBOL_LIB ()
 
int GetModHash () const
 
SCH_IO_MGR::SCH_FILE_T GetPluginType () const
 
void SetPluginType (SCH_IO_MGR::SCH_FILE_T aPluginType)
 
void Create (const wxString &aFileName=wxEmptyString)
 
void SetFileName (const wxString &aFileName)
 
bool IsModified () const
 
bool IsCache () const
 
void SetCache ()
 
bool IsBuffering () const
 
void EnableBuffering (bool aEnable=true)
 
void Save (bool aSaveDocFile=true)
 
bool IsReadOnly () const
 
void GetSymbolNames (wxArrayString &aNames) const
 Load a string array with the names of all the entries in this library.
 
void GetSymbols (std::vector< LIB_SYMBOL * > &aSymbols) const
 Load a vector with all the entries in this library.
 
LIB_SYMBOLFindSymbol (const wxString &aName) const
 Find LIB_SYMBOL by aName.
 
LIB_SYMBOLFindSymbol (const LIB_ID &aLibId) const
 
void AddSymbol (LIB_SYMBOL *aSymbol)
 Add aSymbol entry to library.
 
LIB_SYMBOLRemoveSymbol (LIB_SYMBOL *aEntry)
 Safely remove aEntry from the library and return the next entry.
 
LIB_SYMBOLReplaceSymbol (LIB_SYMBOL *aOldSymbol, LIB_SYMBOL *aNewSymbol)
 Replace an existing symbol entry in the library.
 
const wxString GetName () const
 Return the file name without path or extension.
 
wxString GetFullFileName () const
 Return the full file library name with path and extension.
 
const wxString GetLogicalName () const
 Return the logical name of the library.
 

Static Public Member Functions

static LEGACY_SYMBOL_LIBLoadSymbolLibrary (const wxString &aFileName)
 Allocate and load a symbol library file.
 

Private Attributes

SCH_LIB_TYPE type
 Library type indicator.
 
wxFileName fileName
 Library file name.
 
wxDateTime timeStamp
 Library save time and date.
 
int versionMajor
 Library major version number.
 
int versionMinor
 Library minor version number.
 
wxString header
 first line of loaded library.
 
bool isModified
 Library modification status.
 
int m_mod_hash
 incremented each time library is changed.
 
SCH_IO_MGR::SCH_FILE_T m_pluginType
 
std::unique_ptr< SCH_IOm_plugin
 
std::unique_ptr< std::map< std::string, UTF8 > > m_properties
 Library properties.
 

Detailed Description

Object used to load, save, search, and otherwise manipulate symbol library files.

Warning
This code is obsolete with the exception of the cache library. All other symbol library I/O is managed by the SCH_IO_MGR object.

Definition at line 171 of file legacy_symbol_library.h.

Constructor & Destructor Documentation

◆ LEGACY_SYMBOL_LIB()

LEGACY_SYMBOL_LIB::LEGACY_SYMBOL_LIB ( SCH_LIB_TYPE aType,
const wxString & aFileName,
SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY )

◆ ~LEGACY_SYMBOL_LIB()

LEGACY_SYMBOL_LIB::~LEGACY_SYMBOL_LIB ( )

Definition at line 69 of file legacy_symbol_library.cpp.

Member Function Documentation

◆ AddSymbol()

void LEGACY_SYMBOL_LIB::AddSymbol ( LIB_SYMBOL * aSymbol)

Add aSymbol entry to library.

Note
A LIB_SYMBOL can have an alias list so these alias will be added in library. and the any existing duplicate aliases will be removed from the library.
Parameters
aSymbolis the symbol to add, caller retains ownership, a clone is added.

Definition at line 183 of file legacy_symbol_library.cpp.

References fileName, IsBuffering(), isModified, m_mod_hash, m_plugin, m_properties, and LIB_SYMBOL::SharedPtr().

◆ Create()

void LEGACY_SYMBOL_LIB::Create ( const wxString & aFileName = wxEmptyString)

Definition at line 90 of file legacy_symbol_library.cpp.

References fileName, m_plugin, and m_properties.

◆ EnableBuffering()

void LEGACY_SYMBOL_LIB::EnableBuffering ( bool aEnable = true)

Definition at line 129 of file legacy_symbol_library.cpp.

References m_properties, and SCH_IO_KICAD_LEGACY::PropBuffering.

◆ FindSymbol() [1/2]

LIB_SYMBOL * LEGACY_SYMBOL_LIB::FindSymbol ( const LIB_ID & aLibId) const

Definition at line 177 of file legacy_symbol_library.cpp.

References FindSymbol(), LIB_ID::Format(), and UTF8::wx_str().

◆ FindSymbol() [2/2]

LIB_SYMBOL * LEGACY_SYMBOL_LIB::FindSymbol ( const wxString & aName) const

Find LIB_SYMBOL by aName.

Parameters
aNameis the name of the symbol, case sensitive.
Returns
LIB_SYMBOL pointer symbol if found, else NULL.

Definition at line 158 of file legacy_symbol_library.cpp.

References fileName, LIB_SYMBOL::GetLib(), LEGACY_SYMBOL_LIB(), m_plugin, m_properties, SIM_MODEL::MigrateSimModel(), and LIB_SYMBOL::SetLib().

Referenced by LEGACY_SYMBOL_LIBS::FindLibraryNearEntries(), LEGACY_SYMBOL_LIBS::FindLibSymbol(), FindSymbol(), SchGetLibSymbol(), and SCH_SCREEN::UpdateSymbolLinks().

◆ GetFullFileName()

wxString LEGACY_SYMBOL_LIB::GetFullFileName ( ) const
inline

Return the full file library name with path and extension.

Returns
the full library file name with path and extension.

Definition at line 281 of file legacy_symbol_library.h.

References fileName.

◆ GetLogicalName()

const wxString LEGACY_SYMBOL_LIB::GetLogicalName ( ) const
inline

Return the logical name of the library.

Returns
The logical name of this library.

Definition at line 288 of file legacy_symbol_library.h.

References fileName.

◆ GetModHash()

int LEGACY_SYMBOL_LIB::GetModHash ( ) const
inline
Returns
a magic number that changes if the library has changed

Definition at line 181 of file legacy_symbol_library.h.

References m_mod_hash.

◆ GetName()

const wxString LEGACY_SYMBOL_LIB::GetName ( ) const
inline

Return the file name without path or extension.

Returns
the name of library file.

Definition at line 274 of file legacy_symbol_library.h.

References fileName.

Referenced by LEGACY_SYMBOL_LIBS::FindLibraryNearEntries(), LEGACY_SYMBOL_LIBS::FindLibSymbol(), and LEGACY_SYMBOL_LIBS::GetLibraryNames().

◆ GetPluginType()

SCH_IO_MGR::SCH_FILE_T LEGACY_SYMBOL_LIB::GetPluginType ( ) const
inline

Definition at line 183 of file legacy_symbol_library.h.

References m_pluginType.

◆ GetSymbolNames()

void LEGACY_SYMBOL_LIB::GetSymbolNames ( wxArrayString & aNames) const

Load a string array with the names of all the entries in this library.

Parameters
aNamesis the array to place entry names into.

Definition at line 138 of file legacy_symbol_library.cpp.

References fileName, m_plugin, and m_properties.

Referenced by LEGACY_SYMBOL_LIBS::FindLibraryNearEntries().

◆ GetSymbols()

void LEGACY_SYMBOL_LIB::GetSymbols ( std::vector< LIB_SYMBOL * > & aSymbols) const

Load a vector with all the entries in this library.

Parameters
aSymbolsis a vector to receive the aliases.

Definition at line 146 of file legacy_symbol_library.cpp.

References fileName, m_plugin, and m_properties.

Referenced by LEGACY_RESCUER::OpenRescueLibrary().

◆ IsBuffering()

bool LEGACY_SYMBOL_LIB::IsBuffering ( ) const

◆ IsCache()

bool LEGACY_SYMBOL_LIB::IsCache ( ) const

◆ IsModified()

bool LEGACY_SYMBOL_LIB::IsModified ( ) const
inline

Definition at line 191 of file legacy_symbol_library.h.

References isModified.

◆ IsReadOnly()

bool LEGACY_SYMBOL_LIB::IsReadOnly ( ) const
inline
Returns
true if current user does not have write access to the library file.

Definition at line 209 of file legacy_symbol_library.h.

References fileName.

◆ LoadSymbolLibrary()

LEGACY_SYMBOL_LIB * LEGACY_SYMBOL_LIB::LoadSymbolLibrary ( const wxString & aFileName)
static

Allocate and load a symbol library file.

Parameters
aFileNameis the file name of the symbol library to load.
Returns
SYMBOL_LIB* is the allocated and loaded SYMBOL_LIB, which is owned by the caller.
Exceptions
IO_ERRORif there's any problem loading the library.

Definition at line 236 of file legacy_symbol_library.cpp.

References LEGACY_SYMBOL_LIB(), LT_EESCHEMA, and LIB_SYMBOL::SetLib().

Referenced by LEGACY_SYMBOL_LIBS::AddLibrary(), LEGACY_SYMBOL_LIBS::AddLibrary(), and LEGACY_SYMBOL_LIBS::ReloadLibrary().

◆ RemoveSymbol()

LIB_SYMBOL * LEGACY_SYMBOL_LIB::RemoveSymbol ( LIB_SYMBOL * aEntry)

Safely remove aEntry from the library and return the next entry.

The next entry returned depends on the entry being removed. If the entry being remove also removes the symbol, then the next entry from the list is returned. If the entry being used only removes an alias from a symbol, then the next alias of the symbol is returned.

Parameters
aEntryis the entry to remove from library.
Returns
The next entry in the library or NULL if the library is empty.

Definition at line 199 of file legacy_symbol_library.cpp.

References fileName, LIB_SYMBOL::GetName(), IsBuffering(), isModified, m_mod_hash, m_plugin, and m_properties.

◆ ReplaceSymbol()

LIB_SYMBOL * LEGACY_SYMBOL_LIB::ReplaceSymbol ( LIB_SYMBOL * aOldSymbol,
LIB_SYMBOL * aNewSymbol )

Replace an existing symbol entry in the library.

Note
A symbol can have an alias list so these aliases will be added in library and previously existing alias removed.
Parameters
aOldSymbolis the symbol to replace.
aNewSymbolis the new symbol.

Definition at line 215 of file legacy_symbol_library.cpp.

References fileName, LIB_SYMBOL::GetName(), IsBuffering(), isModified, m_mod_hash, m_plugin, and m_properties.

◆ Save()

void LEGACY_SYMBOL_LIB::Save ( bool aSaveDocFile = true)

◆ SetCache()

void LEGACY_SYMBOL_LIB::SetCache ( )

◆ SetFileName()

void LEGACY_SYMBOL_LIB::SetFileName ( const wxString & aFileName)
inline

Definition at line 189 of file legacy_symbol_library.h.

References fileName.

◆ SetPluginType()

void LEGACY_SYMBOL_LIB::SetPluginType ( SCH_IO_MGR::SCH_FILE_T aPluginType)

Definition at line 101 of file legacy_symbol_library.cpp.

References m_plugin, and m_pluginType.

Member Data Documentation

◆ fileName

wxFileName LEGACY_SYMBOL_LIB::fileName
private

◆ header

wxString LEGACY_SYMBOL_LIB::header
private

first line of loaded library.

Definition at line 316 of file legacy_symbol_library.h.

◆ isModified

bool LEGACY_SYMBOL_LIB::isModified
private

Library modification status.

Definition at line 317 of file legacy_symbol_library.h.

Referenced by AddSymbol(), IsModified(), LEGACY_SYMBOL_LIB(), RemoveSymbol(), ReplaceSymbol(), and Save().

◆ m_mod_hash

int LEGACY_SYMBOL_LIB::m_mod_hash
private

incremented each time library is changed.

Definition at line 318 of file legacy_symbol_library.h.

Referenced by AddSymbol(), GetModHash(), LEGACY_SYMBOL_LIB(), RemoveSymbol(), and ReplaceSymbol().

◆ m_plugin

std::unique_ptr< SCH_IO > LEGACY_SYMBOL_LIB::m_plugin
private

◆ m_pluginType

SCH_IO_MGR::SCH_FILE_T LEGACY_SYMBOL_LIB::m_pluginType
private

Definition at line 320 of file legacy_symbol_library.h.

Referenced by GetPluginType(), LEGACY_SYMBOL_LIB(), and SetPluginType().

◆ m_properties

std::unique_ptr<std::map<std::string, UTF8> > LEGACY_SYMBOL_LIB::m_properties
private

◆ timeStamp

wxDateTime LEGACY_SYMBOL_LIB::timeStamp
private

Library save time and date.

Definition at line 313 of file legacy_symbol_library.h.

Referenced by LEGACY_SYMBOL_LIB().

◆ type

SCH_LIB_TYPE LEGACY_SYMBOL_LIB::type
private

Library type indicator.

Definition at line 311 of file legacy_symbol_library.h.

Referenced by LEGACY_SYMBOL_LIB().

◆ versionMajor

int LEGACY_SYMBOL_LIB::versionMajor
private

Library major version number.

Definition at line 314 of file legacy_symbol_library.h.

Referenced by LEGACY_SYMBOL_LIB().

◆ versionMinor

int LEGACY_SYMBOL_LIB::versionMinor
private

Library minor version number.

Definition at line 315 of file legacy_symbol_library.h.

Referenced by LEGACY_SYMBOL_LIB().


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