cleaned all trailing white space from source files.
[sdk] / extras / types / CountryCode.ec
1 #ifdef ECERE_STATIC
2 public import static "ecere"
3 #else
4 public import "ecere"
5 #endif
6
7 extern int __ecereVMethodID_class_OnGetString;
8
9 static String countryNames[CountryCode] =
10 {
11    "(none)",
12    "Andorra", // 1974
13    "United Arab Emirates", // 1974
14    "Afghanistan", // 1974
15    "Antigua and Barbuda", // 1974
16    "Anguilla", // 1983  AI previously represented French Afar and Issas
17    "Albania", // 1974
18    "Armenia", // 1992
19    "Netherlands Antilles", // 1974
20    "Angola", // 1974
21    "Antarctica", // 1974        Covers the territories south of 60° south latitude
22    "Argentina", // 1974
23    "American Samoa", // 1974
24    "Austria", // 1974
25    "Australia", // 1974 Includes the Ashmore and Cartier Islands and the Coral Sea Islands
26    "Aruba", // 1986
27    "Åland Islands", // 2004
28    "Azerbaijan", // 1992
29    "Bosnia and Herzegovina", // 1992
30    "Barbados", // 1974
31    "Bangladesh", // 1974
32    "Belgium", // 1974
33    "Burkina Faso", // 1984      Name changed from Upper Volta (HV)
34    "Bulgaria", // 1974
35    "Bahrain", // 1974
36    "Burundi", // 1974
37    "Benin", // 1977     Name changed from Dahomey (DY)
38    "Saint Barthélemy", //      2007
39    "Bermuda", // 1974
40    "Brunei Darussalam", // 1974
41    "Bolivia, Plurinational State of", // 1974   Previous country name used by ISO: Bolivia
42    "Brazil", // 1974
43    "Bahamas", // 1974
44    "Bhutan", // 1974
45    "Bouvet Island", // 1974
46    "Botswana", // 1974
47    "Belarus", // 1974   Code taken from previous country name used by ISO: Byelorussian SSR
48    "Belize", // 1974
49    "Canada", // 1974
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
57    "Chile", // 1974
58    "Cameroon", // 1974
59    "China", // 1974
60    "Colombia", // 1974
61    "Costa Rica", // 1974
62    "Cuba", // 1974
63    "Cape Verde", // 1974
64    "Christmas Island", // 1974
65    "Cyprus", // 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)
69    "Denmark", // 1974
70    "Dominica", // 1974
71    "Dominican Republic", // 1974
72    "Algeria", // 1974   Code taken from name in Kabyle: Dzayer
73    "Ecuador", // 1974
74    "Estonia", // 1992   Code taken from name in Estonian: Eesti
75    "Egypt", // 1974
76    "Western Sahara", // 1974    Disputed territory Previous country name used by ISO: Spanish Sahara (code taken from name in Spanish: Sahara español)
77    "Eritrea", // 1993
78    "Spain", // 1974     Code taken from name in Spanish: España
79    "Ethiopia", // 1974
80    "Finland", // 1974
81    "Fiji", // 1974
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
86    "Gabon", // 1974
87    "United Kingdom", // 1974    Code taken from official name: United Kingdom of Great Britain and Northern Ireland
88    "Grenada", // 1974
89    "Georgia", // 1992   GE previously represented Gilbert and Ellice Islands
90    "French Guiana", // 1974     Code taken from name in French: Guyane française
91    "Guernsey", //       2006
92    "Ghana", // 1974
93    "Gibraltar", // 1974
94    "Greenland", // 1974
95    "Gambia", // 1974
96    "Guinea", // 1974
97    "Guadeloupe", // 1974
98    "Equatorial Guinea", // 1974 Code taken from name in French: Guinée équatoriale
99    "Greece", // 1974
100    "South Georgia and the South Sandwich Islands", // 1993
101    "Guatemala", // 1974
102    "Guam", // 1974
103    "Guinea-Bissau", // 1974
104    "Guyana", // 1974
105    "Hong Kong", // 1974
106    "Heard Island and McDonald Islands", // 1974
107    "Honduras", // 1974
108    "Croatia", // 1992   Code taken from name in Croatian: Hrvatska
109    "Haiti", // 1974
110    "Hungary", // 1974
111    "Indonesia", // 1974
112    "Ireland", // 1974
113    "Israel", // 1974
114    "Isle of Man", //    2006
115    "India", // 1974
116    "British Indian Ocean Territory", // 1974
117    "Iraq", // 1974
118    "Iran, Islamic Republic of", // 1974
119    "Iceland", // 1974   Code taken from name in Icelandic: Ísland
120    "Italy", // 1974
121    "Jersey", // 2006
122    "Jamaica", // 1974
123    "Jordan", // 1974
124    "Japan", // 1974
125    "Kenya", // 1974
126    "Kyrgyzstan", // 1992
127    "Cambodia", // 1974  Code taken from former name: Khmer Republic, Previous country name used by ISO: Kampuchea
128    "Kiribati", // 1979
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
133    "Kuwait", // 1974
134    "Cayman Islands", // 1974
135    "Kazakhstan", // 1992        Previous country name used by ISO: Kazakstan
136    "Lao People's Democratic Republic", // 1974
137    "Lebanon", // 1974
138    "Saint Lucia", // 1974
139    "Liechtenstein", // 1974
140    "Sri Lanka", // 1974
141    "Liberia", // 1974
142    "Lesotho", // 1974
143    "Lithuania", // 1992
144    "Luxembourg", // 1974
145    "Latvia", // 1992
146    "Libyan Arab Jamahiriya", // 1974
147    "Morocco", // 1974   Code taken from name in French: Maroc
148    "Monaco", // 1974
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
155    "Mali", // 1974
156    "Myanmar", // 1989   Name changed from Burma (BU)
157    "Mongolia", // 1974
158    "Macao", // 1974     Previous country name used by ISO: Macau
159    "Northern Mariana Islands", // 1986
160    "Martinique", // 1974
161    "Mauritania", // 1974
162    "Montserrat", // 1974
163    "Malta", // 1974
164    "Mauritius", // 1974
165    "Maldives", // 1974
166    "Malawi", // 1974
167    "Mexico", // 1974
168    "Malaysia", // 1974
169    "Mozambique", // 1974
170    "Namibia", // 1974
171    "New Caledonia", // 1974
172    "Niger", // 1974
173    "Norfolk Island", // 1974
174    "Nigeria", // 1974
175    "Nicaragua", // 1974
176    "Netherlands", // 1974
177    "Norway", // 1974
178    "Nepal", // 1974
179    "Nauru", // 1974
180    "Niue", // 1974
181    "New Zealand", // 1974
182    "Oman", // 1974
183    "Panama", // 1974
184    "Peru", // 1974
185    "French Polynesia", // 1974  Code taken from name in French: Polynésie française
186    "Papua New Guinea", // 1974
187    "Philippines", // 1974
188    "Pakistan", // 1974
189    "Poland", // 1974
190    "Saint Pierre and Miquelon", // 1974
191    "Pitcairn", // 1974
192    "Puerto Rico", // 1974
193    "Palestinian Territory, Occupied", // 1999   Consists of the West Bank and the Gaza Strip
194    "Portugal", // 1974
195    "Palau", // 1986
196    "Paraguay", // 1974
197    "Qatar", // 1974
198    "Réunion", // 1974
199    "Romania", // 1974
200    "Serbia", // 2006    Code taken from official name: Republic of Serbia (see Serbian country codes)
201    "Russian Federation", // 1992
202    "Rwanda", // 1974
203    "Saudi Arabia", // 1974
204    "Solomon Islands", // 1974   Code taken from former name: British Solomon Islands
205    "Seychelles", // 1974
206    "Sudan", // 1974
207    "Sweden", // 1974
208    "Singapore", // 1974
209    "Saint Helena, Ascension and Tristan da Cunha", // 1974      Previous country name used by ISO: Saint Helena
210    "Slovenia", // 1992
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
215    "Senegal", // 1974
216    "Somalia", // 1974
217    "Suriname", // 1974
218    "Sao Tome and Principe", // 1974
219    "El Salvador", // 1974
220    "Syrian Arab Republic", // 1974
221    "Swaziland", // 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
225    "Togo", // 1974
226    "Thailand", // 1974
227    "Tajikistan", // 1992
228    "Tokelau", // 1974
229    "Timor-Leste", //    2002    Name changed from East Timor (TP)
230    "Turkmenistan", // 1992
231    "Tunisia", // 1974
232    "Tonga", // 1974
233    "Turkey", // 1974
234    "Trinidad and Tobago", // 1974
235    "Tuvalu", // 1979
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
239    "Uganda", // 1974
240    // "United Kingdom",
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
243    "Uruguay", // 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
250    "Viet Nam", // 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
255    "Mayotte", // 1993
256    "South Africa", // 1974      Code taken from name in Dutch: Zuid-Afrika
257    "Zambia", // 1974
258    "Zimbabwe" // 1980   Name changed from Southern Rhodesia (RH)
259 };
260
261 public class FlagCollection
262 {
263    Array<BitmapResource> flags { };
264    public property Window window { set { for(b : flags) { b.window = value; } } };
265    FlagCollection()
266    {
267       CountryCode c;
268       flags.size = CountryCode::enumSize;
269       for(c = AD; c <= ZW; c++)
270       {
271          char tmp[10];
272          char * s = ((char *(*)())(void *)class(CountryCode).base._vTbl[4])(class(CountryCode), &c, tmp, null, null);
273          char fn[MAX_LOCATION];
274          strlwr(s);
275          sprintf(fn, ":types/countryCode/%s.png", s);
276          flags[c] = { fn };
277          incref flags[c];
278       }
279    }
280    ~FlagCollection() { flags.Free(); }
281 }
282
283
284 static CountryCode firstCountryCode = AD;
285 static CountryCode lastCountryCode = ZW;
286 public enum CountryCode
287 {
288    none,
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,
298                    JE,                             JM,     JO, JP,
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,
303                                                    OM,
304    PA,             PE, PF, PG, PH,         PK, PL, PM, PN,             PR, PS, PT,         PW,     PY,
305    QA,
306                    RE,                                     RO,             RS,     RU,     RW,
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,
311                        WF,                                                 WS,
312                    YE,                                                         YT,
313    ZA,                                             ZM,                                     ZW            ;
314
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;
318
319    char * OnGetString(char * tempString, void * fieldData, bool * needClass)
320    {
321       return name;
322    }
323
324    void OnDisplay(Surface surface, int x, int y, int width, FlagCollection flagCollection, Alignment alignment, DataDisplayFlags flags)
325    {
326       Bitmap icon = (this != none && flagCollection) ? flagCollection.flags[this].bitmap : null;
327       int w = 8 + 16;
328       if(icon)
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);
331    }
332
333 public:
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
337    property char * code
338    {
339       get
340       {
341          char * tmp = /*tempString ? tempString : */new char[4];
342          tmp[0] = '\0';
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);
346          return tmp;
347       }
348    }
349 };
350
351 static String subdivisionCategoryNames[SubdivisionCategory] =
352 {
353    "(none)",
354    "Administration", "Metropolitan Administration",
355    "Area", "Council Area", "District Council Area", "Pakistan Administered Area",
356    "Administrative Atoll",
357    "Special Island Authority", "Unitary Authority",
358    "Canton",
359    "Capital",
360    "Chain Of Islands",
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",
364    "Commune",
365    "Autonomous Community", "Urban Community",
366    "Island Council", "Local Council", "TownCouncil",
367    "Country"/* ??? */,
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",
372       "Special District",
373    "Division",
374    "Emirate",
375    "Entity",
376    "Governorates"/* with an s? */,
377    "Island", "Islands Group"/* with an s? */,
378    "Federal Land",
379    "London Borough",
380    "Municipality", "Special Municipality",
381    "Oblasts"/* with an s? */,
382    "Parish",
383    "Self Governed Part",
384    "Popularate",
385    "Prefecture", "Economic Prefecture",
386    "Principality",
387    "Province", "Autonomous Province", "Constitutional Province",
388    "Quarters"/* with an s? */,
389    "Rayon",
390    "Region", "Administrative Region", "Autonomous Region", "Development Region", "Geographical Region",
391       "Indigenous Region", "Metropolitan Region", "Special Administrative Region", "Special Region",
392    "Republic", "Autonomous Republic",
393    "Autonomous Sector",
394    "State",
395    "Territory", "Administrative Territory", "Federal Territory", "Federal Capital Territory",
396       "Outlying Territory", "Union Territory",
397    "Zone", "Special Zone",
398    "Territorial Unit", "Autonomous Territorial Unit"
399 };
400
401 public enum SubdivisionCategory
402 {
403    none,
404    administration, metropolitanAdministration,
405    area, councilArea, districtCouncilArea, pakistanAdministeredArea,
406    administrativeAtoll,
407    specialIslandAuthority, unitaryAuthority,
408    canton,
409    capital,
410    chain/* of islands */,
411    city, cityCorporation, cityOfCountyRight, autonomousCity, capitalCity,
412       capitalMetropolitanCity, metropolitanCity, specialCity, specialAdministrativeCity,
413    overseasTerritorialCollectivity,
414    commune,
415    autonomousCommunity, urbanCommunity,
416    islandCouncil, localCouncil, townCouncil,
417    country,
418    county, twoTierCounty,
419    department, metropolitanDepartment, overseasRegionDepartment,
420    dependency, federalDependency,
421    district, autonomousDistrict, capitalDistrict, federalDistrict, metropolitanDistrict,
422       specialDistrict,
423    division,
424    emirate,
425    entity,
426    governorates,
427    island, islandsGroup,
428    federalLand,
429    londonBorough,
430    municipality, specialMunicipality,
431    oblasts,
432    parish,
433    selfGovernedPart,
434    popularate,
435    prefecture, economicPrefecture,
436    principality,
437    province, autonomousProvince, constitutionalProvince,
438    quarters,
439    rayon,
440    region, administrativeRegion, autonomousRegion, developmentRegion, geographicalRegion,
441       indigenousRegion, metropolitanRegion, specialAdministrativeRegion, specialRegion,
442    republic, autonomousRepublic,
443    autonomousSector,
444    state,
445    territory, administrativeTerritory, federalTerritory, federalCapitalTerritory,
446       outlyingTerritory, unionTerritory,
447    zone, specialZone,
448    territorialUnit, autonomousTerritorialUnit;
449
450 public:
451    property char * name { get { return subdivisionCategoryNames[this]; } }
452 };
453
454 static String caSubdivisionNames[CASubdivisionCode] =
455 {
456    "(none)",
457    "Alberta",
458    "British Columbia",
459    "Manitoba",
460    "New Brunswick",
461    "Newfoundland and Labrador",
462    "Nova Scotia",
463    "Ontario",
464    "Prince Edward Island",
465    "Quebec",
466    "Saskatchewan",
467    "Northwest Territories",
468    "Nunavut",
469    "Yukon"
470 };
471 static SubdivisionCategory caSubdivisionCategories[CASubdivisionCode] =
472 {
473    none, province, province, province, province, province, province, province, province, province, province, territory, territory, territory
474 };
475 static CASubdivisionCode firstCASubdivisionCode = AB;
476 static CASubdivisionCode lastCASubdivisionCode = YT;
477 public enum CASubdivisionCode
478 {
479    none, AB, BC, MB, NB, NL, NS, ON, PE, QC, SK, NT, NU, YT;
480
481    char * OnGetString(char * tempString, void * fieldData, bool * needClass)
482    {
483       return name;
484    }
485
486 public:
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
492    property char * code
493    {
494       get
495       {
496          char * tmp = /*tempString ? tempString : */new char[4];
497          tmp[0] = '\0';
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);
501          return tmp;
502       }
503    }
504    property SubdivisionCategory category { get { return caSubdivisionCategories[this]; } }
505    // TODO: OnDisplay and flag resources
506 };
507
508 static String usSubdivisionNames[USSubdivisionCode] =
509 {
510    "(none)",
511    "Alaska",
512    "Alabama",
513    "Arkansas",
514    "American Samoa",
515    "Arizona",
516    "California",
517    "Colorado",
518    "Connecticut",
519    "District of Columbia",
520    "Delaware",
521    "Florida",
522    "Georgia",
523    "Guam",
524    "Hawaii",
525    "Iowa",
526    "Idaho",
527    "Illinois",
528    "Indiana",
529    "Kansas",
530    "Kentucky",
531    "Louisiana",
532    "Massachusetts",
533    "Maryland",
534    "Maine",
535    "Michigan",
536    "Minnesota",
537    "Missouri",
538    "Northern Mariana Islands",
539    "Mississippi",
540    "Montana",
541    "North Carolina",
542    "North Dakota",
543    "Nebraska",
544    "New Hampshire",
545    "New Jersey",
546    "New Mexico",
547    "Nevada",
548    "New York",
549    "Ohio",
550    "Oklahoma",
551    "Oregon",
552    "Pennsylvania",
553    "Puerto Rico",
554    "Rhode Island",
555    "South Carolina",
556    "South Dakota",
557    "Tennessee",
558    "Texas",
559    "United States Minor Outlying Islands",
560    "Utah",
561    "Virginia",
562    "Virgin Islands, U.S.",
563    "Vermont",
564    "Washington",
565    "Wisconsin",
566    "West Virginia",
567    "Wyoming"
568 };
569 static SubdivisionCategory usSubdivisionCategories[USSubdivisionCode] =
570 {
571    none,
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
576 };
577 static USSubdivisionCode firstUSSubdivisionCode = AK;
578 static USSubdivisionCode lastUSSubdivisionCode = WY;
579 public enum USSubdivisionCode
580 {
581    none,
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;
586
587    char * OnGetString(char * tempString, void * fieldData, bool * needClass)
588    {
589       return name;
590    }
591
592 public:
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
598    property char * code
599    {
600       get
601       {
602          char * tmp = /*tempString ? tempString : */new char[4];
603          tmp[0] = '\0';
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);
607          return tmp;
608       }
609    }
610    property SubdivisionCategory category { get { return usSubdivisionCategories[this]; } }
611    // TODO: OnDisplay and flag resources
612 };
613