Horizon
object_descr.hpp
1 #pragma once
2 #include "common.hpp"
3 #include <map>
4 
5 namespace horizon {
7 public:
8  enum class Type { BOOL, INT, STRING, STRING_RO, LENGTH, LAYER, LAYER_COPPER, NET_CLASS, ENUM, DIM, ANGLE, ANGLE90 };
9  enum class ID {
10  NAME,
11  NAME_VISIBLE,
12  PAD_VISIBLE,
13  LENGTH,
14  SIZE,
15  TEXT,
16  REFDES,
17  VALUE,
18  IS_POWER,
19  OFFSHEET_REFS,
20  WIDTH,
21  HEIGHT,
22  FORM,
23  LAYER,
24  DIAMETER,
25  PLATED,
26  FLIPPED,
27  NET_CLASS,
28  WIDTH_FROM_RULES,
29  MPN,
30  SHAPE,
31  PARAMETER_CLASS,
32  POSITION_X,
33  POSITION_Y,
34  ANGLE,
35  MIRROR,
36  PAD_TYPE,
37  FROM_RULES,
38  DISPLAY_DIRECTIONS,
39  USAGE,
40  MODE,
41  DIFFPAIR,
42  LOCKED,
43  DOT,
44  CLOCK,
45  SCHMITT,
46  DRIVER,
47  ALTERNATE_PACKAGE,
48  POWER_SYMBOL_STYLE,
49  PIN_NAME_DISPLAY,
50  PIN_NAME_ORIENTATION,
51  FONT,
52  KEEPOUT_CLASS,
53  DISPLAY_ALL_PADS
54  };
55  ObjectProperty(Type t, const std::string &l, int o = 0, const std::vector<std::pair<int, std::string>> &its = {})
56  : type(t), label(l), enum_items(its), order(o)
57  {
58  }
59 
60  Type type;
61  std::string label;
62  std::vector<std::pair<int, std::string>> enum_items;
63  int order = 0;
64 };
65 
67 public:
68  ObjectDescription(const std::string &n, const std::string &n_pl,
69  const std::map<ObjectProperty::ID, ObjectProperty> &props)
70  : name(n), name_pl(n_pl), properties(props)
71  {
72  }
73 
74  std::string name;
75  std::string name_pl;
76  const std::map<ObjectProperty::ID, ObjectProperty> properties;
77 
78  const std::string &get_name_for_n(size_t n) const;
79 };
80 
81 extern const std::map<ObjectType, ObjectDescription> object_descriptions;
82 } // namespace horizon
Definition: object_descr.hpp:66
Class SHAPE.
Definition: shape.h:58
Definition: object_descr.hpp:6
Definition: block.cpp:9