2
* This program source code file is part of KiCad, a free EDA CAD application.
4
* Copyright (C) 2014 CERN
5
* Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
6
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* as published by the Free Software Foundation; either version 2
11
* of the License, or (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, you may find one here:
20
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21
* or you may search the http://www.gnu.org website for the version 2 license,
22
* or you may write to the Free Software Foundation, Inc.,
23
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26
#ifndef __KICAD_TYPEINFO_H
27
#define __KICAD_TYPEINFO_H
35
* is the set of class identification values, stored in EDA_ITEM::m_StructType
39
NOT_USED = -1, ///< the 3d code uses this value
41
EOT = 0, ///< search types array terminator (End Of Types)
45
SCREEN_T, ///< not really an item, used to identify a screen
48
PCB_MODULE_T, ///< class MODULE, a footprint
49
PCB_PAD_T, ///< class D_PAD, a pad in a footprint
50
PCB_LINE_T, ///< class DRAWSEGMENT, a segment not on copper layers
51
PCB_TEXT_T, ///< class TEXTE_PCB, text on a layer
52
PCB_MODULE_TEXT_T, ///< class TEXTE_MODULE, text in a footprint
53
PCB_MODULE_EDGE_T, ///< class EDGE_MODULE, a footprint edge
54
PCB_TRACE_T, ///< class TRACK, a track segment (segment on a copper layer)
55
PCB_VIA_T, ///< class VIA, a via (like a track segment on a copper layer)
56
PCB_ZONE_T, ///< class SEGZONE, a segment used to fill a zone area (segment on a
58
PCB_MARKER_T, ///< class MARKER_PCB, a marker used to show something
59
PCB_DIMENSION_T, ///< class DIMENSION, a dimension (graphic item)
60
PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item)
61
PCB_ZONE_AREA_T, ///< class ZONE_CONTAINER, a zone area
62
PCB_ITEM_LIST_T, ///< class BOARD_ITEM_LIST, a list of board items
64
// Schematic draw Items. The order of these items effects the sort order.
65
// It is currently ordered to mimic the old Eeschema locate behavior where
66
// the smallest item is the selected item.
77
SCH_HIERARCHICAL_LABEL_T,
83
// Be prudent with these 3 types:
84
// they should be used only to locate a specific field type
85
// among SCH_FIELD_T items types
86
SCH_FIELD_LOCATE_REFERENCE_T,
87
SCH_FIELD_LOCATE_VALUE_T,
88
SCH_FIELD_LOCATE_FOOTPRINT_T,
94
* Draw items in library component.
96
* The order of these items effects the sort order for items inside the
97
* "DRAW/ENDDRAW" section of the component definition in a library file.
98
* If you add a new draw item, type, please make sure you add it so the
99
* sort order is logical.
112
* Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
113
* types before this line.
118
* For GerbView: items type:
120
TYPE_GERBER_DRAW_ITEM,
123
* for Pl_Editor, in undo/redo commands
125
TYPE_PL_EDITOR_LAYOUT,
132
struct remove_pointer
138
struct remove_pointer<T*>
140
typedef typename remove_pointer<T>::type type;
146
* Checks if the type of aObject is T.
147
* @param aObject object for type check
148
* @return true, if aObject type equals T.
150
template <class T, class I>
151
bool IsA(const I *aObject)
153
return aObject && remove_pointer<T>::type::ClassOf(aObject);
156
template <class T, class I>
157
bool IsA(const I& aObject)
159
return remove_pointer<T>::type::ClassOf(&aObject);
163
* Function dyn_cast()
165
* A lightweight dynamic downcast. Casts aObject to type Casted*.
166
* Uses EDA_ITEM::Type() and EDA_ITEM::ClassOf() to check if type matches.
167
* @param aObject object to be casted
168
* @return down-casted object or NULL if type doesn't match Casted.
170
template<class Casted, class From>
171
Casted dyn_cast(From aObject)
173
if( remove_pointer<Casted>::type::ClassOf ( aObject ) )
174
return static_cast<Casted>( aObject );
179
#endif // __KICAD_TYPEINFO_H