-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCColorset.cpp
165 lines (148 loc) · 3.57 KB
/
CColorset.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#include "CColorset.h"
#include <stdarg.h>
CColorset::CColorset(string a_name, string a_type, int a_int_min, int a_int_max)
{
name = a_name;
type = a_type; //"int"
int_min = a_int_min;
int_max = a_int_max;
}
CColorset::CColorset(string a_name, string a_type)
{
name = a_name;
type = a_type; //"string"
int_min = -1;
int_max = -1;
}
CColorset::CColorset(string a_name, string a_type, string a_nickname, int a_int_min, int a_int_max)
{
name = a_name;
type = a_type; //"index"
nickname = a_nickname;
int_min = a_int_min;
int_max = a_int_max;
}
CColorset::CColorset(string a_name, string a_type, vector<CColorset*> a_itemColorsets)
{
name = a_name;
type = a_type; //"item"
itemColorsets = a_itemColorsets;
int_min = -1;
int_max = -1;
}
CColorset::CColorset(string a_name, string a_type, CColorset *itemColorset1)
{
name = a_name;
type = a_type; //"item"
itemColorsets.push_back(itemColorset1);
int_min = -1;
int_max = -1;
}
CColorset::CColorset(string a_name, string a_type, CColorset *itemColorset1, CColorset *itemColorset2)
{
name = a_name;
type = a_type; //"item"
itemColorsets.push_back(itemColorset1);
itemColorsets.push_back(itemColorset2);
int_min = -1;
int_max = -1;
}
CColorset::CColorset(string a_name, string a_type, CColorset *itemColorset1, CColorset *itemColorset2, CColorset *itemColorset3)
{
name = a_name;
type = a_type; //"item"
itemColorsets.push_back(itemColorset1);
itemColorsets.push_back(itemColorset2);
itemColorsets.push_back(itemColorset3);
int_min = -1;
int_max = -1;
}
CColorset::CColorset(string a_name, string a_type, vector<string> a_enumValues)
{
name = a_name;
type = a_type; //"enum"
enumValues = a_enumValues;
int_min = -1;
int_max = -1;
}
CColorset::CColorset(string a_name, string a_type, string enumValue1)
{
name = a_name;
type = a_type; //"enum"
enumValues.push_back(enumValue1);
int_min = -1;
int_max = -1;
}
CColorset::CColorset(string a_name, string a_type, string enumValue1, string enumValue2)
{
name = a_name;
type = a_type; //"enum"
enumValues.push_back(enumValue1);
enumValues.push_back(enumValue2);
int_min = -1;
int_max = -1;
}
CColorset::CColorset(string a_name, string a_type, string enumValue1, string enumValue2, string enumValue3)
{
name = a_name;
type = a_type; //"enum"
enumValues.push_back(enumValue1);
enumValues.push_back(enumValue2);
enumValues.push_back(enumValue3);
int_min = -1;
int_max = -1;
}
CColorset::CColorset(string a_name, string a_type, int argCount, ...)
{
name = a_name;
type = a_type; //"item" | "enum"
int_min = -1;
int_max = -1;
if (a_type == "item")
{
va_list arg_ptr;
va_start(arg_ptr, argCount);
for (int i = 0; i < argCount; i ++)
{
CColorset *itemColorset = (CColorset *) va_arg(arg_ptr, int);
itemColorsets.push_back(itemColorset);
}
va_end(arg_ptr);
}
else if (a_type == "enum")
{
va_list arg_ptr;
va_start(arg_ptr, argCount);
for (int i = 0; i < argCount; i ++)
{
string_wrapper *enumValue = (string_wrapper *) va_arg(arg_ptr, int);
enumValues.push_back(enumValue->str);
delete enumValue;
}
va_end(arg_ptr);
}
else
{
cout << "CColorset Error." << endl;
}
}
CColorset* CColorset::int_colorset()
{
CColorset *colorset = new CColorset("INT", "int", 0, 65535);
return colorset;
}
CColorset* CColorset::uint_colorset()
{
CColorset *colorset = new CColorset("INT", "int", -32768, 32767);
return colorset;
}
CColorset* CColorset::bool_colorset()
{
CColorset *colorset = new CColorset("INT", "int", 0, 1);
return colorset;
}
CColorset* CColorset::string_colorset()
{
CColorset *colorset = new CColorset("STRING", "string");
return colorset;
}