KiCad PCB EDA Suite
typeinfo.h File Reference
#include <type_traits>

Go to the source code of this file.

Enumerations

enum  KICAD_T {
  NOT_USED = -1 , TYPE_NOT_INIT = 0 , PCB_T , SCREEN_T ,
  PCB_FOOTPRINT_T , PCB_PAD_T , PCB_SHAPE_T , PCB_BITMAP_T ,
  PCB_TEXT_T , PCB_TEXTBOX_T , PCB_FP_TEXT_T , PCB_FP_TEXTBOX_T ,
  PCB_FP_SHAPE_T , PCB_FP_DIM_ALIGNED_T , PCB_FP_DIM_LEADER_T , PCB_FP_DIM_CENTER_T ,
  PCB_FP_DIM_RADIAL_T , PCB_FP_DIM_ORTHOGONAL_T , PCB_FP_ZONE_T , PCB_TRACE_T ,
  PCB_VIA_T , PCB_ARC_T , PCB_MARKER_T , PCB_DIMENSION_T ,
  PCB_DIM_ALIGNED_T , PCB_DIM_LEADER_T , PCB_DIM_CENTER_T , PCB_DIM_RADIAL_T ,
  PCB_DIM_ORTHOGONAL_T , PCB_TARGET_T , PCB_ZONE_T , PCB_ITEM_LIST_T ,
  PCB_NETINFO_T , PCB_GROUP_T , PCB_LOCATE_STDVIA_T , PCB_LOCATE_UVIA_T ,
  PCB_LOCATE_BBVIA_T , PCB_LOCATE_TEXT_T , PCB_LOCATE_GRAPHIC_T , PCB_LOCATE_HOLE_T ,
  PCB_LOCATE_PTH_T , PCB_LOCATE_NPTH_T , PCB_LOCATE_BOARD_EDGE_T , PCB_SHAPE_LOCATE_SEGMENT_T ,
  PCB_SHAPE_LOCATE_RECT_T , PCB_SHAPE_LOCATE_CIRCLE_T , PCB_SHAPE_LOCATE_ARC_T , PCB_SHAPE_LOCATE_POLY_T ,
  PCB_SHAPE_LOCATE_BEZIER_T , SCH_MARKER_T , SCH_JUNCTION_T , SCH_NO_CONNECT_T ,
  SCH_BUS_WIRE_ENTRY_T , SCH_BUS_BUS_ENTRY_T , SCH_LINE_T , SCH_SHAPE_T ,
  SCH_BITMAP_T , SCH_TEXTBOX_T , SCH_TEXT_T , SCH_LABEL_T ,
  SCH_GLOBAL_LABEL_T , SCH_HIER_LABEL_T , SCH_DIRECTIVE_LABEL_T , SCH_FIELD_T ,
  SCH_SYMBOL_T , SCH_SHEET_PIN_T , SCH_SHEET_T , SCH_PIN_T ,
  SCH_FIELD_LOCATE_REFERENCE_T , SCH_FIELD_LOCATE_VALUE_T , SCH_FIELD_LOCATE_FOOTPRINT_T , SCH_FIELD_LOCATE_DATASHEET_T ,
  SCH_ITEM_LOCATE_WIRE_T , SCH_ITEM_LOCATE_BUS_T , SCH_ITEM_LOCATE_GRAPHIC_LINE_T , SCH_LABEL_LOCATE_ANY_T ,
  SCH_LABEL_LOCATE_WIRE_T , SCH_LABEL_LOCATE_BUS_T , SCH_SYMBOL_LOCATE_POWER_T , SCH_LOCATE_ANY_T ,
  SCH_SCREEN_T , SCHEMATIC_T , LIB_SYMBOL_T , LIB_SHAPE_T ,
  LIB_TEXT_T , LIB_TEXTBOX_T , LIB_PIN_T , LIB_FIELD_T ,
  GERBER_LAYOUT_T , GERBER_DRAW_ITEM_T , GERBER_IMAGE_T , WSG_LINE_T ,
  WSG_RECT_T , WSG_POLY_T , WSG_TEXT_T , WSG_BITMAP_T ,
  WSG_PAGE_T , WS_PROXY_UNDO_ITEM_T , WS_PROXY_UNDO_ITEM_PLUS_T , SYMBOL_LIB_TABLE_T ,
  FP_LIB_TABLE_T , SYMBOL_LIBS_T , SEARCH_STACK_T , S3D_CACHE_T ,
  MAX_STRUCT_TYPE_ID
}
 The set of class identification values stored in EDA_ITEM::m_structType. More...
 

Functions

