|
KiCad PCB EDA Suite
|
Frame-independent, non-interactive service that reconciles the footprint-library references of a freshly imported (non-KiCad) board so that every board footprint FPID resolves to a registered project library. More...
#include <footprint_import_reconciler.h>
Public Member Functions | |
| FOOTPRINT_IMPORT_RECONCILER (FOOTPRINT_LIBRARY_ADAPTER &aAdapter, const wxString &aProjectPath, REPORTER &aReporter=NULL_REPORTER::GetInstance()) | |
| FOOTPRINT_IMPORT_RECONCILE_RESULT | Reconcile (BOARD *aBoard, std::vector< std::unique_ptr< FOOTPRINT > > aDefinitions, const wxString &aCacheNickname, const std::vector< wxString > &aSourceLibNicknames) |
Reconcile aBoard against the importer definitions and the provenance source libraries. | |
Private Member Functions | |
| void | writeAndRegisterCache (const wxString &aCacheNickname, const std::map< wxString, FOOTPRINT * > &aCacheDefs, FOOTPRINT_IMPORT_RECONCILE_RESULT &aResult) |
| Write the residual definitions into an atomically-published .pretty and register its row. | |
| bool | registerCacheRow (const wxString &aCacheNickname) |
| Insert or refresh the project footprint-library-table row for the generated cache. | |
Private Attributes | |
| FOOTPRINT_LIBRARY_ADAPTER & | m_adapter |
| wxString | m_projectPath |
| REPORTER & | m_reporter |
Frame-independent, non-interactive service that reconciles the footprint-library references of a freshly imported (non-KiCad) board so that every board footprint FPID resolves to a registered project library.
A footprint whose definition provably lives in a provenance source library is re-linked there ("prefer source"); anything left over is written into a single manager-chosen generated cache (.pretty) registered in the project footprint-library table ("generate residual"). The service never scans arbitrary loaded/global libraries and never deletes a user library.
The footprint-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 63 of file footprint_import_reconciler.h.
| FOOTPRINT_IMPORT_RECONCILER::FOOTPRINT_IMPORT_RECONCILER | ( | FOOTPRINT_LIBRARY_ADAPTER & | aAdapter, |
| const wxString & | aProjectPath, | ||
| REPORTER & | aReporter = NULL_REPORTER::GetInstance() ) |
Definition at line 44 of file footprint_import_reconciler.cpp.
References m_adapter, m_projectPath, and m_reporter.
| FOOTPRINT_IMPORT_RECONCILE_RESULT FOOTPRINT_IMPORT_RECONCILER::Reconcile | ( | BOARD * | aBoard, |
| std::vector< std::unique_ptr< FOOTPRINT > > | aDefinitions, | ||
| const wxString & | aCacheNickname, | ||
| const std::vector< wxString > & | aSourceLibNicknames ) |
Reconcile aBoard against the importer definitions and the provenance source libraries.
| aBoard | is the imported board whose footprint FPIDs are re-pointed in place. |
| aDefinitions | are the caller-owned canonical footprint definitions produced by the importer (e.g. PCB_IO::GetImportedCachedLibraryFootprints()). Ownership is consumed by this call. |
| aCacheNickname | is the manager-chosen collision-free generated-cache nickname. |
| aSourceLibNicknames | are the provenance source footprint-library nicknames registered for this import. |
Definition at line 93 of file footprint_import_reconciler.cpp.
References _, BOARD::Footprints(), FOOTPRINT::GetFPID(), LIB_ID::GetUniStringLibItemName(), LIB_ID::GetUniStringLibNickname(), 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 ReconcileImportedFootprints().
|
private |
Insert or refresh the project footprint-library-table row for the generated cache.
Returns false when no project table exists or the row could not be created.
Definition at line 402 of file footprint_import_reconciler.cpp.
References _, FILEEXT::KiCadFootprintLibPathExtension, 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 .pretty and register its row.
Definition at line 285 of file footprint_import_reconciler.cpp.
References _, PCB_IO_MGR::FindPlugin(), PCB_IO_MGR::KICAD_SEXP, FILEEXT::KiCadFootprintLibPathExtension, m_adapter, FOOTPRINT_IMPORT_RECONCILE_RESULT::m_cacheNickname, m_projectPath, m_reporter, FOOTPRINT_IMPORT_RECONCILE_RESULT::m_savedToCache, name, registerCacheRow(), RPT_SEVERITY_ERROR, LIB_ID::SetLibNickname(), and IO_ERROR::What().
Referenced by Reconcile().
|
private |
Definition at line 94 of file footprint_import_reconciler.h.
Referenced by FOOTPRINT_IMPORT_RECONCILER(), Reconcile(), registerCacheRow(), and writeAndRegisterCache().
|
private |
Definition at line 95 of file footprint_import_reconciler.h.
Referenced by FOOTPRINT_IMPORT_RECONCILER(), and writeAndRegisterCache().
|
private |
Definition at line 96 of file footprint_import_reconciler.h.
Referenced by FOOTPRINT_IMPORT_RECONCILER(), Reconcile(), registerCacheRow(), and writeAndRegisterCache().