Horizon
object_descr.hpp
1#pragma once
2#include "common.hpp"
3#include <map>
4
5namespace horizon {
7public:
8 enum class Type {
9 BOOL,
10 INT,
11 STRING,
12 STRING_RO,
13 STRING_MULTILINE,
14 LENGTH,
15 LAYER,
16 LAYER_COPPER,
17 NET_CLASS,
18 ENUM,
19 DIM,
20 ANGLE,
21 ANGLE90,
22 GROUP,
23 TAG,
24 EXPAND,
25 OPACITY,
26 PRIORITY,
27 SCALE,
28 };
29 enum class ID {
30 NAME,
31 NAME_VISIBLE,
32 PAD_VISIBLE,
33 LENGTH,
34 SIZE,
35 TEXT,
36 REFDES,
37 VALUE,
38 IS_POWER,
39 OFFSHEET_REFS,
40 WIDTH,
41 HEIGHT,
42 FORM,
43 LAYER,
44 DIAMETER,
45 PLATED,
46 FLIPPED,
47 NET_CLASS,
48 WIDTH_FROM_RULES,
49 MPN,
50 SHAPE,
51 PARAMETER_CLASS,
52 POSITION_X,
53 POSITION_Y,
54 ANGLE,
55 MIRROR,
56 PAD_TYPE,
57 FROM_RULES,
58 DISPLAY_DIRECTIONS,
59 USAGE,
60 MODE,
61 DIFFPAIR,
62 LOCKED,
63 DOT,
64 CLOCK,
65 SCHMITT,
66 DRIVER,
67 ALTERNATE_PACKAGE,
68 POWER_SYMBOL_STYLE,
69 PIN_NAME_DISPLAY,
70 PIN_NAME_ORIENTATION,
71 FONT,
72 KEEPOUT_CLASS,
73 DISPLAY_ALL_PADS,
74 GROUP,
75 TAG,
76 EXPAND,
77 OMIT_SILKSCREEN,
78 FIXED,
79 NOPOPULATE,
80 OMIT_OUTLINE,
81 ON_TOP,
82 OPACITY,
83 PRIORITY,
84 SCALE,
85 ALLOW_UPSIDE_DOWN,
86 DIRECTION,
87 IS_PORT,
88 };
89 ObjectProperty(Type t, const std::string &l, int o = 0, const std::vector<std::pair<int, std::string>> &its = {})
90 : type(t), label(l), enum_items(its), order(o)
91 {
92 }
93
94 Type type;
95 std::string label;
96 std::vector<std::pair<int, std::string>> enum_items;
97 int order = 0;
98};
99
101public:
102 ObjectDescription(const std::string &n, const std::string &n_pl,
103 const std::map<ObjectProperty::ID, ObjectProperty> &props)
104 : name(n), name_pl(n_pl), properties(props)
105 {
106 }
107
108 std::string name;
109 std::string name_pl;
110 const std::map<ObjectProperty::ID, ObjectProperty> properties;
111
112 const std::string &get_name_for_n(size_t n) const;
113};
114
115extern const std::map<ObjectType, ObjectDescription> object_descriptions;
116} // namespace horizon
An abstract shape on 2D plane.
Definition: shape.h:117
Definition: object_descr.hpp:100
Definition: object_descr.hpp:6