template<class T , class I >
bool IsA (const I *aObject)
 Check if the type of aObject is T. More...
 
template<class T , class I >
bool IsA (const I &aObject)
 
template<class Casted , class From >
Casted dyn_cast (From aObject)
 A lightweight dynamic downcast. More...
 
constexpr KICAD_T BaseType (const KICAD_T aType)
 Return the underlying type of the given type. More...
 
constexpr bool IsNullType (const KICAD_T aType)
 
constexpr bool IsInstantiableType (const KICAD_T aType)
 
constexpr bool IsEeschemaType (const KICAD_T aType)
 
constexpr bool IsPcbnewType (const KICAD_T aType)
 
constexpr bool IsGerbviewType (const KICAD_T aType)
 
constexpr bool IsPageLayoutEditorType (const KICAD_T aType)
 
constexpr bool IsMiscType (const KICAD_T aType)
 
constexpr bool IsTypeCorrect (KICAD_T aType)
 
constexpr bool IsTypeAvailable (KICAD_T aType)
 

Enumeration Type Documentation

◆ KICAD_T

enum KICAD_T

The set of class identification values stored in EDA_ITEM::m_structType.

Enumerator
NOT_USED 

the 3d code uses this value

TYPE_NOT_INIT 
PCB_T 
SCREEN_T 

not really an item, used to identify a screen

PCB_FOOTPRINT_T 

class FOOTPRINT, a footprint

PCB_PAD_T 

class PAD, a pad in a footprint

PCB_SHAPE_T 

class PCB_SHAPE, a segment not on copper layers

PCB_BITMAP_T 

class PCB_BITMAP, bitmap on a layer

PCB_TEXT_T 

class PCB_TEXT, text on a layer

PCB_TEXTBOX_T 

class PCB_TEXTBOX, wrapped text on a layer

PCB_FP_TEXT_T 

class FP_TEXT, text in a footprint

PCB_FP_TEXTBOX_T 

class FP_TEXTBOX, wrapped text in a footprint

PCB_FP_SHAPE_T 

class FP_SHAPE, a footprint edge

PCB_FP_DIM_ALIGNED_T 

class PCB_DIM_ALIGNED, a linear dimension (graphic item)

PCB_FP_DIM_LEADER_T 

class PCB_DIM_LEADER, a leader dimension (graphic item)

PCB_FP_DIM_CENTER_T 

class PCB_DIM_CENTER, a center point marking (graphic item)

PCB_FP_DIM_RADIAL_T 

class PCB_DIM_RADIAL, a radius or diameter dimension

PCB_FP_DIM_ORTHOGONAL_T 

class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y

PCB_FP_ZONE_T 

class ZONE, managed by a footprint

PCB_TRACE_T 

class PCB_TRACK, a track segment (segment on a copper layer)

PCB_VIA_T 

class PCB_VIA, a via (like a track segment on a copper layer)

PCB_ARC_T 

class PCB_ARC, an arc track segment on a copper layer

PCB_MARKER_T 

class PCB_MARKER, a marker used to show something

PCB_DIMENSION_T 

class PCB_DIMENSION_BASE: abstract dimension meta-type

PCB_DIM_ALIGNED_T 

class PCB_DIM_ALIGNED, a linear dimension (graphic item)

PCB_DIM_LEADER_T 

class PCB_DIM_LEADER, a leader dimension (graphic item)

PCB_DIM_CENTER_T 

class PCB_DIM_CENTER, a center point marking (graphic item)

PCB_DIM_RADIAL_T 

class PCB_DIM_RADIAL, a radius or diameter dimension

PCB_DIM_ORTHOGONAL_T 

class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y

PCB_TARGET_T 

class PCB_TARGET, a target (graphic item)

PCB_ZONE_T 

class ZONE, a copper pour area

PCB_ITEM_LIST_T 

class BOARD_ITEM_LIST, a list of board items

PCB_NETINFO_T 

class NETINFO_ITEM, a description of a net

PCB_GROUP_T 

class PCB_GROUP, a set of BOARD_ITEMs

