KiCad PCB EDA Suite
Loading...
Searching...
No Matches
easypc_classes_library.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
27
28#ifndef EASYPC_CLASSES_LIBRARY_H
29#define EASYPC_CLASSES_LIBRARY_H
30
31#include <memory>
32#include <vector>
33
34#include <wx/string.h>
35#include <wx/arrstr.h> // for MSVC to see std::vector<wxString> is exported from wx
36
38
39
40namespace EASYPC
41{
42
48
49
52{
53 LOAD_TASK Load( ARCHIVE& aAr ) override;
54 int ItemFormat( const ARCHIVE& aAr ) const override { return Format; }
55
56 wxString Name;
57 OBJECT* Shapes = nullptr;
58 OBJECT* Pads = nullptr;
59 OBJECT* Texts = nullptr;
61 int32_t OriginX = 0;
62 int32_t OriginY = 0;
63 int32_t Timestamp = 0;
64 wxString Library;
65
67 std::unique_ptr<OBJECT> NameOrigin;
68 std::unique_ptr<SOURCE_DESIGN_LIST> DerivedValuePositions;
69 std::unique_ptr<SOURCE_VALUE_POSITION> DerivedNamePosition;
70};
71
72
75{
76 LOAD_TASK Load( ARCHIVE& aAr ) override;
77
78 bool Visible = true;
79};
80
81
84{
85 LOAD_TASK Load( ARCHIVE& aAr ) override;
86
87 OBJECT* Definition = nullptr;
88 bool Visible = true;
89};
90
91
94{
95 LOAD_TASK Load( ARCHIVE& aAr ) override;
96
97 wxString Symbol;
98 std::vector<wxString> PinNames;
99 wxString Library;
100};
101
102
105{
106 LOAD_TASK Load( ARCHIVE& aAr ) override;
107
108 OBJECT* Parent = nullptr;
109 std::vector<OBJECT*> Items;
110};
111
112
114const std::vector<OBJECT*>& ListItems( const OBJECT* aList );
115
116
118template <typename T>
119std::vector<T*> TypedItems( const OBJECT* aList )
120{
121 std::vector<T*> out;
122
123 for( OBJECT* obj : ListItems( aList ) )
124 {
125 if( T* typed = dynamic_cast<T*>( obj ) )
126 out.push_back( typed );
127 }
128
129 return out;
130}
131
132
135{
136 LOAD_TASK Load( ARCHIVE& aAr ) override;
137
138 OBJECT* Pins = nullptr;
139 std::vector<int32_t> PcbSymbolPins;
140};
141
142
144{
145 LOAD_TASK Load( ARCHIVE& aAr ) override;
146
147 bool IsNoConnect() const { return PinType & 0x1; }
148
149 wxString PcbSymbolPin = wxS( "-1" );
150 wxString PinNumber;
151 wxString NetName;
152 uint32_t PinType = 0;
153};
154
155
157{
158 LOAD_TASK Load( ARCHIVE& aAr ) override;
159 int ItemFormat( const ARCHIVE& aAr ) const override { return Format; }
160
161 wxString Name;
162 wxString Package;
163 OBJECT* Gates = nullptr;
165 wxString Description;
166 wxString Library;
167 uint32_t SuppressionFlags = 0;
168};
169
170
173{
174 LOAD_TASK Load( ARCHIVE& aAr ) override;
175 int ItemFormat( const ARCHIVE& aAr ) const override { return Format; }
176
177 wxString Package;
178 wxString Symbol;
179 OBJECT* GateMaps = nullptr;
180 wxString Library;
181};
182
183
191
192
197std::vector<wxString> ExpandPinNumberList( const wxString& aList, wxString* aDisplay = nullptr );
198
199
201bool IsPadList( const wxString& aPcbSymbolPin );
202
203} // namespace EASYPC
204
205#endif // EASYPC_CLASSES_LIBRARY_H
One archive load stream; it owns every object it creates.
A loader coroutine. Awaiting one queues it on its archive's frame stack instead of nesting the call.
Shapes, vertices and the free-standing drawn items.
std::vector< wxString > ExpandPinNumberList(const wxString &aList, wxString *aDisplay)
Expand a gate pin's component pin list by Easy-PC's pin list syntax: items separated by ,...
constexpr int NEWEST_ITEM_FORMAT
The newest item format a file can carry (30001)
bool IsPadList(const wxString &aPcbSymbolPin)
Whether a gate pin's pad reference names several pads ("-1", the unmapped marker, does not)
std::vector< T * > TypedItems(const OBJECT *aList)
The items of ListItems that are a T, in order.
const std::vector< OBJECT * > & ListItems(const OBJECT *aList)
The items of a design list or array, empty for anything else.
Root of every deserialized object.
The item's own format, returned by the self-versioned classes' ItemFormat.
SOURCE_SCM_COMPONENT * Schematic
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
An array: owner tag, then a counted list of objects.
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
The base of nearly every class.
One gate's terminals to footprint pads.
OBJECT * Pins
gate pin array, format above 8999
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
std::vector< int32_t > PcbSymbolPins
older formats: pad number per terminal, -1 unmapped
wxString NetName
default net, or a net class in parentheses
wxString PcbSymbolPin
pad number, "-1", or a pad list
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
A schematic symbol and its pin names.
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
std::vector< wxString > PinNames
terminal t is the symbol pad numbered t + 1
The package half of a component.
OBJECT * GateMaps
one per schematic gate in order
int ItemFormat(const ARCHIVE &aAr) const override
The version this object gates on; the base is the archive's current read format.
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
Placed pin names and numbers.
OBJECT * Definition
the pin name or number instantiated
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
Pin name and pin number definitions.
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
int ItemFormat(const ARCHIVE &aAr) const override
The version this object gates on; the base is the archive's current read format.
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
Footprints and schematic symbols alike.
LOAD_TASK Load(ARCHIVE &aAr) override
Read this object's fields.
std::unique_ptr< SOURCE_DESIGN_LIST > DerivedValuePositions
OBJECT * Shapes
free copper list
int ItemFormat(const ARCHIVE &aAr) const override
The version this object gates on; the base is the archive's current read format.
OBJECT * Texts
free text list
std::unique_ptr< OBJECT > NameOrigin
The symbol name origin of formats below 10003, which becomes the only value position.
std::unique_ptr< SOURCE_VALUE_POSITION > DerivedNamePosition
OBJECT * Pads
free pad list