src/ldObject.h

changeset 1123
15e46ea3151f
parent 1117
efcb47c64a72
child 1135
8e0691be0b6f
equal deleted inserted replaced
1122:795d1c3554b9 1123:15e46ea3151f
25 25
26 class Model; 26 class Model;
27 27
28 #define LDOBJ(T) \ 28 #define LDOBJ(T) \
29 public: \ 29 public: \
30 static constexpr LDObjectType SubclassType = OBJ_##T; \ 30 static constexpr LDObjectType SubclassType = LDObjectType::T; \
31 \ 31 \
32 virtual LDObjectType type() const override \ 32 virtual LDObjectType type() const override \
33 { \ 33 { \
34 return OBJ_##T; \ 34 return SubclassType; \
35 } \ 35 } \
36 \ 36 \
37 virtual QString asText() const override; \ 37 virtual QString asText() const override; \
38 virtual void invert() override; \ 38 virtual void invert() override; \
39 protected: \ 39 protected: \
64 // 64 //
65 // Object type codes. 65 // Object type codes.
66 // 66 //
67 enum LDObjectType 67 enum LDObjectType
68 { 68 {
69 OBJ_SubfileReference, // Object represents a sub-file reference 69 SubfileReference, // Object represents a sub-file reference
70 OBJ_Quad, // Object represents a quadrilateral 70 Quad, // Object represents a quadrilateral
71 OBJ_Triangle, // Object represents a triangle 71 Triangle, // Object represents a triangle
72 OBJ_Line, // Object represents a line 72 Line, // Object represents a line
73 OBJ_CondLine, // Object represents a conditional line 73 CondLine, // Object represents a conditional line
74 OBJ_Bfc, // Object represents a BFC statement 74 Bfc, // Object represents a BFC statement
75 OBJ_Overlay, // Object contains meta-info about an overlay image. 75 Comment, // Object represents a comment
76 OBJ_Comment, // Object represents a comment 76 Error, // Object is the result of failed parsing
77 OBJ_Error, // Object is the result of failed parsing 77 Empty, // Object represents an empty line
78 OBJ_Empty, // Object represents an empty line 78 BezierCurve, // Object represents a Bézier curve
79 OBJ_BezierCurve, // Object represents a Bézier curve 79 _End
80 80 };
81 OBJ_NumTypes, // Amount of object types 81
82 OBJ_FirstType = OBJ_SubfileReference 82 MAKE_ITERABLE_ENUM(LDObjectType)
83 };
84
85 MAKE_ITERABLE_ENUM (LDObjectType, OBJ_SubfileReference, OBJ_BezierCurve)
86 83
87 // 84 //
88 // LDObject 85 // LDObject
89 // 86 //
90 // Base class object for all object types. Each LDObject represents a single line 87 // Base class object for all object types. Each LDObject represents a single line
212 209
213 // 210 //
214 // 211 //
215 // Represents a 0 BFC statement in the LDraw code. 212 // Represents a 0 BFC statement in the LDraw code.
216 // 213 //
217 enum BfcStatement 214 enum class BfcStatement
218 { 215 {
219 CertifyCCW, 216 CertifyCCW,
220 CCW, 217 CCW,
221 CertifyCW, 218 CertifyCW,
222 CW, 219 CW,
224 InvertNext, 221 InvertNext,
225 Clip, 222 Clip,
226 ClipCCW, 223 ClipCCW,
227 ClipCW, 224 ClipCW,
228 NoClip, 225 NoClip,
229 }; 226 _End
230 227 };
231 MAKE_ITERABLE_ENUM(BfcStatement, CertifyCCW, NoClip) 228
229 MAKE_ITERABLE_ENUM(BfcStatement)
232 230
233 class LDBfc : public LDObject 231 class LDBfc : public LDObject
234 { 232 {
235 public: 233 public:
236 LDOBJ (Bfc) 234 LDOBJ (Bfc)

mercurial