PCB_LOCATE_STDVIA_T 
PCB_LOCATE_UVIA_T 
PCB_LOCATE_BBVIA_T 
PCB_LOCATE_TEXT_T 
PCB_LOCATE_GRAPHIC_T 
PCB_LOCATE_HOLE_T 
PCB_LOCATE_PTH_T 
PCB_LOCATE_NPTH_T 
PCB_LOCATE_BOARD_EDGE_T 
PCB_SHAPE_LOCATE_SEGMENT_T 
PCB_SHAPE_LOCATE_RECT_T 
PCB_SHAPE_LOCATE_CIRCLE_T 
PCB_SHAPE_LOCATE_ARC_T 
PCB_SHAPE_LOCATE_POLY_T 
PCB_SHAPE_LOCATE_BEZIER_T 
SCH_MARKER_T 
SCH_JUNCTION_T 
SCH_NO_CONNECT_T 
SCH_BUS_WIRE_ENTRY_T 
SCH_BUS_BUS_ENTRY_T 
SCH_LINE_T 
SCH_SHAPE_T 
SCH_BITMAP_T 
SCH_TEXTBOX_T 
SCH_TEXT_T 
SCH_LABEL_T 
SCH_GLOBAL_LABEL_T 
SCH_HIER_LABEL_T 
SCH_DIRECTIVE_LABEL_T 
SCH_FIELD_T 
SCH_SYMBOL_T 
SCH_SHEET_PIN_T 
SCH_SHEET_T 
SCH_PIN_T 
SCH_FIELD_LOCATE_REFERENCE_T 
SCH_FIELD_LOCATE_VALUE_T 
SCH_FIELD_LOCATE_FOOTPRINT_T 
SCH_FIELD_LOCATE_DATASHEET_T 
SCH_ITEM_LOCATE_WIRE_T 
SCH_ITEM_LOCATE_BUS_T 
SCH_ITEM_LOCATE_GRAPHIC_LINE_T 
SCH_LABEL_LOCATE_ANY_T 
SCH_LABEL_LOCATE_WIRE_T 
SCH_LABEL_LOCATE_BUS_T 
SCH_SYMBOL_LOCATE_POWER_T 
SCH_LOCATE_ANY_T 
SCH_SCREEN_T 
SCHEMATIC_T 
LIB_SYMBOL_T 
LIB_SHAPE_T 
LIB_TEXT_T 
LIB_TEXTBOX_T 
LIB_PIN_T 
LIB_FIELD_T 
GERBER_LAYOUT_T 
GERBER_DRAW_ITEM_T 
GERBER_IMAGE_T 
WSG_LINE_T 
WSG_RECT_T 
WSG_POLY_T 
WSG_TEXT_T 
WSG_BITMAP_T 
WSG_PAGE_T 
WS_PROXY_UNDO_ITEM_T 
WS_PROXY_UNDO_ITEM_PLUS_T 
SYMBOL_LIB_TABLE_T 
FP_LIB_TABLE_T 
SYMBOL_LIBS_T 
SEARCH_STACK_T 
S3D_CACHE_T 
MAX_STRUCT_TYPE_ID 

Definition at line 77 of file typeinfo.h.

