38 #else // WIN32 |
38 #else // WIN32 |
39 # define DIRSLASH "/" |
39 # define DIRSLASH "/" |
40 # define DIRSLASH_CHAR '/' |
40 # define DIRSLASH_CHAR '/' |
41 #endif // WIN32 |
41 #endif // WIN32 |
42 |
42 |
43 #define dvalof(A) dprint ("value of '%1' = %2\n", #A, A) |
43 #define printValueOf(A) dprint ("value of '%1' = %2\n", #A, A) |
44 #define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z})) |
44 #define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z})) |
45 |
45 |
46 #define MAKE_ITERABLE_ENUM(T, FIRST, LAST) \ |
46 #define MAKE_ITERABLE_ENUM(T, FIRST, LAST) \ |
47 template<> \ |
47 template<> \ |
48 struct EnumLimits<T> \ |
48 struct EnumLimits<T> \ |
61 |
61 |
62 #define DEFINE_FLAG_ACCESS_METHODS \ |
62 #define DEFINE_FLAG_ACCESS_METHODS \ |
63 bool checkFlag(Flag flag) const { return !!(m_flags & flag); } \ |
63 bool checkFlag(Flag flag) const { return !!(m_flags & flag); } \ |
64 void setFlag(Flag flag) { m_flags |= flag; } \ |
64 void setFlag(Flag flag) { m_flags |= flag; } \ |
65 void unsetFlag(Flag flag) { m_flags &= ~flag; } |
65 void unsetFlag(Flag flag) { m_flags &= ~flag; } |
66 |
|
67 // once-statement |
|
68 struct OnceGuard |
|
69 { |
|
70 bool triggered; |
|
71 OnceGuard() : triggered (false) {} |
|
72 |
|
73 bool pass() |
|
74 { |
|
75 if (triggered) |
|
76 { |
|
77 return false; |
|
78 } |
|
79 else |
|
80 { |
|
81 triggered = true; |
|
82 return true; |
|
83 } |
|
84 } |
|
85 }; |
|
86 |
|
87 #define TEE_2(A,B) A ## B |
|
88 #define TEE(A,B) TEE_2(A,B) |
|
89 #define once static OnceGuard TEE(_once_, __LINE__); if (TEE(_once_, __LINE__).pass()) |
|