53 * passed by value to functions instead of l-value reference. |
53 * passed by value to functions instead of l-value reference. |
54 */ |
54 */ |
55 struct ldraw::Color |
55 struct ldraw::Color |
56 { |
56 { |
57 qint32 index = 0; |
57 qint32 index = 0; |
|
58 constexpr auto operator<=>(const Color&) const = default; |
58 }; |
59 }; |
59 |
60 |
60 Q_DECLARE_METATYPE(ldraw::Color) |
61 Q_DECLARE_METATYPE(ldraw::Color) |
61 QDataStream& operator<<(QDataStream&, ldraw::Color); |
62 QDataStream& operator<<(QDataStream&, ldraw::Color); |
62 QDataStream& operator>>(QDataStream&, ldraw::Color&); |
63 QDataStream& operator>>(QDataStream&, ldraw::Color&); |
63 |
64 |
64 namespace ldraw |
65 namespace ldraw |
65 { |
66 { |
66 constexpr bool operator==(Color one, Color other) |
|
67 { |
|
68 return one.index == other.index; |
|
69 } |
|
70 |
|
71 constexpr bool operator!=(Color one, Color other) |
|
72 { |
|
73 return one.index != other.index; |
|
74 } |
|
75 |
|
76 constexpr bool operator<(Color one, Color other) |
|
77 { |
|
78 return one.index < other.index; |
|
79 } |
|
80 |
|
81 constexpr bool operator<=(Color one, Color other) |
|
82 { |
|
83 return one.index <= other.index; |
|
84 } |
|
85 |
|
86 constexpr bool operator>(Color one, Color other) |
|
87 { |
|
88 return one.index > other.index; |
|
89 } |
|
90 |
|
91 constexpr bool operator>=(Color one, Color other) |
|
92 { |
|
93 return one.index >= other.index; |
|
94 } |
|
95 |
|
96 static constexpr Color BLACK {0}; |
67 static constexpr Color BLACK {0}; |
97 static constexpr Color BLUE {1}; |
68 static constexpr Color BLUE {1}; |
98 static constexpr Color GREEN {2}; |
69 static constexpr Color GREEN {2}; |
99 static constexpr Color RED {4}; |
70 static constexpr Color RED {4}; |
100 static constexpr Color YELLOW {14}; |
71 static constexpr Color YELLOW {14}; |