78{
79 NOT_USED = -1,
80
81 TYPE_NOT_INIT = 0,
82 PCB_T,
83 SCREEN_T,
84
85 // Items in pcb
87 PCB_PAD_T,
102 PCB_VIA_T,
103 PCB_ARC_T,
112 PCB_ZONE_T,
116
117 // Be prudent with these types:
118 // they should be used only to locate specific item sub-types
119 // N.B. If you add a type here, be sure to add it below to the BaseType()
129
130 // Same for locating shapes types from PCB_SHAPE_T and PCB_FP_SHAPE_T items
137
138 // Schematic draw Items. The order of these items effects the sort order.
139 // It is currently ordered to mimic the old Eeschema locate behavior where
140 // the smallest item is the selected item.
159 SCH_PIN_T,
160
161 // Be prudent with these types:
162 // they should be used only to locate a specific field type among SCH_FIELD_Ts
163 // N.B. If you add a type here, be sure to add it below to the BaseType()
168
169 // Same for picking wires, buses and graphics from SCH_ITEM_T items
173
174 // Same for picking labels, or labels attached to wires and/or buses
178
179 // Same for picking symbols which are power symbols
181
182 // matches any type
184
185 // General
187
189
190 /*
191 * Draw items in library symbol.
192 *
193 * The order of these items effects the sort order for items inside the
194 * "DRAW/ENDDRAW" section of the symbol definition in a library file.
195 * If you add a new draw item, type, please make sure you add it so the
196 * sort order is logical.
197 */
202 LIB_PIN_T,
203
204 /*
205 * Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
206 * types before this line.
207 */
209
210 /*
211 * For GerbView: item types:
212 */
216
217 /*
218 * For Pl_Editor: item types:
219 */
226
227 // serialized layout used in undo/redo commands
228 WS_PROXY_UNDO_ITEM_T, // serialized layout used in undo/redo commands
229 WS_PROXY_UNDO_ITEM_PLUS_T, // serialized layout plus page and title block settings
230
231 /*
232 * FOR PROJECT::_ELEMs
233 */
239
240 // End value
242};
@ FP_LIB_TABLE_T
Definition: typeinfo.h:235
@ PCB_FP_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:95
@ PCB_T
Definition: typeinfo.h:82
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:110
@ SCH_LINE_T
Definition: typeinfo.h:146
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94
@ LIB_SYMBOL_T
Definition: typeinfo.h:198
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:143
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:107
@ SCH_FIELD_LOCATE_REFERENCE_T
Definition: typeinfo.h:164
@ LIB_TEXT_T
Definition: typeinfo.h:200
@ PCB_LOCATE_BOARD_EDGE_T
Definition: typeinfo.h:128
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ SCH_FIELD_LOCATE_FOOTPRINT_T
Definition: typeinfo.h:166
@ TYPE_NOT_INIT
Definition: typeinfo.h:81
@ MAX_STRUCT_TYPE_ID
Definition: typeinfo.h:241
@ PCB_FP_TEXTBOX_T
class FP_TEXTBOX, wrapped text in a footprint
Definition: typeinfo.h:93
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:108
@ PCB_LOCATE_BBVIA_T
Definition: typeinfo.h:122
@ PCB_LOCATE_NPTH_T
Definition: typeinfo.h:127
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:115
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:91
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ LIB_TEXTBOX_T
Definition: typeinfo.h:201
@ SCH_ITEM_LOCATE_WIRE_T
Definition: typeinfo.h:170
@ SCH_FIELD_T
Definition: typeinfo.h:155
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:90
@ PCB_LOCATE_TEXT_T
Definition: typeinfo.h:123
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:154
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_LOCATE_ANY_T
Definition: typeinfo.h:183
@ SCH_FIELD_LOCATE_VALUE_T
Definition: typeinfo.h:165
@ S3D_CACHE_T
Definition: typeinfo.h:238
@ PCB_FP_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:97
@ SCH_SHEET_T
Definition: typeinfo.h:158
@ SCH_ITEM_LOCATE_BUS_T
Definition: typeinfo.h:171
@ LIB_SHAPE_T
Definition: typeinfo.h:199
@ SCH_MARKER_T
Definition: typeinfo.h:141
@ PCB_ITEM_LIST_T
class BOARD_ITEM_LIST, a list of board items
Definition: typeinfo.h:113
@ SCH_SHAPE_T
Definition: typeinfo.h:147
@ WSG_POLY_T
Definition: typeinfo.h:222
@ PCB_LOCATE_STDVIA_T
Definition: typeinfo.h:120
@ PCB_LOCATE_GRAPHIC_T
Definition: typeinfo.h:124
@ GERBER_DRAW_ITEM_T
Definition: typeinfo.h:214
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ NOT_USED
the 3d code uses this value
Definition: typeinfo.h:79
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:104
@ WSG_LINE_T
Definition: typeinfo.h:220
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:145
@ LIB_PIN_T
Definition: typeinfo.h:202
@ SCH_SCREEN_T
Definition: typeinfo.h:186
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:111
@ SCH_LABEL_LOCATE_ANY_T
Definition: typeinfo.h:175
@ PCB_FP_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:99
@ PCB_SHAPE_LOCATE_CIRCLE_T
Definition: typeinfo.h:133
@ PCB_SHAPE_LOCATE_SEGMENT_T
Definition: typeinfo.h:131
@ SCH_FIELD_LOCATE_DATASHEET_T
Definition: typeinfo.h:167
@ PCB_SHAPE_LOCATE_RECT_T
Definition: typeinfo.h:132
@ SYMBOL_LIB_TABLE_T
Definition: typeinfo.h:234
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
Definition: typeinfo.h:172
@ SCHEMATIC_T
Definition: typeinfo.h:188
@ SCH_LABEL_LOCATE_WIRE_T
Definition: typeinfo.h:176
@ PCB_FP_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:96
@ WSG_TEXT_T
Definition: typeinfo.h:223
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:157
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:106
@ SCH_TEXT_T
Definition: typeinfo.h:150
@ PCB_SHAPE_LOCATE_BEZIER_T
Definition: typeinfo.h:136
@ WSG_PAGE_T
Definition: typeinfo.h:225
@ WS_PROXY_UNDO_ITEM_T
Definition: typeinfo.h:228
@ SEARCH_STACK_T
Definition: typeinfo.h:237
@ SYMBOL_LIBS_T
Definition: typeinfo.h:236
@ LIB_FIELD_T
Definition: typeinfo.h:208
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
Definition: typeinfo.h:100
@ SCH_LABEL_LOCATE_BUS_T
Definition: typeinfo.h:177
@ PCB_BITMAP_T
class PCB_BITMAP, bitmap on a layer
Definition: typeinfo.h:89
@ PCB_FP_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:98
@ PCB_LOCATE_PTH_T
Definition: typeinfo.h:126
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ WSG_RECT_T
Definition: typeinfo.h:221
@ PCB_SHAPE_LOCATE_POLY_T
Definition: typeinfo.h:135
@ PCB_SHAPE_LOCATE_ARC_T
Definition: typeinfo.h:134
@ SCH_SYMBOL_LOCATE_POWER_T
Definition: typeinfo.h:180
@ GERBER_IMAGE_T
Definition: typeinfo.h:215
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:144
@ GERBER_LAYOUT_T
Definition: typeinfo.h:213
@ SCREEN_T
not really an item, used to identify a screen
Definition: typeinfo.h:83
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
@ SCH_BITMAP_T
Definition: typeinfo.h:148
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ WS_PROXY_UNDO_ITEM_PLUS_T
Definition: typeinfo.h:229
@ PCB_LOCATE_UVIA_T
Definition: typeinfo.h:121
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition: typeinfo.h:105
@ PCB_NETINFO_T
class NETINFO_ITEM, a description of a net
Definition: typeinfo.h:114
@ SCH_TEXTBOX_T
Definition: typeinfo.h:149
@ WSG_BITMAP_T
Definition: typeinfo.h:224
@ PCB_LOCATE_HOLE_T
Definition: typeinfo.h:125
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:109
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152
@ SCH_JUNCTION_T
Definition: typeinfo.h:142
@ SCH_PIN_T
Definition: typeinfo.h:159

