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 <cstdio>
32 
33 template<typename T>
35 {
36  typedef T type;
37 };
38 
39 template<typename T>
40 struct remove_pointer<T*>
41 {
42  typedef typename remove_pointer<T>::type type;
43 };
44 
52 template <class T, class I>
53 bool IsA( const I* aObject )
54 {
55  return aObject && remove_pointer<T>::type::ClassOf( aObject );
56 }
57 
58 template <class T, class I>
59 bool IsA( const I& aObject )
60 {
61  return remove_pointer<T>::type::ClassOf( &aObject );
62 }
63 
72 template<class Casted, class From>
73 Casted dyn_cast( From aObject )
74 {
76  return static_cast<Casted>( aObject );
77 
78  return NULL;
79 }
80 
81 class EDA_ITEM;
82 
83 #endif // SWIG
84 
85 
90 enum KICAD_T
91 {
92  NOT_USED = -1,
93 
94  EOT = 0,
95 
99 
100  // Items in pcb
110  PCB_MARKER_T,
117 
118  // Schematic draw Items. The order of these items effects the sort order.
119  // It is currently ordered to mimic the old Eeschema locate behavior where
120  // the smallest item is the selected item.
136 
137  // Be prudent with these 3 types:
138  // they should be used only to locate a specific field type
139  // among SCH_FIELD_T items types
143 
144  // General
146 
147  /*
148  * Draw items in library component.
149  *
150  * The order of these items effects the sort order for items inside the
151  * "DRAW/ENDDRAW" section of the component definition in a library file.
152  * If you add a new draw item, type, please make sure you add it so the
153  * sort order is logical.
154  */
164 
165  /*
166  * Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
167  * types before this line.
168  */
170 
171  /*
172  * For GerbView: items type:
173  */
175 
176  /*
177  * for Pl_Editor, in undo/redo commands
178  */
180 
181  // End value
183 };
184 
185 #endif // __KICAD_TYPEINFO_H
Definition: typeinfo.h:97
T
enum T contains all this lexer's tokens.
the 3d code uses this value
Definition: typeinfo.h:92
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:114
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:104
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:106
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:73
search types array terminator (End Of Types)
Definition: typeinfo.h:94
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:90
not really an item, used to identify a screen
Definition: typeinfo.h:98
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
remove_pointer< T >::type type
Definition: typeinfo.h:42
class MODULE, a footprint
Definition: typeinfo.h:101
class BOARD_ITEM_LIST, a list of board items
Definition: typeinfo.h:115
class SEGZONE, a segment used to fill a zone area (segment on a copper layer)
Definition: typeinfo.h:109
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:112
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:113
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:105
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:111
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:116
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:108
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
bool IsA(const I *aObject)
Function IsA()
Definition: typeinfo.h:53