KiCad PCB EDA Suite
Loading...
Searching...
No Matches
easyeda_parser_structs.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 (C) 2023 Alex Shvartzkop <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef EASYEDA_PARSER_STRUCTS_H_
22#define EASYEDA_PARSER_STRUCTS_H_
23
24#include <cstdint>
25#include <cstring>
26#include <memory>
27#include <vector>
28#include <map>
29#include <optional>
30
31#include <wx/string.h>
32#include <wx/arrstr.h>
33
34#include <json_common.h>
35
36namespace EASYEDA
37{
38
39enum class DOC_TYPE
40{
42
44 SYMBOL = 2,
45 PCB = 3,
49};
50
51struct HEAD
52{
54
55 wxString editorVersion;
56 wxString title;
57 wxString description;
58
59 double x = 0;
60 double y = 0;
61
62 std::optional<std::map<wxString, wxString>> c_para;
63};
64
66{
67 std::optional<DOC_TYPE> docType; // May be here or in head
69
70 // BBox
71 // colors
72 wxString canvas;
73 wxString title;
74 wxArrayString shape;
75 std::optional<nlohmann::json> dataStr;
76};
77
78struct C_PARA
79{
80 wxString package;
81 wxString pre;
82 wxString Contributor;
83 wxString link;
84 wxString Model_3D;
85};
86
88{
89 std::optional<std::map<wxString, wxString>> c_para;
90 std::vector<wxString> layers;
91 std::optional<wxString> uuid;
92 std::optional<std::map<wxString, nlohmann::json>> DRCRULE;
93};
94
96{
97 std::optional<std::map<wxString, wxString>> c_para;
98};
99
101{
102 std::optional<std::vector<DOCUMENT>> schematics;
103};
104
105void from_json( const nlohmann::json& j, EASYEDA::DOC_TYPE& d );
106void from_json( const nlohmann::json& j, EASYEDA::HEAD& d );
107void from_json( const nlohmann::json& j, EASYEDA::DOCUMENT& d );
108void from_json( const nlohmann::json& j, EASYEDA::C_PARA& d );
109void from_json( const nlohmann::json& j, EASYEDA::DOCUMENT_PCB& d );
110void from_json( const nlohmann::json& j, EASYEDA::DOCUMENT_SYM& d );
111void from_json( const nlohmann::json& j, EASYEDA::DOCUMENT_SCHEMATICS& d );
112
129
130} // namespace EASYEDA
131
132
133#endif // EASYEDA_PARSER_STRUCTS_H_
void from_json(const nlohmann::json &j, EASYEDA::DOC_TYPE &d)
std::optional< std::map< wxString, nlohmann::json > > DRCRULE
std::optional< std::map< wxString, wxString > > c_para
std::vector< wxString > layers
std::optional< wxString > uuid
std::optional< std::vector< DOCUMENT > > schematics
std::optional< std::map< wxString, wxString > > c_para
std::optional< nlohmann::json > dataStr
std::optional< DOC_TYPE > docType
std::optional< std::map< wxString, wxString > > c_para