KiCad PCB EDA Suite
Loading...
Searching...
No Matches
job_import_utils.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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef JOB_IMPORT_UTILS_H
21#define JOB_IMPORT_UTILS_H
22
23#include <kicommon.h>
24#include <json_common.h>
25#include <wx/string.h>
26#include <map>
27#include <utility>
28#include <vector>
29
30class REPORTER;
31
41
42
44 {
48 } )
49
50
55struct KICOMMON_API IMPORT_REPORT_DATA
56{
57 wxString m_sourceFile;
58 wxString m_sourceFormat;
59 wxString m_outputFile;
60
63 std::vector<std::pair<wxString, size_t>> m_statistics;
64
67 nlohmann::json m_extraJson = nlohmann::json::object();
68
69 std::vector<wxString> m_warnings;
70 std::vector<wxString> m_errors;
71};
72
73
79KICOMMON_API bool ParseImportReportFormat( const wxString& aText, IMPORT_REPORT_FORMAT& aFormat );
80
81
86KICOMMON_API wxString DefaultImportOutputPath( const wxString& aInputFile,
87 const wxString& aKiCadExt );
88
89
98KICOMMON_API bool LoadLayerMapFile( const wxString& aFile, std::map<wxString, wxString>& aMap,
99 wxString& aError );
100
101
107 const wxString& aReportFile, const IMPORT_REPORT_DATA& aData );
108
109#endif
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:71
@ NONE
Definition eda_shape.h:72
KICOMMON_API void WriteImportReport(REPORTER *aReporter, IMPORT_REPORT_FORMAT aFormat, const wxString &aReportFile, const IMPORT_REPORT_DATA &aData)
Emit an import report in the requested format to aReportFile, or to aReporter (at INFO severity) when...
KICOMMON_API bool LoadLayerMapFile(const wxString &aFile, std::map< wxString, wxString > &aMap, wxString &aError)
Load an explicit layer-mapping file into aMap.
NLOHMANN_JSON_SERIALIZE_ENUM(IMPORT_REPORT_FORMAT, { { IMPORT_REPORT_FORMAT::NONE, "none" }, { IMPORT_REPORT_FORMAT::JSON, "json" }, { IMPORT_REPORT_FORMAT::TEXT, "text" } }) struct KICOMMON_API IMPORT_REPORT_DATA
Data describing a completed import, rendered uniformly by WriteImportReport for both the board and sc...
KICOMMON_API bool ParseImportReportFormat(const wxString &aText, IMPORT_REPORT_FORMAT &aFormat)
Parse the user-facing report format name ("none", "json" or "text") into its enum.
KICOMMON_API wxString DefaultImportOutputPath(const wxString &aInputFile, const wxString &aKiCadExt)
Build the default output path for an import by swapping the input file's extension for the given KiCa...
IMPORT_REPORT_FORMAT
Output format for the report shared by the board and schematic import jobs.
#define KICOMMON_API
Definition kicommon.h:27