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

#include <symbol_library_manager.h>

Public Member Functions

 LIB_BUFFER (const wxString &aLibrary)
 
bool IsModified () const
 
int GetHash () const
 Return the working copy of a LIB_SYMBOL root object with specified alias.
 
LIB_SYMBOLGetSymbol (const wxString &aAlias) const
 Create a new buffer to store a symbol. LIB_BUFFER takes ownership of aCopy.
 
bool CreateBuffer (LIB_SYMBOL *aCopy, SCH_SCREEN *aScreen)
 Update the buffered symbol with the contents of aCopy.
 
bool UpdateBuffer (std::shared_ptr< SYMBOL_BUFFER > aSymbolBuf, LIB_SYMBOL *aCopy)
 
bool DeleteBuffer (std::shared_ptr< SYMBOL_BUFFER > aSymbolBuf)
 
void ClearDeletedBuffer ()
 Save stored modifications using a plugin.
 
bool SaveBuffer (std::shared_ptr< SYMBOL_BUFFER > aSymbolBuf, const wxString &aFileName, SCH_IO *aPlugin, bool aBuffer)
 Return a symbol buffer with LIB_SYMBOL holding a symbolicular alias.
 
std::shared_ptr< SYMBOL_BUFFERGetBuffer (const wxString &aAlias) const
 Return all buffered symbols.
 
const std::deque< std::shared_ptr< SYMBOL_BUFFER > > & GetBuffers () const
 
bool HasDerivedSymbols (const wxString &aParentName) const
 Check to see any symbols in the buffer are derived from a parent named aParentName.
 
void GetSymbolNames (wxArrayString &aSymbolNames, SYMBOL_NAME_FILTER aFilter=SYMBOL_NAME_FILTER::ALL)
 Fetch a list of root symbols names from the library buffer.
 
size_t GetDerivedSymbolNames (const wxString &aSymbolName, wxArrayString &aList)
 Fetch all of the symbols derived from a aSymbolName into aList.
 

Private Member Functions

int removeChildSymbols (std::shared_ptr< SYMBOL_BUFFER > &aSymbolBuf)
 Remove all symbols derived from aParent from the library buffer.
 

Private Attributes

std::deque< std::shared_ptr< SYMBOL_BUFFER > > m_symbols
 Buffer for deleted symbols until library is saved.
 
std::deque< std::shared_ptr< SYMBOL_BUFFER > > m_deleted
 
const wxString m_libName
 
int m_hash
 

Detailed Description

Definition at line 81 of file symbol_library_manager.h.

Constructor & Destructor Documentation

◆ LIB_BUFFER()

LIB_BUFFER::LIB_BUFFER ( const wxString &  aLibrary)
inline

Definition at line 84 of file symbol_library_manager.h.

Member Function Documentation

◆ ClearDeletedBuffer()

void LIB_BUFFER::ClearDeletedBuffer ( )
inline

Save stored modifications using a plugin.

aBuffer decides whether the changes should be cached or stored directly to the disk (for SCH_IO_KICAD_LEGACY).

Definition at line 113 of file symbol_library_manager.h.

References m_deleted.

Referenced by SYMBOL_LIBRARY_MANAGER::SaveLibrary().

◆ CreateBuffer()

◆ DeleteBuffer()

bool LIB_BUFFER::DeleteBuffer ( std::shared_ptr< SYMBOL_BUFFER aSymbolBuf)

◆ GetBuffer()

◆ GetBuffers()

const std::deque< std::shared_ptr< SYMBOL_BUFFER > > & LIB_BUFFER::GetBuffers ( ) const
inline

Definition at line 124 of file symbol_library_manager.h.

References m_symbols.

Referenced by BOOST_AUTO_TEST_CASE(), and SYMBOL_LIBRARY_MANAGER::SaveLibrary().

◆ GetDerivedSymbolNames()

size_t LIB_BUFFER::GetDerivedSymbolNames ( const wxString &  aSymbolName,
wxArrayString &  aList 
)

Fetch all of the symbols derived from a aSymbolName into aList.

Parameters
aSymbolNameis the name of the symbol to search for derived symbols in this buffer.
aListis the list of symbols names derived from aSymbolName.
Returns
a size_t count of the number of symbols derived from aSymbolName.

