2 public import static "ecere"
7 extern int __ecereVMethodID_class_OnGetString;
9 static String countryNames[CountryCode] =
13 "United Arab Emirates", // 1974
14 "Afghanistan", // 1974
15 "Antigua and Barbuda", // 1974
16 "Anguilla", // 1983 AI previously represented French Afar and Issas
19 "Netherlands Antilles", // 1974
21 "Antarctica", // 1974 Covers the territories south of 60° south latitude
23 "American Samoa", // 1974
25 "Australia", // 1974 Includes the Ashmore and Cartier Islands and the Coral Sea Islands
27 "Åland Islands", // 2004
29 "Bosnia and Herzegovina", // 1992
33 "Burkina Faso", // 1984 Name changed from Upper Volta (HV)
37 "Benin", // 1977 Name changed from Dahomey (DY)
38 "Saint Barthélemy", // 2007
40 "Brunei Darussalam", // 1974
41 "Bolivia, Plurinational State of", // 1974 Previous country name used by ISO: Bolivia
45 "Bouvet Island", // 1974
47 "Belarus", // 1974 Code taken from previous country name used by ISO: Byelorussian SSR
50 "Cocos (Keeling) Islands", // 1974
51 "Congo, the Democratic Republic of the", // 1997 Name changed from Zaire (ZR)
52 "Central African Republic", // 1974
53 "Congo", // 1974 i.e., Congo, the Republic of the
54 "Switzerland", // 1974 Code taken from name in Latin: Confoederatio Helvetica
55 "Côte d'Ivoire", // 1974 i.e., Ivory Coast
56 "Cook Islands", // 1974
64 "Christmas Island", // 1974
66 "Czech Republic", // 1993
67 "Germany", // 1974 Code taken from name in German: Deutschland, Code used for West Germany before , // 1990 (previous country name used by ISO: Germany, Federal Republic of)
68 "Djibouti", // 1977 Name changed from French Afar and Issas (AI)
71 "Dominican Republic", // 1974
72 "Algeria", // 1974 Code taken from name in Kabyle: Dzayer
74 "Estonia", // 1992 Code taken from name in Estonian: Eesti
76 "Western Sahara", // 1974 Disputed territory Previous country name used by ISO: Spanish Sahara (code taken from name in Spanish: Sahara español)
78 "Spain", // 1974 Code taken from name in Spanish: España
82 "Falkland Islands (Malvinas)", // 1974
83 "Micronesia, Federated States of", // 1986 Previous country name used by ISO: Micronesia
84 "Faroe Islands", // 1974
85 "France", // 1974 Includes Clipperton Island
87 "United Kingdom", // 1974 Code taken from official name: United Kingdom of Great Britain and Northern Ireland
89 "Georgia", // 1992 GE previously represented Gilbert and Ellice Islands
90 "French Guiana", // 1974 Code taken from name in French: Guyane française
98 "Equatorial Guinea", // 1974 Code taken from name in French: Guinée équatoriale
100 "South Georgia and the South Sandwich Islands", // 1993
103 "Guinea-Bissau", // 1974
106 "Heard Island and McDonald Islands", // 1974
108 "Croatia", // 1992 Code taken from name in Croatian: Hrvatska
114 "Isle of Man", // 2006
116 "British Indian Ocean Territory", // 1974
118 "Iran, Islamic Republic of", // 1974
119 "Iceland", // 1974 Code taken from name in Icelandic: Ísland
126 "Kyrgyzstan", // 1992
127 "Cambodia", // 1974 Code taken from former name: Khmer Republic, Previous country name used by ISO: Kampuchea
129 "Comoros", // 1974 Code taken from name in Comorian: Komori
130 "Saint Kitts and Nevis", // 1974 Previous country name used by ISO: Saint Kitts-Nevis-Anguilla
131 "Korea, Democratic People's Republic of", // 1974 i.e., North Korea
132 "Korea, Republic of", // 1974 i.e., South Korea
134 "Cayman Islands", // 1974
135 "Kazakhstan", // 1992 Previous country name used by ISO: Kazakstan
136 "Lao People's Democratic Republic", // 1974
138 "Saint Lucia", // 1974
139 "Liechtenstein", // 1974
144 "Luxembourg", // 1974
146 "Libyan Arab Jamahiriya", // 1974
147 "Morocco", // 1974 Code taken from name in French: Maroc
149 "Moldova, Republic of", // 1992 Previous country name used by ISO: Moldova
150 "Montenegro", // 2006
151 "Saint Martin (French part)", //2007
152 "Madagascar", // 1974
153 "Marshall Islands", // 1986
154 "Macedonia, the former Yugoslav Republic of", // 1993 Designated as such due to the Macedonia naming dispute, Code taken from name in Macedonian: Makedonija
156 "Myanmar", // 1989 Name changed from Burma (BU)
158 "Macao", // 1974 Previous country name used by ISO: Macau
159 "Northern Mariana Islands", // 1986
160 "Martinique", // 1974
161 "Mauritania", // 1974
162 "Montserrat", // 1974
169 "Mozambique", // 1974
171 "New Caledonia", // 1974
173 "Norfolk Island", // 1974
176 "Netherlands", // 1974
181 "New Zealand", // 1974
185 "French Polynesia", // 1974 Code taken from name in French: Polynésie française
186 "Papua New Guinea", // 1974
187 "Philippines", // 1974
190 "Saint Pierre and Miquelon", // 1974
192 "Puerto Rico", // 1974
193 "Palestinian Territory, Occupied", // 1999 Consists of the West Bank and the Gaza Strip
200 "Serbia", // 2006 Code taken from official name: Republic of Serbia (see Serbian country codes)
201 "Russian Federation", // 1992
203 "Saudi Arabia", // 1974
204 "Solomon Islands", // 1974 Code taken from former name: British Solomon Islands
205 "Seychelles", // 1974
209 "Saint Helena, Ascension and Tristan da Cunha", // 1974 Previous country name used by ISO: Saint Helena
211 "Svalbard and Jan Mayen", // 1974 Consists of Svalbard and Jan Mayen
212 "Slovakia", // 1993 SK previously represented Sikkim
213 "Sierra Leone", // 1974
214 "San Marino", // 1974
218 "Sao Tome and Principe", // 1974
219 "El Salvador", // 1974
220 "Syrian Arab Republic", // 1974
222 "Turks and Caicos Islands", // 1974
223 "Chad", // 1974 Code taken from name in French: Tchad
224 "French Southern Territories", // 1979 Covers the territory of the French Southern and Antarctic Lands except Adélie Land, Code taken from name in French: Terres australes françaises
227 "Tajikistan", // 1992
229 "Timor-Leste", // 2002 Name changed from East Timor (TP)
230 "Turkmenistan", // 1992
234 "Trinidad and Tobago", // 1974
236 "Taiwan, Province of China", // 1974 Covers the current jurisdiction of the Republic of China except Kinmen and Lienchiang, Designated as such due to its political status within the United Nations
237 "Tanzania, United Republic of", // 1974
238 "Ukraine", // 1974 Previous country name used by ISO: Ukrainian SSR
241 "United States Minor Outlying Islands", // 1986 Consists of Baker Island, Howland Island, Jarvis Island, Johnston Atoll, Kingman Reef, Midway Islands, Navassa Island, Palmyra Atoll, and Wake Island
242 "United States", // 1974
244 "Uzbekistan", // 1992
245 "Holy See (Vatican City State)", // 1974 Territory of the Holy See Previous country name used by ISO: Vatican City State (Holy See)
246 "Saint Vincent and the Grenadines", // 1974
247 "Venezuela, Bolivarian Republic of", // 1974 Previous country name used by ISO: Venezuela
248 "Virgin Islands, British", // 1974
249 "Virgin Islands, U.S.", // 1974
251 "Vanuatu", // 1980 Name changed from New Hebrides (NH)
252 "Wallis and Futuna", // 1974
253 "Samoa", // 1974 Code taken from former name: Western Samoa
254 "Yemen", // 1974 Previous country name used by ISO: Yemen, Republic of, Code used for North Yemen before 1990
256 "South Africa", // 1974 Code taken from name in Dutch: Zuid-Afrika
258 "Zimbabwe" // 1980 Name changed from Southern Rhodesia (RH)
261 public class FlagCollection
263 Array<BitmapResource> flags { };
264 public property Window window { set { for(b : flags) { b.window = value; } } };
268 flags.size = CountryCode::enumSize;
269 for(c = AD; c <= ZW; c++)
272 char * s = ((char *(*)())(void *)class(CountryCode).base._vTbl[4])(class(CountryCode), &c, tmp, null, null);
273 char fn[MAX_LOCATION];
275 sprintf(fn, ":types/countryCode/%s.png", s);
280 ~FlagCollection() { flags.Free(); }
284 static CountryCode firstCountryCode = AD;
285 static CountryCode lastCountryCode = ZW;
286 public enum CountryCode
289 AD, AE, AF, AG, AI, AL, AM, AN, AO, AQ, AR, AS, AT, AU, AW, AX, AZ,
290 BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BR, BS, BT, BV, BW, BY, BZ,
291 CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CX, CY, CZ,
292 DE, DJ, DK, DM, DO, DZ,
293 EC, EE, EG, EH, ER, ES, ET,
294 FI, FJ, FK, FM, FO, FR,
295 GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY,
296 HK, HM, HN, HR, HT, HU,
297 ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT,
299 KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ,
300 LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY,
301 MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ,
302 NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ,
304 PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY,
307 SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, ST, SV, SY, SZ,
308 TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ,
309 UA, UG, UM, US, UY, UZ,
310 VA, VC, VE, VG, VI, VN, VU,
315 // TODO: have a way to identify the first and the last value for loops and conditionals
316 //static const CountryCode ::first = AD;
317 //static const CountryCode ::last = ZW;
319 char * OnGetString(char * tempString, void * fieldData, bool * needClass)
324 void OnDisplay(Surface surface, int x, int y, int width, FlagCollection flagCollection, Alignment alignment, DataDisplayFlags flags)
326 Bitmap icon = (this != none && flagCollection) ? flagCollection.flags[this].bitmap : null;
329 surface.Blit(icon, x + (16 - icon.width) / 2,y+2,0,0, icon.width, icon.height);
330 class::OnDisplay(surface, x + w, y, width - w, null, alignment, flags);
334 property char * { get { char * s = OnGetString(null, null, null); return s; } }
335 property char * name { get { return countryNames[this]; } }
336 // ATTENTION: allocated memory must be freed by caller
341 char * tmp = /*tempString ? tempString : */new char[4];
343 if(this >= firstCountryCode && this <= lastCountryCode)
344 // if(this > none && this < CountryCode::enumSize) // TOCHECK: CountryCode.ec:338:21: error: couldn't find member enumSize in class CountryCode
345 ((char *(*)())(void *)class(CountryCode).base._vTbl[__ecereVMethodID_class_OnGetString])(class(CountryCode), &this, tmp, null, null);
351 static String subdivisionCategoryNames[SubdivisionCategory] =
354 "Administration", "Metropolitan Administration",
355 "Area", "Council Area", "District Council Area", "Pakistan Administered Area",
356 "Administrative Atoll",
357 "Special Island Authority", "Unitary Authority",
361 "City", "City Corporation", "City Of County Right", "Autonomous City", "Capital City",
362 "Capital Metropolitan City", "Metropolitan City", "Special City", "Special Administrative City",
363 "Overseas Territorial Collectivity",
365 "Autonomous Community", "Urban Community",
366 "Island Council", "Local Council", "TownCouncil",
368 "County", "Two Tier County",
369 "Department", "Metropolitan Department", "Overseas Region Department",
370 "Dependency", "Federal Dependency",
371 "District", "Autonomous District", "Capital District", "Federal District", "Metropolitan District",
376 "Governorates"/* with an s? */,
377 "Island", "Islands Group"/* with an s? */,
380 "Municipality", "Special Municipality",
381 "Oblasts"/* with an s? */,
383 "Self Governed Part",
385 "Prefecture", "Economic Prefecture",
387 "Province", "Autonomous Province", "Constitutional Province",
388 "Quarters"/* with an s? */,
390 "Region", "Administrative Region", "Autonomous Region", "Development Region", "Geographical Region",
391 "Indigenous Region", "Metropolitan Region", "Special Administrative Region", "Special Region",
392 "Republic", "Autonomous Republic",
395 "Territory", "Administrative Territory", "Federal Territory", "Federal Capital Territory",
396 "Outlying Territory", "Union Territory",
397 "Zone", "Special Zone",
398 "Territorial Unit", "Autonomous Territorial Unit"
401 public enum SubdivisionCategory
404 administration, metropolitanAdministration,
405 area, councilArea, districtCouncilArea, pakistanAdministeredArea,
407 specialIslandAuthority, unitaryAuthority,
410 chain/* of islands */,
411 city, cityCorporation, cityOfCountyRight, autonomousCity, capitalCity,
412 capitalMetropolitanCity, metropolitanCity, specialCity, specialAdministrativeCity,
413 overseasTerritorialCollectivity,
415 autonomousCommunity, urbanCommunity,
416 islandCouncil, localCouncil, townCouncil,
418 county, twoTierCounty,
419 department, metropolitanDepartment, overseasRegionDepartment,
420 dependency, federalDependency,
421 district, autonomousDistrict, capitalDistrict, federalDistrict, metropolitanDistrict,
427 island, islandsGroup,
430 municipality, specialMunicipality,
435 prefecture, economicPrefecture,
437 province, autonomousProvince, constitutionalProvince,
440 region, administrativeRegion, autonomousRegion, developmentRegion, geographicalRegion,
441 indigenousRegion, metropolitanRegion, specialAdministrativeRegion, specialRegion,
442 republic, autonomousRepublic,
445 territory, administrativeTerritory, federalTerritory, federalCapitalTerritory,
446 outlyingTerritory, unionTerritory,
448 territorialUnit, autonomousTerritorialUnit;
451 property char * name { get { return subdivisionCategoryNames[this]; } }
454 static String caSubdivisionNames[CASubdivisionCode] =
461 "Newfoundland and Labrador",
464 "Prince Edward Island",
467 "Northwest Territories",
471 static SubdivisionCategory caSubdivisionCategories[CASubdivisionCode] =
473 none, province, province, province, province, province, province, province, province, province, province, territory, territory, territory
475 static CASubdivisionCode firstCASubdivisionCode = AB;
476 static CASubdivisionCode lastCASubdivisionCode = YT;
477 public enum CASubdivisionCode
479 none, AB, BC, MB, NB, NL, NS, ON, PE, QC, SK, NT, NU, YT;
481 char * OnGetString(char * tempString, void * fieldData, bool * needClass)
487 property char * { get { char * s = OnGetString(null, null, null); return s; } }
488 // ATTENTION: allocated memory must be freed by caller
489 property char * completeCode { get { return PrintString(CountryCode::CA, "-", this); } }
490 property char * name { get { return caSubdivisionNames[this]; } }
491 // ATTENTION: allocated memory must be freed by caller
496 char * tmp = /*tempString ? tempString : */new char[4];
498 // if(this > none && this < CASubdivisionCode::enumSize) // TOCHECK: CountryCode.ec:497:36: error: couldn't find member enumSize in class CASubdivisionCode
499 if(this >= firstCASubdivisionCode && this <= lastCASubdivisionCode)
500 ((char *(*)())(void *)class(CASubdivisionCode).base._vTbl[__ecereVMethodID_class_OnGetString])(class(CASubdivisionCode), &this, tmp, null, null);
504 property SubdivisionCategory category { get { return caSubdivisionCategories[this]; } }
505 // TODO: OnDisplay and flag resources
508 static String usSubdivisionNames[USSubdivisionCode] =
519 "District of Columbia",
538 "Northern Mariana Islands",
559 "United States Minor Outlying Islands",
562 "Virgin Islands, U.S.",
569 static SubdivisionCategory usSubdivisionCategories[USSubdivisionCode] =
572 state, state, state, outlyingTerritory, state, state, state, state, district, state, state, state, outlyingTerritory, state, state, state,
573 state, state, state, state, state, state, state, state, state, state, state, outlyingTerritory, state, state, state, state,
574 state, state, state, state, state, state, state, state, state, state, outlyingTerritory, state, state, state, state, state,
575 outlyingTerritory, state, state, outlyingTerritory, state, state, state, state, state
577 static USSubdivisionCode firstUSSubdivisionCode = AK;
578 static USSubdivisionCode lastUSSubdivisionCode = WY;
579 public enum USSubdivisionCode
582 AK, AL, AR, AS, AZ, CA, CO, CT, DC, DE, FL, GA, GU, HI, IA, ID,
583 IL, IN, KS, KY, LA, MA, MD, ME, MI, MN, MO, MP, MS, MT, NC, ND,
584 NE, NH, NJ, NM, NV, NY, OH, OK, OR, PA, PR, RI, SC, SD, TN, TX,
585 UM, UT, VA, VI, VT, WA, WI, WV, WY;
587 char * OnGetString(char * tempString, void * fieldData, bool * needClass)
593 property char * { get { char * s = OnGetString(null, null, null); return s; } }
594 // ATTENTION: allocated memory must be freed by caller
595 property char * completeCode { get { return PrintString(CountryCode::US, "-", this); } }
596 property char * name { get { return usSubdivisionNames[this]; } }
597 // ATTENTION: allocated memory must be freed by caller
602 char * tmp = /*tempString ? tempString : */new char[4];
604 // if(this > none && this < USSubdivisionCode::enumSize) // TOCHECK: CountryCode.ec:603:35: error: couldn't find member enumSize in class USSubdivisionCode
605 if(this >= firstUSSubdivisionCode && this <= lastUSSubdivisionCode)
606 ((char *(*)())(void *)class(USSubdivisionCode).base._vTbl[__ecereVMethodID_class_OnGetString])(class(USSubdivisionCode), &this, tmp, null, null);
610 property SubdivisionCategory category { get { return usSubdivisionCategories[this]; } }
611 // TODO: OnDisplay and flag resources