KiCad PCB EDA Suite
typeinfo.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) 2014 CERN
5  * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
6  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
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.
12  *
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.
17  *
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
24  */
25 
26 #ifndef __KICAD_TYPEINFO_H
27 #define __KICAD_TYPEINFO_H
28 
29 
30 #ifndef SWIG
31 #include <type_traits>
32 
40 template <class T, class I>
41 bool IsA( const I* aObject )
42 {
43  return aObject && std::remove_pointer<T>::type::ClassOf( aObject );
44 }
45 
46 template <class T, class I>
47 bool IsA( const I& aObject )
48 {
49  return std::remove_pointer<T>::type::ClassOf( &aObject );
50 }
51 
60 template<class Casted, class From>
61 Casted dyn_cast( From aObject )
62 {
63  if( std::remove_pointer<Casted>::type::ClassOf ( aObject ) )
64  return static_cast<Casted>( aObject );
65 
66  return nullptr;
67 }
68 
69 class EDA_ITEM;
70 
71 #endif // SWIG
72 
73 
78 enum KICAD_T
79 {
80  NOT_USED = -1,
81 
82  EOT = 0,
83 
87 
88  // Items in pcb
98  PCB_MARKER_T,
105 
106  // Schematic draw Items. The order of these items effects the sort order.
107  // It is currently ordered to mimic the old Eeschema locate behavior where
108  // the smallest item is the selected item.
124 
125  // Be prudent with these 3 types:
126  // they should be used only to locate a specific field type
127  // among SCH_FIELD_T items types
131 
132  // General
134 
135  /*
136  * Draw items in library component.
137  *
138  * The order of these items effects the sort order for items inside the
139  * "DRAW/ENDDRAW" section of the component definition in a library file.
140  * If you add a new draw item, type, please make sure you add it so the
141  * sort order is logical.
142  */
152 
153  /*
154  * Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
155  * types before this line.
156  */
158 
159  /*
160  * For GerbView: items type:
161  */
166 
167  /*
168  * for Pl_Editor, in undo/redo commands
169  */
171 
172  // End value
174 };
175 
176 #endif // __KICAD_TYPEINFO_H
Definition: typeinfo.h:85
the 3d code uses this value
Definition: typeinfo.h:80
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
not really an item, used to identify a screen
Definition: typeinfo.h:86
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class MODULE, a footprint
Definition: typeinfo.h:89
class BOARD_ITEM_LIST, a list of board items
Definition: typeinfo.h:103
class SEGZONE, a segment used to fill a zone area (segment on a copper layer)
Definition: typeinfo.h:97
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:101
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:104
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
bool IsA(const I *aObject)
Function IsA()
Definition: typeinfo.h:41