Function Documentation

◆ BaseType()

constexpr KICAD_T BaseType ( const KICAD_T  aType)
constexpr

Return the underlying type of the given type.

This is useful for finding the element type given one of the "non-type" types such as SCH_ITEM_LOCATE_WIRE_T.

Parameters
aTypeGiven type to resolve.
Returns
Base type.

Definition at line 253 of file typeinfo.h.

254{
255 switch( aType )
256 {
261 return SCH_FIELD_T;
262
266 return SCH_LINE_T;
267
271 return SCH_LABEL_T;
272
274 return SCH_SYMBOL_T;
275
277 case PCB_LOCATE_PTH_T:
279 return PCB_LOCATE_HOLE_T;
280
287 return PCB_SHAPE_T;
288
290 case PCB_DIM_CENTER_T:
291 case PCB_DIM_RADIAL_T:
293 case PCB_DIM_LEADER_T:
299 return PCB_DIMENSION_T;
300
301 default:
302 return aType;
303 }
304}

References PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_DIMENSION_T, PCB_FP_DIM_ALIGNED_T, PCB_FP_DIM_CENTER_T, PCB_FP_DIM_LEADER_T, PCB_FP_DIM_ORTHOGONAL_T, PCB_FP_DIM_RADIAL_T, PCB_LOCATE_HOLE_T, PCB_LOCATE_NPTH_T, PCB_LOCATE_PTH_T, PCB_SHAPE_LOCATE_ARC_T, PCB_SHAPE_LOCATE_BEZIER_T, PCB_SHAPE_LOCATE_CIRCLE_T, PCB_SHAPE_LOCATE_POLY_T, PCB_SHAPE_LOCATE_RECT_T, PCB_SHAPE_LOCATE_SEGMENT_T, PCB_SHAPE_T, SCH_FIELD_LOCATE_DATASHEET_T, SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_FIELD_LOCATE_REFERENCE_T, SCH_FIELD_LOCATE_VALUE_T, SCH_FIELD_T, SCH_ITEM_LOCATE_BUS_T, SCH_ITEM_LOCATE_GRAPHIC_LINE_T, SCH_ITEM_LOCATE_WIRE_T, SCH_LABEL_LOCATE_ANY_T, SCH_LABEL_LOCATE_BUS_T, SCH_LABEL_LOCATE_WIRE_T, SCH_LABEL_T, SCH_LINE_T, SCH_SYMBOL_LOCATE_POWER_T, and SCH_SYMBOL_T.

Referenced by DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), EE_RTREE::EE_TYPE::EE_TYPE(), DRC_TEST_PROVIDER::forEachGeometryItem(), PCB_VIEWER_TOOLS::GraphicOutlines(), PCB_CONTROL::placeBoardItems(), DRC_TEST_PROVIDER_DISALLOW::Run(), PCB_VIEWER_TOOLS::TextOutlines(), and BOARD_ADAPTER::transformFPShapesToPolySet().

