48 # define __STRINGIZE(X) #X 49 # define DATA __STRINGIZE(DATAC) 89 {
c_red, {
"red",
"scarlet"},0},
90 {
c_blue, {
"blue",
"navy",
"sad"},0},
102 {
c_red, {
"rojo",
"escarlata",
"sangre"},0},
103 {
c_blue, {
"azul",
"piscina",
"mar",
"cielo"},0},
114 int red, green, blue;
125 {
c_unknown, {
"kinda grey"}, {0x7f, 0x7f, 0x7f}},
126 {
c_red, {
"red",
"scarlet"}, {0xff, 0, 0}},
127 {
c_blue, {
"blue",
"navy",
"sad"}, {0, 0, 0xff}},
142 n = ColourMap.
name(c1);
143 cout <<
"c1 is " << (n?n:
"[NULL]") <<
"\n";
145 n = ColourMap.
name(c2);
146 cout <<
"c2 is " << (n?n:
"[NULL]") <<
"\n";
150 const char *colours[] = {
"red",
"navy",
"puce"};
151 for(
int i=0; i<3; i++)
157 const char *nm= colours[i];
159 colour_info &info = RGBColourMap.
info(c);
160 const char *spanish = SpanishColourMap.name(c);
162 cout << nm <<
" is " << (
int)c
163 <<
" = " << ColourMap.
name(c)
164 <<
" (" << (spanish?spanish:
"[NULL]") <<
" in Spanish)" 167 << info.green <<
", " 180 cout <<
"\n\nname map write failed\n";
183 cout <<
"\n\ncolour name map\n";
185 if (system(
"cat tmp/colour.map") != 0) {
186 cerr <<
"Error printing file to screen" << endl;
202 if (SpanishColourMap.save(
"tmp/colour_spanish.map", ColourMap) !=
write_ok)
203 cout <<
"\n\nname map write failed\n";
206 cout <<
"\n\ncolour name map (spanish)\n";
208 if (system(
"cat tmp/colour_spanish.map") != 0) {
209 cerr <<
"Error printing file to screen" << endl;
220 cout <<
"\n\nname map read failed\n";
223 cout <<
"\n\nread in table\n";
224 LoadedColourMap.
save(
"tmp/tmp.map");
226 if(system(
"cat tmp/tmp.map") != 0) {
227 cerr <<
"Error printing file to screen" << endl;
234 if (LoadedColourMap.
load(DATA
"/colours_translation.map", ColourMap) !=
format_ok)
235 cout <<
"\n\nname map read failed\n";
238 cout <<
"\n\nread in table (translation)\n";
240 LoadedColourMap.
save(
"tmp/tmp.map");
242 if (system(
"cat tmp/tmp.map") != 0) {
243 cerr <<
"Error printing file to screen" << endl;
261 #if defined(INSTANTIATE_TEMPLATES) 262 #include "../base_class/EST_TNamedEnum.cc" #define End_TNamedEnum(ENUM, NAME)
#define End_TNamedEnumI(ENUM, INFO, NAME)
ENUM token(const char *value) const
Start_TNamedEnum(Colour, ColourMap)
int main(int argc, char **argv)
const char * name(ENUM tok, int n=0) const
The file was written successfully.
#define Declare_TNamedEnumI(ENUM, INFO)
EST_TNamedEnumI< Colour, colour_info > RGBColourMap
#define Instantiate_TNamedEnumI(ENUM, INFO)
#define Declare_TNamedEnum(ENUM)
EST_read_status load(EST_String name)
INFO & info(ENUM token) const
EST_TNamedEnum< Colour > ColourMap
EST_write_status save(EST_String name, char quote='"') const
#define Instantiate_TNamedEnum(ENUM)
Start_TNamedEnumI(Colour, colour_info, RGBColourMap)