Definition at line 1194 of file symbol_library_manager.cpp.

References GetDerivedSymbolNames(), and m_symbols.

Referenced by BOOST_AUTO_TEST_CASE(), GetDerivedSymbolNames(), removeChildSymbols(), and SaveBuffer().

◆ GetHash()

int LIB_BUFFER::GetHash ( ) const
inline

Return the working copy of a LIB_SYMBOL root object with specified alias.

Definition at line 100 of file symbol_library_manager.h.

References m_hash.

Referenced by BOOST_AUTO_TEST_CASE().

◆ GetSymbol()

LIB_SYMBOL * LIB_BUFFER::GetSymbol ( const wxString &  aAlias) const

Create a new buffer to store a symbol. LIB_BUFFER takes ownership of aCopy.

Definition at line 916 of file symbol_library_manager.cpp.

References GetBuffer().

Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol(), and SYMBOL_LIBRARY_MANAGER::getLibraryBuffer().

◆ GetSymbolNames()

void LIB_BUFFER::GetSymbolNames ( wxArrayString &  aSymbolNames,
SYMBOL_NAME_FILTER  aFilter = SYMBOL_NAME_FILTER::ALL 
)

Fetch a list of root symbols names from the library buffer.

Parameters
aRootSymbolNamesis a reference to a list to populate with root symbol names.
aFilteris the symbol derivation type.

Definition at line 1181 of file symbol_library_manager.cpp.

References m_symbols, and UnescapeString().

Referenced by BOOST_AUTO_TEST_CASE(), and SYMBOL_LIBRARY_MANAGER::GetSymbolNames().

◆ HasDerivedSymbols()

bool LIB_BUFFER::HasDerivedSymbols ( const wxString &  aParentName) const

Check to see any symbols in the buffer are derived from a parent named aParentName.

Parameters
aParentNameis the name of the parent to test.
Returns
true if any symbols are found derived from a symbol named aParent, otherwise false.

Definition at line 1161 of file symbol_library_manager.cpp.

References m_symbols.

Referenced by BOOST_AUTO_TEST_CASE(), DeleteBuffer(), and SYMBOL_LIBRARY_MANAGER::HasDerivedSymbols().

◆ IsModified()

bool LIB_BUFFER::IsModified ( ) const
inline

Definition at line 86 of file symbol_library_manager.h.

References m_deleted, and m_symbols.

Referenced by BOOST_AUTO_TEST_CASE().

◆ removeChildSymbols()

int LIB_BUFFER::removeChildSymbols ( std::shared_ptr< SYMBOL_BUFFER > &  aSymbolBuf)
private

Remove all symbols derived from aParent from the library buffer.

Parameters
aParentis the SYMBOL_BUFFER to check against.
Returns
the count of SYMBOL_BUFFER objects removed from the library.

Definition at line 1220 of file symbol_library_manager.cpp.

References GetDerivedSymbolNames(), m_deleted, and m_symbols.

Referenced by DeleteBuffer().

◆ SaveBuffer()

bool LIB_BUFFER::SaveBuffer ( std::shared_ptr< SYMBOL_BUFFER aSymbolBuf,
const wxString &  aFileName,
SCH_IO aPlugin,
bool  aBuffer 
)

◆ UpdateBuffer()

bool LIB_BUFFER::UpdateBuffer ( std::shared_ptr< SYMBOL_BUFFER aSymbolBuf,
LIB_SYMBOL aCopy 
)

Member Data Documentation

◆ m_deleted

std::deque<std::shared_ptr<SYMBOL_BUFFER> > LIB_BUFFER::m_deleted
private

◆ m_hash

int LIB_BUFFER::m_hash
private

◆ m_libName

const wxString LIB_BUFFER::m_libName
private

Definition at line 167 of file symbol_library_manager.h.

Referenced by CreateBuffer().

◆ m_symbols

std::deque<std::shared_ptr<SYMBOL_BUFFER> > LIB_BUFFER::m_symbols
private

Buffer for deleted symbols until library is saved.

Definition at line 163 of file symbol_library_manager.h.

Referenced by CreateBuffer(), DeleteBuffer(), GetBuffer(), GetBuffers(), GetDerivedSymbolNames(), GetSymbolNames(), HasDerivedSymbols(), IsModified(), and removeChildSymbols().


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