◆ dyn_cast()

template<class Casted , class From >
Casted dyn_cast ( From  aObject)

A lightweight dynamic downcast.

Cast aObject to type Casted*. Uses EDA_ITEM::Type() and #EDA_ITEM::ClassOf() to check if type matches.

Parameters
aObjectobject to be casted.
Returns
down-casted object or NULL if type doesn't match Casted.

Definition at line 61 of file typeinfo.h.

62{
63 if( std::remove_pointer<Casted>::type::ClassOf ( aObject ) )
64 return static_cast<Casted>( aObject );
65
66 return nullptr;
67}

◆ IsA() [1/2]

template<class T , class I >
bool IsA ( const I aObject)

Definition at line 46 of file typeinfo.h.

47{
48 return std::remove_pointer<T>::type::ClassOf( &aObject );
49}

◆ IsA() [2/2]

template<class T , class I >
bool IsA ( const I aObject)

Check if the type of aObject is T.

Parameters
aObjectthe object for type check.
Returns
true, if aObject type equals T.

Definition at line 40 of file typeinfo.h.

41{
42 return aObject && std::remove_pointer<T>::type::ClassOf( aObject );
43}

◆ IsEeschemaType()

constexpr bool IsEeschemaType ( const KICAD_T  aType)
constexpr

Definition at line 366 of file typeinfo.h.

367{
368 switch( aType )
369 {
370 case SCH_MARKER_T:
371 case SCH_JUNCTION_T:
372 case SCH_NO_CONNECT_T:
375 case SCH_LINE_T:
376 case SCH_SHAPE_T:
377 case SCH_BITMAP_T:
378 case SCH_TEXT_T:
379 case SCH_TEXTBOX_T:
380 case SCH_LABEL_T:
383 case SCH_HIER_LABEL_T:
384 case SCH_FIELD_T:
385 case SCH_SYMBOL_T:
386 case SCH_SHEET_PIN_T:
387 case SCH_SHEET_T:
388 case SCH_PIN_T:
389
394
398
402
404 case SCH_LOCATE_ANY_T:
405
406 case SCH_SCREEN_T:
407 case SCHEMATIC_T:
408
409 case LIB_SYMBOL_T:
410 case LIB_SHAPE_T:
411 case LIB_TEXT_T:
412 case LIB_TEXTBOX_T:
413 case LIB_PIN_T:
414
415 case LIB_FIELD_T:
416 return true;
417
418 default:
419 return false;
420 }
421}

References LIB_FIELD_T, LIB_PIN_T, LIB_SHAPE_T, LIB_SYMBOL_T, LIB_TEXT_T, LIB_TEXTBOX_T, SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_FIELD_LOCATE_DATASHEET_T, SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_FIELD_LOCATE_REFERENCE_T, SCH_FIELD_LOCATE_VALUE_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_ITEM_LOCATE_BUS_T, SCH_ITEM_LOCATE_GRAPHIC_LINE_T, SCH_ITEM_LOCATE_WIRE_T, SCH_JUNCTION_T, SCH_LABEL_LOCATE_ANY_T, SCH_LABEL_LOCATE_BUS_T, SCH_LABEL_LOCATE_WIRE_T, SCH_LABEL_T, SCH_LINE_T, SCH_LOCATE_ANY_T, SCH_MARKER_T, SCH_NO_CONNECT_T, SCH_PIN_T, SCH_SCREEN_T, SCH_SHAPE_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_LOCATE_POWER_T, SCH_SYMBOL_T, SCH_TEXT_T, SCH_TEXTBOX_T, and SCHEMATIC_T.

Referenced by TEST_EE_ITEM_FIXTURE::Instantiate(), IsTypeAvailable(), and IsTypeCorrect().

◆ IsGerbviewType()

constexpr bool IsGerbviewType ( const KICAD_T  aType)
constexpr

Definition at line 482 of file typeinfo.h.

483{
484 switch( aType )
485 {
486 case GERBER_LAYOUT_T:
488 case GERBER_IMAGE_T:
489 return true;
490
491 default:
492 return false;
493 }
494}

References GERBER_DRAW_ITEM_T, GERBER_IMAGE_T, and GERBER_LAYOUT_T.

Referenced by IsTypeAvailable(), and IsTypeCorrect().

◆ IsInstantiableType()

constexpr bool IsInstantiableType ( const KICAD_T  aType)
constexpr

Definition at line 311 of file typeinfo.h.

