src/colors.h

changeset 35
98906a94732f
parent 26
3a9e761e4faa
child 43
08dc62e03a6d
equal deleted inserted replaced
34:1de2b8d64e9f 35:98906a94732f
18 18
19 #pragma once 19 #pragma once
20 #include <QColor> 20 #include <QColor>
21 #include "main.h" 21 #include "main.h"
22 22
23 struct Color 23 namespace ldraw
24 {
25 struct Color;
26 class ColorTable;
27 }
28
29 struct ldraw::Color
24 { 30 {
25 qint32 index; 31 qint32 index;
26 }; 32 };
27 33
28 class ColorTable 34 class ldraw::ColorTable
29 { 35 {
30 public: 36 public:
31 struct ColorDefinition 37 struct ColorDefinition
32 { 38 {
33 QColor faceColor; 39 QColor faceColor;
41 private: 47 private:
42 void loadColorFromString(const QString& string); 48 void loadColorFromString(const QString& string);
43 QMap<qint32, ColorDefinition> definitions; 49 QMap<qint32, ColorDefinition> definitions;
44 }; 50 };
45 51
46 inline bool operator==(const Color& one, const Color& other) 52 inline bool operator==(const ldraw::Color& one, const ldraw::Color& other)
47 { 53 {
48 return one.index == other.index; 54 return one.index == other.index;
49 } 55 }
50 56
51 inline bool operator!=(const Color& one, const Color& other) 57 inline bool operator!=(const ldraw::Color& one, const ldraw::Color& other)
52 { 58 {
53 return one.index != other.index; 59 return one.index != other.index;
54 } 60 }
55 61
56 inline bool operator<(const Color& one, const Color& other) 62 inline bool operator<(const ldraw::Color& one, const ldraw::Color& other)
57 { 63 {
58 return one.index < other.index; 64 return one.index < other.index;
59 } 65 }
60 66
61 inline bool operator<=(const Color& one, const Color& other) 67 inline bool operator<=(const ldraw::Color& one, const ldraw::Color& other)
62 { 68 {
63 return one.index <= other.index; 69 return one.index <= other.index;
64 } 70 }
65 71
66 inline bool operator>(const Color& one, const Color& other) 72 inline bool operator>(const ldraw::Color& one, const ldraw::Color& other)
67 { 73 {
68 return one.index > other.index; 74 return one.index > other.index;
69 } 75 }
70 76
71 inline bool operator>=(const Color& one, const Color& other) 77 inline bool operator>=(const ldraw::Color& one, const ldraw::Color& other)
72 { 78 {
73 return one.index >= other.index; 79 return one.index >= other.index;
74 } 80 }
75 81
76 namespace colors 82 namespace ldraw
77 { 83 {
78 static constexpr Color black {0}; 84 static constexpr Color black {0};
79 static constexpr Color blue {1}; 85 static constexpr Color blue {1};
80 static constexpr Color green {2}; 86 static constexpr Color green {2};
81 static constexpr Color red {4}; 87 static constexpr Color red {4};
82 static constexpr Color yellow {14}; 88 static constexpr Color yellow {14};
83 static constexpr Color white {15}; 89 static constexpr Color white {15};
84 static constexpr Color main {16}; 90 static constexpr Color mainColor {16};
85 static constexpr Color edge {24}; 91 static constexpr Color edgeColor {24};
86 } 92 }

mercurial