KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_import_reconciler.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef FOOTPRINT_IMPORT_RECONCILER_H
21#define FOOTPRINT_IMPORT_RECONCILER_H
22
23#include <map>
24#include <memory>
25#include <vector>
26#include <wx/string.h>
27
28class BOARD;
29class FOOTPRINT;
31class REPORTER;
32
37{
40 int m_unresolved = 0;
42 wxString m_cacheNickname;
44
45 bool Ok() const { return m_unresolved == 0; }
46};
47
62{
63public:
64 FOOTPRINT_IMPORT_RECONCILER( FOOTPRINT_LIBRARY_ADAPTER& aAdapter, const wxString& aProjectPath,
65 REPORTER* aReporter = nullptr );
66
79 Reconcile( BOARD* aBoard, std::vector<std::unique_ptr<FOOTPRINT>> aDefinitions,
80 const wxString& aCacheNickname, const std::vector<wxString>& aSourceLibNicknames );
81
83 static const wxString& ManagedCacheOption();
84
85private:
87 void writeAndRegisterCache( const wxString& aCacheNickname,
88 const std::map<wxString, FOOTPRINT*>& aCacheDefs,
90
93 bool registerCacheRow( const wxString& aCacheNickname );
94
96 wxString m_projectPath;
98};
99
100#endif // FOOTPRINT_IMPORT_RECONCILER_H
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:373
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.
static const wxString & ManagedCacheOption()
Options string identifying a footprint-library table row as a generated import cache.
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.
FOOTPRINT_LIBRARY_ADAPTER & m_adapter
bool registerCacheRow(const wxString &aCacheNickname)
Insert or refresh the project footprint-library-table row for the generated cache.
FOOTPRINT_IMPORT_RECONCILER(FOOTPRINT_LIBRARY_ADAPTER &aAdapter, const wxString &aProjectPath, REPORTER *aReporter=nullptr)
An interface to the global shared library manager that is schematic-specific and linked to one projec...
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:72
Outcome of a post-import footprint-library reconciliation pass.
int m_linkedToSource
board FPIDs re-pointed at a provenance source library
int m_savedToCache
distinct definitions written into the cache library
wxString m_cacheNickname
nickname of the generated cache, empty if none written
int m_linkedToCache
board FPIDs re-pointed at the generated cache
wxString m_cacheLibraryPath
absolute path to the generated .pretty, empty if none
int m_unresolved
board FPIDs left unresolved