|
KiCad PCB EDA Suite
|
Frame-independent, non-interactive service that reconciles the symbol-library references of a freshly imported (non-KiCad) schematic so that every symbol LIB_ID resolves to a registered project library. More...
#include <symbol_import_reconciler.h>
Public Member Functions | |
| SYMBOL_IMPORT_RECONCILER (SYMBOL_LIBRARY_ADAPTER &aAdapter, const wxString &aProjectPath, REPORTER &aReporter=NULL_REPORTER::GetInstance()) | |
| SYMBOL_IMPORT_RECONCILE_RESULT | Reconcile (SCHEMATIC *aSchematic, std::vector< std::unique_ptr< LIB_SYMBOL > > aDefinitions, const wxString &aCacheNickname, const std::vector< wxString > &aSourceLibNicknames) |
Reconcile aSchematic against the importer definitions and the provenance source libraries. | |
Private Member Functions | |
| void | writeAndRegisterCache (const wxString &aCacheNickname, const std::map< wxString, LIB_SYMBOL * > &aCacheDefs, SYMBOL_IMPORT_RECONCILE_RESULT &aResult) |
| Write the residual definitions into an atomically-published .kicad_sym and register its row. | |
| bool | registerCacheRow (const wxString &aCacheNickname) |
| Insert or refresh the project symbol-library-table row for the generated cache. | |
Private Attributes | |
| SYMBOL_LIBRARY_ADAPTER & | m_adapter |
| wxString | m_projectPath |
| REPORTER & | m_reporter |
Frame-independent, non-interactive service that reconciles the symbol-library references of a freshly imported (non-KiCad) schematic so that every symbol LIB_ID resolves to a registered project library.
This is the schematic counterpart of FOOTPRINT_IMPORT_RECONCILER and follows the same policy. A symbol whose definition provably lives in a provenance source library is re-linked there ("prefer source"); anything left over is written into a single caller-chosen generated cache (.kicad_sym) registered in the project symbol-library table ("generate residual"). The service never scans arbitrary loaded/global libraries and never deletes a user library.
The symbol-library adapter and project path are injected so the service can be exercised with a temporary project and a locally-owned LIBRARY_MANAGER, without a frame.
Definition at line 64 of file symbol_import_reconciler.h.
| SYMBOL_IMPORT_RECONCILER::SYMBOL_IMPORT_RECONCILER | ( | SYMBOL_LIBRARY_ADAPTER & | aAdapter, |
| const wxString & | aProjectPath, | ||
| REPORTER & | aReporter = NULL_REPORTER::GetInstance() ) |
Definition at line 47 of file symbol_import_reconciler.cpp.
References m_adapter, m_projectPath, and m_reporter.
| SYMBOL_IMPORT_RECONCILE_RESULT SYMBOL_IMPORT_RECONCILER::Reconcile | ( | SCHEMATIC * | aSchematic, |
| std::vector< std::unique_ptr< LIB_SYMBOL > > | aDefinitions, | ||
| const wxString & | aCacheNickname, | ||
| const std::vector< wxString > & | aSourceLibNicknames ) |
Reconcile aSchematic against the importer definitions and the provenance source libraries.
| aSchematic | is the imported schematic whose symbol LIB_IDs are re-pointed in place. |
| aDefinitions | are the caller-owned canonical symbol definitions produced by the importer (e.g. SCH_IO::GetImportedCachedLibrarySymbols()). Ownership is consumed by this call. |
| aCacheNickname | is the caller-chosen collision-free generated-cache nickname. |
| aSourceLibNicknames | are the provenance source symbol-library nicknames registered for this import. |
Definition at line 129 of file symbol_import_reconciler.cpp.
References _, SCH_SYMBOL::GetLibId(), LIB_ID::GetUniStringLibItemName(), LIB_ID::GetUniStringLibNickname(), loadSymbol(), m_adapter, m_reporter, name, result, RPT_SEVERITY_WARNING, LIB_ID::SetLibNickname(), and writeAndRegisterCache().
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(), and ReconcileImportedSymbols().
|
private |
Insert or refresh the project symbol-library-table row for the generated cache.
Returns false when no project table exists or the row could not be created.
Definition at line 437 of file symbol_import_reconciler.cpp.
References _, FILEEXT::KiCadSymbolLibFileExtension, m_adapter, m_reporter, IMPORT_PROJ_PROPS::ManagedCacheOption(), PROJECT, RPT_SEVERITY_ERROR, LIBRARY_TABLE_ROW::SetNickname(), LIBRARY_TABLE_ROW::SetOptions(), LIBRARY_TABLE_ROW::SetScope(), LIBRARY_TABLE_ROW::SetType(), LIBRARY_TABLE_ROW::SetURI(), and table.
Referenced by writeAndRegisterCache().
|
private |
Write the residual definitions into an atomically-published .kicad_sym and register its row.
Definition at line 320 of file symbol_import_reconciler.cpp.
References _, copy, FILEEXT::KiCadSymbolLibFileExtension, m_adapter, SYMBOL_IMPORT_RECONCILE_RESULT::m_cacheNickname, m_projectPath, m_reporter, SYMBOL_IMPORT_RECONCILE_RESULT::m_savedToCache, name, SCH_IO_KICAD_SEXPR::PropBuffering, registerCacheRow(), RPT_SEVERITY_ERROR, and IO_ERROR::What().
Referenced by Reconcile().
|
private |
Definition at line 95 of file symbol_import_reconciler.h.
Referenced by Reconcile(), registerCacheRow(), SYMBOL_IMPORT_RECONCILER(), and writeAndRegisterCache().
|
private |
Definition at line 96 of file symbol_import_reconciler.h.
Referenced by SYMBOL_IMPORT_RECONCILER(), and writeAndRegisterCache().
|
private |
Definition at line 97 of file symbol_import_reconciler.h.
Referenced by Reconcile(), registerCacheRow(), SYMBOL_IMPORT_RECONCILER(), and writeAndRegisterCache().