KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_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 SYMBOL_IMPORT_RECONCILER_H
21#define SYMBOL_IMPORT_RECONCILER_H
22
23#include <map>
24#include <memory>
25#include <string>
26#include <vector>
27#include <wx/string.h>
28
29#include <reporter.h>
30
31class LIB_SYMBOL;
32class PROJECT;
33class SCHEMATIC;
34class SCH_IO;
36class UTF8;
37
49
65{
66public:
67 SYMBOL_IMPORT_RECONCILER( SYMBOL_LIBRARY_ADAPTER& aAdapter, const wxString& aProjectPath,
68 REPORTER& aReporter = NULL_REPORTER::GetInstance() );
69
82 Reconcile( SCHEMATIC* aSchematic, std::vector<std::unique_ptr<LIB_SYMBOL>> aDefinitions,
83 const wxString& aCacheNickname, const std::vector<wxString>& aSourceLibNicknames );
84
85private:
87 void writeAndRegisterCache( const wxString& aCacheNickname,
88 const std::map<wxString, LIB_SYMBOL*>& aCacheDefs,
90
93 bool registerCacheRow( const wxString& aCacheNickname );
94
96 wxString m_projectPath;
98};
99
113ReconcileImportedSymbols( SCH_IO& aPlugin, SCHEMATIC& aSchematic, PROJECT& aProject,
114 const wxString& aSchematicPath,
115 const std::map<std::string, UTF8>* aProperties, REPORTER& aReporter );
116
117#endif // SYMBOL_IMPORT_RECONCILER_H
Define a library symbol object.
Definition lib_symbol.h:114
static REPORTER & GetInstance()
Definition reporter.cpp:179
Container for project specific data.
Definition project.h:63
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:72
Holds all the data relating to one schematic.
Definition schematic.h:90
Base class that schematic file and library loading and saving plugins should derive from.
Definition sch_io.h:59
bool registerCacheRow(const wxString &aCacheNickname)
Insert or refresh the project symbol-library-table row for the generated cache.
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.
SYMBOL_LIBRARY_ADAPTER & m_adapter
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.
An interface to the global shared library manager that is schematic-specific and linked to one projec...
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition utf8.h:67
Outcome of a post-import symbol-library reconciliation pass.
int m_linkedToCache
schematic LIB_IDs re-pointed at the generated cache
int m_unresolved
schematic LIB_IDs left unresolved
wxString m_cacheNickname
nickname of the generated cache, empty if none written
int m_linkedToSource
schematic LIB_IDs re-pointed at a provenance source library
int m_savedToCache
distinct definitions written into the cache library
SYMBOL_IMPORT_RECONCILE_RESULT ReconcileImportedSymbols(SCH_IO &aPlugin, SCHEMATIC &aSchematic, PROJECT &aProject, const wxString &aSchematicPath, const std::map< std::string, UTF8 > *aProperties, REPORTER &aReporter)
Reconcile aSchematic against the definitions aPlugin retained while loading it.