|
KiCad PCB EDA Suite
|
Store a working copy of a library. More...
#include <symbol_library_manager.h>
Public Member Functions | |
| LIB_BUFFER (const wxString &aLibrary) | |
| bool | IsModified () const |
| int | GetHash () const |
| LIB_SYMBOL * | GetSymbol (const wxString &aAlias) const |
| Return the working copy of a LIB_SYMBOL root object with specified alias. | |
| bool | CreateBuffer (std::unique_ptr< LIB_SYMBOL > aCopy, std::unique_ptr< SCH_SCREEN > aScreen, bool aNew=false) |
| Create a new buffer to store a symbol. LIB_BUFFER takes ownership of aCopy. | |
| bool | UpdateBuffer (SYMBOL_BUFFER &aSymbolBuf, const LIB_SYMBOL &aCopy) |
| Update the buffered symbol with the contents of aCopy. | |
| bool | DeleteBuffer (const SYMBOL_BUFFER &aSymbolBuf) |
| Delete the given symbol buffer from the library buffer. | |
| void | RevertDeletedBuffers () |
| Move symbol buffers on the library's deleted list back to its main list. | |
| void | RevertAddedBuffers () |
| const std::deque< std::shared_ptr< SYMBOL_BUFFER > > & | GetDeletedBuffers () const |
| Return the deleted symbol buffers that need to be removed from the library file. | |
| void | ClearAddedAndDeletedBufferLists () |
| bool | SaveModifiedBuffers (const wxString &aFileName, SCH_IO *aPlugin) |
| Save the modified symbols back to the library's own file aFileName. | |
| bool | SaveBuffer (SYMBOL_BUFFER &aSymbolBuf, const wxString &aFileName, SCH_IO *aPlugin, bool aBuffer) |
| Save stored modifications using a plugin. | |
| std::shared_ptr< SYMBOL_BUFFER > | GetBuffer (const wxString &aAlias) const |
| Return a symbol buffer with LIB_SYMBOL holding a symbolic alias. | |
| const std::deque< std::shared_ptr< SYMBOL_BUFFER > > & | GetBuffers () const |
| Return all buffered symbols. | |
| 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) const |
| Fetch all of the symbols derived from a aSymbolName into aList. | |
Private Member Functions | |
| int | removeChildSymbols (const SYMBOL_BUFFER &aSymbolBuf) |
| Remove all symbols derived from aSymbolBuf from the library buffer. | |
Private Attributes | |
| std::deque< std::shared_ptr< SYMBOL_BUFFER > > | m_symbols |
| std::deque< std::shared_ptr< SYMBOL_BUFFER > > | m_added |
| Buffer for added synbols until lib is saved. | |
| std::deque< std::shared_ptr< SYMBOL_BUFFER > > | m_deleted |
| Buffer for deleted symbols until lib is saved. | |
| const wxString | m_libName |
| Buffered library name. | |
| int | m_hash |
Store a working copy of a library.
Definition at line 76 of file symbol_library_manager.h.
|
inline |
Definition at line 79 of file symbol_library_manager.h.
|
inline |
Definition at line 124 of file symbol_library_manager.h.
References m_added, and m_deleted.
Referenced by BOOST_AUTO_TEST_CASE(), and SYMBOL_LIBRARY_MANAGER::SaveLibrary().
| bool LIB_BUFFER::CreateBuffer | ( | std::unique_ptr< LIB_SYMBOL > | aCopy, |
| std::unique_ptr< SCH_SCREEN > | aScreen, | ||
| bool | aNew = false ) |
Create a new buffer to store a symbol. LIB_BUFFER takes ownership of aCopy.
Definition at line 1005 of file symbol_library_manager.cpp.
References m_added, m_hash, m_libName, m_symbols, and LIB_ID::SetLibNickname().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol(), SYMBOL_LIBRARY_MANAGER::getLibraryBuffer(), and SYMBOL_LIBRARY_MANAGER::UpdateSymbol().
| bool LIB_BUFFER::DeleteBuffer | ( | const SYMBOL_BUFFER & | aSymbolBuf | ) |
Delete the given symbol buffer from the library buffer.
Definition at line 1040 of file symbol_library_manager.cpp.
References LIB_SYMBOL::GetName(), SYMBOL_BUFFER::GetSymbol(), HasDerivedSymbols(), m_deleted, m_hash, m_symbols, and removeChildSymbols().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and SYMBOL_LIBRARY_MANAGER::RemoveSymbol().
| std::shared_ptr< SYMBOL_BUFFER > LIB_BUFFER::GetBuffer | ( | const wxString & | aAlias | ) | const |
Return a symbol buffer with LIB_SYMBOL holding a symbolic alias.
Definition at line 1347 of file symbol_library_manager.cpp.
References m_symbols.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SYMBOL_LIBRARY_MANAGER::GetBuffer(), SYMBOL_LIBRARY_MANAGER::GetScreen(), GetSymbol(), SYMBOL_LIBRARY_MANAGER::IsSymbolModified(), SYMBOL_LIBRARY_MANAGER::RemoveSymbol(), SaveBuffer(), SYMBOL_LIBRARY_MANAGER::SetSymbolModified(), SYMBOL_LIBRARY_MANAGER::UpdateSymbol(), and SYMBOL_LIBRARY_MANAGER::UpdateSymbolAfterRename().
|
inline |
Return all buffered symbols.
Definition at line 146 of file symbol_library_manager.h.
References m_symbols.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and SYMBOL_LIBRARY_MANAGER::SaveLibrary().
|
inline |
Return the deleted symbol buffers that need to be removed from the library file.
Definition at line 122 of file symbol_library_manager.h.
References m_deleted.
Referenced by BOOST_AUTO_TEST_CASE(), and SYMBOL_LIBRARY_MANAGER::SaveLibrary().
| size_t LIB_BUFFER::GetDerivedSymbolNames | ( | const wxString & | aSymbolName, |
| wxArrayString & | aList ) const |
Fetch all of the symbols derived from a aSymbolName into aList.
| aSymbolName | is the name of the symbol to search for derived symbols in this buffer. |
| aList | is the list of symbols names derived from aSymbolName. |
Definition at line 1390 of file symbol_library_manager.cpp.
References getParentName(), and m_symbols.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SYMBOL_LIBRARY_MANAGER::GetDerivedSymbolNames(), and removeChildSymbols().
|
inline |
Definition at line 98 of file symbol_library_manager.h.
References m_hash.
Referenced by BOOST_AUTO_TEST_CASE().
| LIB_SYMBOL * LIB_BUFFER::GetSymbol | ( | const wxString & | aAlias | ) | const |
Return the working copy of a LIB_SYMBOL root object with specified alias.
Definition at line 994 of file symbol_library_manager.cpp.
References GetBuffer().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol(), and SYMBOL_LIBRARY_MANAGER::getLibraryBuffer().
| 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.
| aSymbolNames | is a reference to a list to populate with root symbol names. |
| aFilter | is the symbol derivation type. |
Definition at line 1373 of file symbol_library_manager.cpp.
References DERIVED_ONLY, LIB_SYMBOL::GetName(), LIB_SYMBOL::IsDerived(), LIB_SYMBOL::IsRoot(), m_symbols, ROOT_ONLY, and UnescapeString().
Referenced by BOOST_AUTO_TEST_CASE(), and SYMBOL_LIBRARY_MANAGER::GetSymbolNames().
| bool LIB_BUFFER::HasDerivedSymbols | ( | const wxString & | aParentName | ) | const |
Check to see any symbols in the buffer are derived from a parent named aParentName.
| aParentName | is the name of the parent to test. |
Definition at line 1359 of file symbol_library_manager.cpp.
References getParentName(), and m_symbols.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DeleteBuffer(), and SYMBOL_LIBRARY_MANAGER::HasDerivedSymbols().
|
inline |
Definition at line 84 of file symbol_library_manager.h.
References m_deleted, and m_symbols.
Referenced by BOOST_AUTO_TEST_CASE().
|
private |
Remove all symbols derived from aSymbolBuf from the library buffer.
| aSymbolBuf | is the buffer to remove child symbols from. |
Definition at line 1439 of file symbol_library_manager.cpp.
References GetDerivedSymbolNames(), LIB_SYMBOL::GetName(), SYMBOL_BUFFER::GetSymbol(), m_deleted, and m_symbols.
Referenced by DeleteBuffer().
| void LIB_BUFFER::RevertAddedBuffers | ( | ) |
Definition at line 1081 of file symbol_library_manager.cpp.
| void LIB_BUFFER::RevertDeletedBuffers | ( | ) |
Move symbol buffers on the library's deleted list back to its main list.
Definition at line 1071 of file symbol_library_manager.cpp.
| bool LIB_BUFFER::SaveBuffer | ( | SYMBOL_BUFFER & | aSymbolBuf, |
| const wxString & | aFileName, | ||
| SCH_IO * | aPlugin, | ||
| bool | aBuffer ) |
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 1141 of file symbol_library_manager.cpp.
References _, EMBEDDED_FILES::AddFile(), EMBEDDED_FILES::ClearEmbeddedFiles(), SCH_IO::DeleteSymbol(), GetBuffer(), LIB_SYMBOL::GetName(), SYMBOL_BUFFER::GetOriginal(), LIB_SYMBOL::GetParent(), getParentName(), SYMBOL_BUFFER::GetSymbol(), LIB_SYMBOL::IsDerived(), SCH_IO::LoadSymbol(), m_hash, m_symbols, name, SCH_IO_KICAD_LEGACY::PropBuffering, res, SCH_IO::SaveSymbol(), EMBEDDED_FILES::SetAreFontsEmbedded(), EMBEDDED_FILES::SetFileAddedCallback(), SYMBOL_BUFFER::SetOriginal(), UnescapeString(), and IO_ERROR::What().
Referenced by BOOST_AUTO_TEST_CASE(), SYMBOL_LIBRARY_MANAGER::SaveLibrary(), and SaveModifiedBuffers().
| bool LIB_BUFFER::SaveModifiedBuffers | ( | const wxString & | aFileName, |
| SCH_IO * | aPlugin ) |
Save the modified symbols back to the library's own file aFileName.
The others are left as the file has them, which may be newer than the buffer when something else, such as a git pull, changed the file.
Definition at line 1109 of file symbol_library_manager.cpp.
References _, SCH_IO::EnumerateSymbolLib(), m_symbols, res, SaveBuffer(), and IO_ERROR::What().
Referenced by BOOST_AUTO_TEST_CASE(), and SYMBOL_LIBRARY_MANAGER::SaveLibrary().
| bool LIB_BUFFER::UpdateBuffer | ( | SYMBOL_BUFFER & | aSymbolBuf, |
| const LIB_SYMBOL & | aCopy ) |
Update the buffered symbol with the contents of aCopy.
Definition at line 1029 of file symbol_library_manager.cpp.
References SYMBOL_BUFFER::GetSymbol(), and m_hash.
Referenced by BOOST_AUTO_TEST_CASE(), and SYMBOL_LIBRARY_MANAGER::UpdateSymbolAfterRename().
|
private |
Buffer for added synbols until lib is saved.
Definition at line 188 of file symbol_library_manager.h.
Referenced by ClearAddedAndDeletedBufferLists(), CreateBuffer(), and RevertAddedBuffers().
|
private |
Buffer for deleted symbols until lib is saved.
Definition at line 189 of file symbol_library_manager.h.
Referenced by ClearAddedAndDeletedBufferLists(), DeleteBuffer(), GetDeletedBuffers(), IsModified(), removeChildSymbols(), and RevertDeletedBuffers().
|
private |
Definition at line 191 of file symbol_library_manager.h.
Referenced by CreateBuffer(), DeleteBuffer(), GetHash(), LIB_BUFFER(), RevertAddedBuffers(), RevertDeletedBuffers(), SaveBuffer(), and UpdateBuffer().
|
private |
Buffered library name.
Definition at line 190 of file symbol_library_manager.h.
Referenced by CreateBuffer(), and LIB_BUFFER().
|
private |
Definition at line 187 of file symbol_library_manager.h.
Referenced by CreateBuffer(), DeleteBuffer(), GetBuffer(), GetBuffers(), GetDerivedSymbolNames(), GetSymbolNames(), HasDerivedSymbols(), IsModified(), removeChildSymbols(), RevertAddedBuffers(), RevertDeletedBuffers(), SaveBuffer(), and SaveModifiedBuffers().