Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

290 lines
11 KiB

  1. // Copyright (c) 1998 - 1999 Microsoft Corporation. All Rights Reserved.
  2. #ifndef __ISO3166_H
  3. #define __ISO3166_H
  4. char DVDToUpper(char x)
  5. {
  6. if('a' <= x && x <= 'z') {
  7. return x - ('a' - 'A');
  8. } else {
  9. return x;
  10. }
  11. }
  12. struct ISO3166
  13. {
  14. const char *Code;
  15. // access the table as ISO3166::GetCountry()
  16. static const ISO3166& GetCountry( unsigned i );
  17. static unsigned GetNumCountries();
  18. // creates an ISO code from a two letter string
  19. static WORD PackCode( const char string[2] )
  20. {
  21. return DVDToUpper(string[0])<<8 | DVDToUpper(string[1]);
  22. }
  23. };
  24. // ISO3166 country code table
  25. static const ISO3166 g_Table[] =
  26. { // current as of Dec 22, 2000
  27. {/* "Afghanistan", */ "AF"},
  28. {/* "Albania", */ "AL"},
  29. {/* "Algeria", */ "DZ"},
  30. {/* "American Samoa", */ "AS"},
  31. {/* "Andorra", */ "AD"},
  32. {/* "Angola", */ "AO"},
  33. {/* "Anguilla", */ "AI"},
  34. {/* "Antarctica", */ "AQ"},
  35. {/* "Antigua and Barbuda", */ "AG"},
  36. {/* "Argentina", */ "AR"},
  37. {/* "Armenia", */ "AM"},
  38. {/* "Aruba", */ "AW"},
  39. {/* "Australia", */ "AU"},
  40. {/* "Austria", */ "AT"},
  41. {/* "Azerbaijan", */ "AZ"},
  42. {/* "Bahamas", */ "BS"},
  43. {/* "Bahrain", */ "BH"},
  44. {/* "Bangladesh", */ "BD"},
  45. {/* "Barbados", */ "BB"},
  46. {/* "Belarus", */ "BY"},
  47. {/* "Belgium", */ "BE"},
  48. {/* "Belize", */ "BZ"},
  49. {/* "Benin", */ "BJ"},
  50. {/* "Bermuda", */ "BM"},
  51. {/* "Bhutan", */ "BT"},
  52. {/* "Bolivia", */ "BO"},
  53. {/* "Bosnia and Herzegovina", */ "BA"},
  54. {/* "Botswana", */ "BW"},
  55. {/* "Bouvet Island", */ "BV"},
  56. {/* "Brazil", */ "BR"},
  57. {/* "British Indian Ocean Territory", */ "IO"},
  58. {/* "Brunei Darussalam", */ "BN"},
  59. {/* "Bulgaria", */ "BG"},
  60. {/* "Burkina Faso", */ "BF"},
  61. {/* "Burundi", */ "BI"},
  62. {/* "Cambodia", */ "KH"},
  63. {/* "Cameroon", */ "CM"},
  64. {/* "Canada", */ "CA"},
  65. {/* "Cape Verde", */ "CV"},
  66. {/* "Cayman Islands", */ "KY"},
  67. {/* "Central African Republic", */ "CF"},
  68. {/* "Chad", */ "TD"},
  69. {/* "Channel Islands", */ "GB"},
  70. {/* "Chile", */ "CL"},
  71. {/* "China", */ "CN"},
  72. {/* "Christmas Island", */ "CX"},
  73. {/* "Cocos (Keeling) Islands", */ "CC"},
  74. {/* "Colombia", */ "CO"},
  75. {/* "Comoros", */ "KM"},
  76. {/* "Congo", */ "CG"},
  77. {/* "Cook Islands", */ "CK"},
  78. {/* "Costa Rica", */ "CR"},
  79. {/* "C�te d'Ivoire", */ "CI"},
  80. {/* "Croatia (local name: Hrvatska)", */ "HR"},
  81. {/* "Cuba", */ "CU"},
  82. {/* "Cyprus", */ "CY"},
  83. {/* "Czech Republic", */ "CZ"},
  84. {/* "Denmark", */ "DK"},
  85. {/* "Djibouti", */ "DJ"},
  86. {/* "Dominica", */ "DM"},
  87. {/* "Dominican Republic", */ "DO"},
  88. {/* "East Timor", */ "TP"},
  89. {/* "Ecuador", */ "EC"},
  90. {/* "Egypt", */ "EG"},
  91. {/* "El Salvador", */ "SV"},
  92. {/* "Equatorial Guinea", */ "GQ"},
  93. {/* "Eritrea", */ "ER"},
  94. {/* "Estonia", */ "EE"},
  95. {/* "Ethiopia", */ "ET"},
  96. {/* "Falkland Islands (Malvinas)", */ "FK"},
  97. {/* "Faroe Islands", */ "FO"},
  98. {/* "Fiji", */ "FJ"},
  99. {/* "Finland", */ "FI"},
  100. {/* "France", */ "FR"},
  101. {/* "France, Metropolitan", */ "FX"},
  102. {/* "French Guiana", */ "GF"},
  103. {/* "French Polynesia", */ "PF"},
  104. {/* "French Southern and Antarctic Lands", */ "TF"},
  105. {/* "Gabon", */ "GA"},
  106. {/* "Gambia", */ "GM"},
  107. {/* "Georgia", */ "GE"},
  108. {/* "Germany", */ "DE"},
  109. {/* "Ghana", */ "GH"},
  110. {/* "Gibraltar", */ "GI"},
  111. {/* "Greece", */ "GR"},
  112. {/* "Greenland", */ "GL"},
  113. {/* "Grenada", */ "GD"},
  114. {/* "Guadeloupe", */ "GP"},
  115. {/* "Guam", */ "GU"},
  116. {/* "Guatemala", */ "GT"},
  117. {/* "Guinea", */ "GN"},
  118. {/* "Guinea-Bissau", */ "GW"},
  119. {/* "Guyana", */ "GY"},
  120. {/* "Haiti", */ "HT"},
  121. {/* "Heard and Mc Donald Islands", */ "HM"},
  122. {/* "Holy See (Vatican City State)", */ "VA"},
  123. {/* "Honduras", */ "HN"},
  124. {/* "Hong Kong SAR", */ "HK"},
  125. {/* "Hungary", */ "HU"},
  126. {/* "Iceland", */ "IS"},
  127. {/* "India", */ "IN"},
  128. {/* "Indonesia", */ "ID"},
  129. {/* "Iran (Islamic Republic Of)", */ "IR"},
  130. {/* "Iraq", */ "IQ"},
  131. {/* "Ireland", */ "IE"},
  132. {/* "Israel", */ "IL"},
  133. {/* "Italy", */ "IT"},
  134. {/* "Jamaica", */ "JM"},
  135. {/* "Japan", */ "JP"},
  136. {/* "Jordan", */ "JO"},
  137. {/* "Kazakhstan", */ "KZ"},
  138. {/* "Kenya", */ "KE"},
  139. {/* "Kiribati", */ "KI"},
  140. {/* "Korea, Democratic People's Republic Of", */ "KP"},
  141. {/* "Korea, Republic Of", */ "KR"},
  142. {/* "Kuwait", */ "KW"},
  143. {/* "Kyrgyzstan", */ "KG"},
  144. {/* "Lao People's Democratic Republic", */ "LA"},
  145. {/* "Latvia", */ "LV"},
  146. {/* "Lebanon", */ "LB"},
  147. {/* "Lesotho", */ "LS"},
  148. {/* "Liberia", */ "LR"},
  149. {/* "Libyan Arab Jamahiriya", */ "LY"},
  150. {/* "Liechtenstein", */ "LI"},
  151. {/* "Lithuania", */ "LT"},
  152. {/* "Luxembourg", */ "LU"},
  153. {/* "Macau SAR", */ "MO"},
  154. {/* "Macedonia, The Former Yugoslav Republic Of", */ "MK"},
  155. {/* "Madagascar", */ "MG"},
  156. {/* "Malawi", */ "MW"},
  157. {/* "Malaysia", */ "MY"},
  158. {/* "Maldives", */ "MV"},
  159. {/* "Mali", */ "ML"},
  160. {/* "Malta", */ "MT"},
  161. {/* "Man, Isle of",*/ "GB"},
  162. {/* "Marshall Islands", */ "MH"},
  163. {/* "Martinique", */ "MQ"},
  164. {/* "Mauritania", */ "MR"},
  165. {/* "Mauritius", */ "MU"},
  166. {/* "Mayotte", */ "YT"},
  167. {/* "Mexico", */ "MX"},
  168. {/* "Micronesia, Federated States Of", */ "FM"},
  169. {/* "Moldova, Republic Of", */ "MD"},
  170. {/* "Monaco", */ "MC"},
  171. {/* "Mongolia", */ "MN"},
  172. {/* "Montserrat", */ "MS"},
  173. {/* "Morocco", */ "MA"},
  174. {/* "Mozambique", */ "MZ"},
  175. {/* "Myanmar", */ "MM"},
  176. {/* "Namibia", */ "NA"},
  177. {/* "Nauru", */ "NR"},
  178. {/* "Nepal", */ "NP"},
  179. {/* "Netherlands", */ "NL"},
  180. {/* "Netherlands ANTILLES", */ "AN"},
  181. {/* "New Caledonia", */ "NC"},
  182. {/* "New Zealand", */ "NZ"},
  183. {/* "Nicaragua", */ "NI"},
  184. {/* "Niger", */ "NE"},
  185. {/* "Nigeria", */ "NG"},
  186. {/* "Niue", */ "NU"},
  187. {/* "Norfolk Island", */ "NF"},
  188. {/* "Northern Mariana Islands", */ "MP"},
  189. {/* "Norway", */ "NO"},
  190. {/* "Oman", */ "OM"},
  191. {/* "Pakistan", */ "PK"},
  192. {/* "Palau", */ "PW"},
  193. {/* "Panama", */ "PA"},
  194. {/* "Papua New Guinea", */ "PG"},
  195. {/* "Paraguay", */ "PY"},
  196. {/* "Peru", */ "PE"},
  197. {/* "Philippines", */ "PH"},
  198. {/* "Pitcairn Islands", */ "PN"},
  199. {/* "Poland", */ "PL"},
  200. {/* "Portugal", */ "PT"},
  201. {/* "Puerto Rico", */ "PR"},
  202. {/* "Qatar", */ "QA"},
  203. {/* "Reunion", */ "RE"},
  204. {/* "Romania", */ "RO"},
  205. {/* "Russian Federation", */ "RU"},
  206. {/* "Rwanda", */ "RW"},
  207. {/* "Saint Kitts and Nevis", */ "KN"},
  208. {/* "Saint Lucia", */ "LC"},
  209. {/* "Saint Vincent and The Grenadines", */ "VC"},
  210. {/* "Samoa", */ "WS"},
  211. {/* "San Marino", */ "SM"},
  212. {/* "S�o Tom� and Pr�ncipe ", */ "ST"},
  213. {/* "Saudi Arabia", */ "SA"},
  214. {/* "Senegal", */ "SN"},
  215. {/* "Seychelles", */ "SC"},
  216. {/* "Sierra Leone", */ "SL"},
  217. {/* "Singapore", */ "SG"},
  218. {/* "Slovakia (Slovak Republic)", */ "SK"},
  219. {/* "Slovenia", */ "SI"},
  220. {/* "Solomon Islands", */ "SB"},
  221. {/* "Somalia", */ "SO"},
  222. {/* "South Africa", */ "ZA"},
  223. {/* "South Georgia and The South Sandwich Islands", */ "GS"},
  224. {/* "Spain", */ "ES"},
  225. {/* "Sri Lanka", */ "LK"},
  226. {/* "St. Helena", */ "SH"},
  227. {/* "St. Pierre and Miquelon", */ "PM"},
  228. {/* "Sudan", */ "SD"},
  229. {/* "Suriname", */ "SR"},
  230. {/* "Svalbard and Jan Mayen Islands", */ "SJ"},
  231. {/* "Swaziland", */ "SZ"},
  232. {/* "Sweden", */ "SE"},
  233. {/* "Switzerland", */ "CH"},
  234. {/* "Syrian Arab Republic", */ "SY"},
  235. {/* "Taiwan", */ "TW"},
  236. {/* "Tajikistan", */ "TJ"},
  237. {/* "Tanzania, United Republic Of", */ "TZ"},
  238. {/* "Thailand", */ "TH"},
  239. {/* "Togo", */ "TG"},
  240. {/* "Tokelau", */ "TK"},
  241. {/* "Tonga", */ "TO"},
  242. {/* "Trinidad and Tobago", */ "TT"},
  243. {/* "Tunisia", */ "TN"},
  244. {/* "Turkey", */ "TR"},
  245. {/* "Turkmenistan", */ "TM"},
  246. {/* "Turks and Caicos Islands", */ "TC"},
  247. {/* "Tuvalu", */ "TV"},
  248. {/* "Uganda", */ "UG"},
  249. {/* "Ukraine", */ "UA"},
  250. {/* "United Arab Emirates", */ "AE"},
  251. {/* "United Kingdom", */ "GB"},
  252. {/* "United States", */ "US"},
  253. {/* "U.S. Minor Outlying Islands", */ "UM"},
  254. {/* "Uruguay", */ "UY"},
  255. {/* "Uzbekistan", */ "UZ"},
  256. {/* "Vanuatu", */ "VU"},
  257. {/* "Venezuela", */ "VE"},
  258. {/* "Viet Nam", */ "VN"},
  259. {/* "Virgin Islands (British)", */ "VG"},
  260. {/* "Virgin Islands (U.S.)", */ "VI"},
  261. {/* "Wallis and Futuna Islands", */ "WF"},
  262. {/* "Yemen", */ "YE"},
  263. {/* "Yugoslavia", */ "YU"},
  264. {/* "Congo (DRC)", */ "ZR"},
  265. {/* "Zambia", */ "ZM"},
  266. {/* "Zimbabwe", */ "ZW"}
  267. };
  268. static const unsigned g_uTableSize = sizeof( g_Table )/ sizeof( g_Table[0] );
  269. const ISO3166& ISO3166::GetCountry( unsigned i )
  270. {
  271. return g_Table[i];
  272. }
  273. unsigned ISO3166::GetNumCountries()
  274. {
  275. return g_uTableSize;
  276. }
  277. #endif