|
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=nullptr) | |
| 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. | |
Static Public Member Functions | |
| static const wxString & | ManagedCacheOption () |
| Options string identifying a footprint-library table row as a generated import cache. | |
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 61 of file footprint_import_reconciler.h.
| FOOTPRINT_IMPORT_RECONCILER::FOOTPRINT_IMPORT_RECONCILER | ( | FOOTPRINT_LIBRARY_ADAPTER & | aAdapter, |
| const wxString & | aProjectPath, | ||
| REPORTER * | aReporter = nullptr ) |
Definition at line 48 of file footprint_import_reconciler.cpp.
References m_adapter, m_projectPath, and m_reporter.
|
static |
Options string identifying a footprint-library table row as a generated import cache.
Definition at line 41 of file footprint_import_reconciler.cpp.
Referenced by registerCacheRow().
| 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 91 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(), and PCB_EDIT_FRAME::reconcileImportedFootprintLibraries().
|
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 363 of file footprint_import_reconciler.cpp.
References _, FILEEXT::KiCadFootprintLibPathExtension, m_adapter, m_reporter, ManagedCacheOption(), PROJECT, RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, 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 258 of file footprint_import_reconciler.cpp.
References _, copy, PCB_IO_MGR::FindPlugin(), PCB_IO_MGR::KICAD_SEXP, FILEEXT::KiCadFootprintLibPathExtension, m_adapter, FOOTPRINT_IMPORT_RECONCILE_RESULT::m_cacheLibraryPath, FOOTPRINT_IMPORT_RECONCILE_RESULT::m_cacheNickname, m_projectPath, m_reporter, FOOTPRINT_IMPORT_RECONCILE_RESULT::m_savedToCache, name, registerCacheRow(), RPT_SEVERITY_ERROR, and IO_ERROR::What().
Referenced by Reconcile().
|
private |
Definition at line 95 of file footprint_import_reconciler.h.
Referenced by FOOTPRINT_IMPORT_RECONCILER(), Reconcile(), registerCacheRow(), and writeAndRegisterCache().
|
private |
Definition at line 96 of file footprint_import_reconciler.h.
Referenced by FOOTPRINT_IMPORT_RECONCILER(), and writeAndRegisterCache().
|
private |
Definition at line 97 of file footprint_import_reconciler.h.
Referenced by FOOTPRINT_IMPORT_RECONCILER(), Reconcile(), registerCacheRow(), and writeAndRegisterCache().