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
37
38
39namespace EASYPC
40{
41
47
48
51{
52 LOAD_TASK Load( ARCHIVE& aAr ) override;
53 int ItemFormat( const ARCHIVE& aAr ) const override { return Format; }
54
55 wxString Name;
56 OBJECT* Shapes = nullptr;
57 OBJECT* Pads = nullptr;
58 OBJECT* Texts = nullptr;
60 int32_t OriginX = 0;
61 int32_t OriginY = 0;
62 int32_t Timestamp = 0;
63 wxString Library;
64
66 std::unique_ptr<OBJECT> NameOrigin;
67 std::unique_ptr<SOURCE_DESIGN_LIST> DerivedValuePositions;
68 std::unique_ptr<SOURCE_VALUE_POSITION> DerivedNamePosition;
69};
70
71
74{
75 LOAD_TASK Load( ARCHIVE& aAr ) override;
76
77 bool Visible = true;
78};
79
80
83{
84 LOAD_TASK Load( ARCHIVE& aAr ) override;
85
86 OBJECT* Definition = nullptr;
87 bool Visible = true;
88};
89
90
93{
94 LOAD_TASK Load( ARCHIVE& aAr ) override;
95
96 wxString Symbol;
97 std::vector<wxString> PinNames;
98 wxString Library;
99};
100
101
104{
105 LOAD_TASK Load( ARCHIVE& aAr ) override;
106
107 OBJECT* Parent = nullptr;
108 std::vector<OBJECT*> Items;
109};
110
111
113const std::vector<OBJECT*>& ListItems( const OBJECT* aList );
114
115
117template <typename T>
118std::vector<T*> TypedItems( const OBJECT* aList )
119{
120 std::vector<T*> out;
121
122 for( OBJECT* obj : ListItems( aList ) )
123 {
124 if( T* typed = dynamic_cast<T*>( obj ) )
125 out.push_back( typed );
126 }
127
128 return out;
129}
130
131
134{
135 LOAD_TASK Load( ARCHIVE& aAr ) override;
136
137 OBJECT* Pins = nullptr;
138 std::vector<int32_t> PcbSymbolPins;
139};
140
141
143{
144 LOAD_TASK Load( ARCHIVE& aAr ) override;
145
146 bool IsNoConnect() const { return PinType & 0x1; }
147
148 wxString PcbSymbolPin = wxS( "-1" );
149 wxString PinNumber;
150 wxString NetName;
151 uint32_t PinType = 0;
152};
153
154
156{
157 LOAD_TASK Load( ARCHIVE& aAr ) override;
158 int ItemFormat( const ARCHIVE& aAr ) const override { return Format; }
159
160 wxString Name;
161 wxString Package;
162 OBJECT* Gates = nullptr;
164 wxString Description;
165 wxString Library;
166 uint32_t SuppressionFlags = 0;
167};
168
169
172{
173 LOAD_TASK Load( ARCHIVE& aAr ) override;
174 int ItemFormat( const ARCHIVE& aAr ) const override { return Format; }
175
176 wxString Package;
177 wxString Symbol;
178 OBJECT* GateMaps = nullptr;
179 wxString Library;
180};
181
182
190
191
196std::vector<wxString> ExpandPinNumberList( const wxString& aList, wxString* aDisplay = nullptr );
197
198
200bool IsPadList( const wxString& aPcbSymbolPin );
201
202} // namespace EASYPC
203
204#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