312{
313 if( IsNullType( aType ) )
314 return false;
315
316 switch( aType )
317 {
318 case SCH_LOCATE_ANY_T:
319
324
328
332
334
341 case PCB_LOCATE_PTH_T:
344
351
352 case PCB_DIMENSION_T:
353
354 case SCH_SCREEN_T:
355 case PCB_ITEM_LIST_T:
356 return false;
357
358 default:
359 break;
360 }
361
362 return true;
363
364}
constexpr bool IsNullType(const KICAD_T aType)
Definition: typeinfo.h:306

References IsNullType(), PCB_DIMENSION_T, PCB_ITEM_LIST_T, PCB_LOCATE_BBVIA_T, PCB_LOCATE_BOARD_EDGE_T, PCB_LOCATE_GRAPHIC_T, PCB_LOCATE_HOLE_T, PCB_LOCATE_NPTH_T, PCB_LOCATE_PTH_T, PCB_LOCATE_STDVIA_T, PCB_LOCATE_TEXT_T, PCB_LOCATE_UVIA_T, PCB_SHAPE_LOCATE_ARC_T, PCB_SHAPE_LOCATE_BEZIER_T, PCB_SHAPE_LOCATE_CIRCLE_T, PCB_SHAPE_LOCATE_POLY_T, PCB_SHAPE_LOCATE_RECT_T, PCB_SHAPE_LOCATE_SEGMENT_T, SCH_FIELD_LOCATE_DATASHEET_T, SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_FIELD_LOCATE_REFERENCE_T, SCH_FIELD_LOCATE_VALUE_T, SCH_ITEM_LOCATE_BUS_T, SCH_ITEM_LOCATE_GRAPHIC_LINE_T, SCH_ITEM_LOCATE_WIRE_T, SCH_LABEL_LOCATE_ANY_T, SCH_LABEL_LOCATE_BUS_T, SCH_LABEL_LOCATE_WIRE_T, SCH_LOCATE_ANY_T, SCH_SCREEN_T, and SCH_SYMBOL_LOCATE_POWER_T.

Referenced by TEST_EE_ITEM_FIXTURE::Instantiate(), TEST_BOARD_ITEM_FIXTURE::Instantiate(), and IsTypeAvailable().

◆ IsMiscType()

constexpr bool IsMiscType ( const KICAD_T  aType)
constexpr

Definition at line 516 of file typeinfo.h.

517{
518 switch( aType )
519 {
520 case SCREEN_T:
521
523 case FP_LIB_TABLE_T:
524 case SYMBOL_LIBS_T:
525 case SEARCH_STACK_T:
526 case S3D_CACHE_T:
527 return true;
528
529 default:
530 return false;
531 }
532}

References FP_LIB_TABLE_T, S3D_CACHE_T, SCREEN_T, SEARCH_STACK_T, SYMBOL_LIB_TABLE_T, and SYMBOL_LIBS_T.

Referenced by IsTypeCorrect().

◆ IsNullType()

constexpr bool IsNullType ( const KICAD_T  aType)
constexpr

Definition at line 306 of file typeinfo.h.

307{
308 return aType <= 0;
309}

Referenced by IsInstantiableType(), and IsTypeCorrect().

◆ IsPageLayoutEditorType()

constexpr bool IsPageLayoutEditorType ( const KICAD_T  aType)
constexpr

Definition at line 496 of file typeinfo.h.

497{
498 switch( aType )
499 {
500 case WSG_LINE_T:
501 case WSG_RECT_T:
502 case WSG_POLY_T:
503 case WSG_TEXT_T:
504 case WSG_BITMAP_T:
505 case WSG_PAGE_T:
506
509 return true;
510
511 default:
512 return false;
513 }
514}

References WS_PROXY_UNDO_ITEM_PLUS_T, WS_PROXY_UNDO_ITEM_T, WSG_BITMAP_T, WSG_LINE_T, WSG_PAGE_T, WSG_POLY_T, WSG_RECT_T, and WSG_TEXT_T.

Referenced by IsTypeAvailable(), and IsTypeCorrect().

◆ IsPcbnewType()

constexpr bool IsPcbnewType ( const KICAD_T  aType)
constexpr

Definition at line 423 of file typeinfo.h.

424{
425 switch( aType )
426 {
427 case PCB_T:
428
429 case PCB_FOOTPRINT_T:
430 case PCB_PAD_T:
431 case PCB_SHAPE_T:
432 case PCB_BITMAP_T:
433 case PCB_TEXT_T:
434 case PCB_TEXTBOX_T:
435 case PCB_FP_TEXT_T:
436 case PCB_FP_TEXTBOX_T:
437 case PCB_FP_SHAPE_T:
443 case PCB_FP_ZONE_T:
444 case PCB_TRACE_T:
445 case PCB_VIA_T:
446 case PCB_ARC_T:
447 case PCB_MARKER_T:
448 case PCB_DIMENSION_T:
450 case PCB_DIM_LEADER_T:
451 case PCB_DIM_CENTER_T:
452 case PCB_DIM_RADIAL_T:
454 case PCB_TARGET_T:
455 case PCB_ZONE_T:
456 case PCB_ITEM_LIST_T:
457 case PCB_NETINFO_T:
458 case PCB_GROUP_T:
459
466 case PCB_LOCATE_PTH_T:
475 return true;
476
477 default:
478 return false;
479 }
480}

References PCB_ARC_T, PCB_BITMAP_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_DIMENSION_T, PCB_FOOTPRINT_T, PCB_FP_DIM_ALIGNED_T, PCB_FP_DIM_CENTER_T, PCB_FP_DIM_LEADER_T, PCB_FP_DIM_ORTHOGONAL_T, PCB_FP_DIM_RADIAL_T, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_FP_TEXTBOX_T, PCB_FP_ZONE_T, PCB_GROUP_T, PCB_ITEM_LIST_T, PCB_LOCATE_BBVIA_T, PCB_LOCATE_BOARD_EDGE_T, PCB_LOCATE_GRAPHIC_T, PCB_LOCATE_HOLE_T, PCB_LOCATE_NPTH_T, PCB_LOCATE_PTH_T, PCB_LOCATE_STDVIA_T, PCB_LOCATE_TEXT_T, PCB_LOCATE_UVIA_T, PCB_MARKER_T, PCB_NETINFO_T, PCB_PAD_T, PCB_SHAPE_LOCATE_ARC_T, PCB_SHAPE_LOCATE_BEZIER_T, PCB_SHAPE_LOCATE_CIRCLE_T, PCB_SHAPE_LOCATE_POLY_T, PCB_SHAPE_LOCATE_RECT_T, PCB_SHAPE_LOCATE_SEGMENT_T, PCB_SHAPE_T, PCB_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TRACE_T, PCB_VIA_T, and PCB_ZONE_T.

Referenced by TEST_BOARD_ITEM_FIXTURE::Instantiate(), IsTypeAvailable(), and IsTypeCorrect().

◆ IsTypeAvailable()

constexpr bool IsTypeAvailable ( KICAD_T  aType)
constexpr

Definition at line 544 of file typeinfo.h.

545{
546 if( !IsInstantiableType( aType ) )
547 return false;
548
549 if( IsEeschemaType( aType ) )
550 {
551#ifdef EESCHEMA
552 return true;
553#endif // EESCHEMA
554 }
555
556 if( IsPcbnewType( aType ) )
557 {
558#ifdef PCBNEW
559 return true;
560#endif // PCBNEW
561 }
562
563 if( IsGerbviewType( aType ) )
564 {
565#ifdef GERBVIEW
566 return true;
567#endif // GERBVIEW
568 }
569
570 if( IsPageLayoutEditorType( aType ) )
571 {
572#ifdef PL_EDITOR
573 return true;
574#endif // PL_EDITOR
575 }
576
577 return false;
578}
constexpr bool IsGerbviewType(const KICAD_T aType)
Definition: typeinfo.h:482
constexpr bool IsPcbnewType(const KICAD_T aType)
Definition: typeinfo.h:423
constexpr bool IsInstantiableType(const KICAD_T aType)
Definition: typeinfo.h:311
constexpr bool IsEeschemaType(const KICAD_T aType)
Definition: typeinfo.h:366
constexpr bool IsPageLayoutEditorType(const KICAD_T aType)
Definition: typeinfo.h:496

References IsEeschemaType(), IsGerbviewType(), IsInstantiableType(), IsPageLayoutEditorType(), and IsPcbnewType().

◆ IsTypeCorrect()

constexpr bool IsTypeCorrect ( KICAD_T  aType)
constexpr

Definition at line 534 of file typeinfo.h.

535{
536 return IsNullType( aType )
537 || IsEeschemaType( aType )
538 || IsPcbnewType( aType )
539 || IsGerbviewType( aType )
540 || IsPageLayoutEditorType( aType )
541 || IsMiscType( aType );
542}
constexpr bool IsMiscType(const KICAD_T aType)
Definition: typeinfo.h:516

References IsEeschemaType(), IsGerbviewType(), IsMiscType(), IsNullType(), IsPageLayoutEditorType(), and IsPcbnewType().

Referenced by BOOST_AUTO_TEST_CASE().