41      std::string 
name( IdString index_r )
 
   47        { ret = 
_(link->second); }
 
   50          ret = 
_(
"Unknown country: ");
 
   52          ret += index_r.c_str();
 
   59      using CodeMap = std::unordered_map<std::string, const char *>;
 
   60      using Link = CodeMap::const_iterator;
 
   62      using IndexMap = std::unordered_map<IdString, Link>;
 
   72        auto it = _indexMap.find( index_r );
 
   73        return( it != _indexMap.end()
 
   75              : newIndex( index_r, index_r.asString() ) );
 
   79      Link newIndex( IdString index_r, 
const std::string & code_r )
 
   81        Link link = _codeMap.find( code_r );
 
   82        if ( link != _codeMap.end() )
 
   83          return (_indexMap[index_r] = link);
 
   86        CodeMap::value_type nval( code_r, 
nullptr );
 
   88        if ( code_r.size() != 2 )
 
   89          WAR << 
"Malformed CountryCode '" << code_r << 
"' (expect 2-letter)" << endl;
 
   92        if ( ucode != code_r )
 
   94          WAR << 
"Malformed CountryCode '" << code_r << 
"' (not upper case)" << endl;
 
   97          link = _codeMap.find( ucode );
 
   98          if ( link != _codeMap.end() )
 
  100            nval.second = link->second;
 
  103        MIL << 
"Remember CountryCode '" << code_r << 
"': '" << (nval.second?nval.second:
"Unknown country") << 
"'" << endl;
 
  104        return (_indexMap[index_r] = _codeMap.insert( nval ).first);
 
  140  { 
return CodeMaps::instance().name( 
_str ); }
 
 
  149      _codeMap[
""]        = 
N_( 
"No Code" );
 
  157      const Init init[] = {
 
  158          {
"AD", 
N_( 
"Andorra" ) },                           
 
  159          {
"AE", 
N_( 
"United Arab Emirates" ) },              
 
  160          {
"AF", 
N_( 
"Afghanistan" ) },                       
 
  161          {
"AG", 
N_( 
"Antigua and Barbuda" ) },               
 
  162          {
"AI", 
N_( 
"Anguilla" ) },                          
 
  163          {
"AL", 
N_( 
"Albania" ) },                           
 
  164          {
"AM", 
N_( 
"Armenia" ) },                           
 
  165          {
"AN", 
N_( 
"Netherlands Antilles" ) },              
 
  166          {
"AO", 
N_( 
"Angola" ) },                            
 
  167          {
"AQ", 
N_( 
"Antarctica" ) },                                
 
  168          {
"AR", 
N_( 
"Argentina" ) },                         
 
  169          {
"AS", 
N_( 
"American Samoa" ) },                    
 
  170          {
"AT", 
N_( 
"Austria" ) },                           
 
  171          {
"AU", 
N_( 
"Australia" ) },                                 
 
  172          {
"AW", 
N_( 
"Aruba" ) },                             
 
  173          {
"AX", 
N_( 
"Aland Islands" ) },                     
 
  174          {
"AZ", 
N_( 
"Azerbaijan" ) },                                
 
  175          {
"BA", 
N_( 
"Bosnia and Herzegovina" ) },            
 
  176          {
"BB", 
N_( 
"Barbados" ) },                          
 
  177          {
"BD", 
N_( 
"Bangladesh" ) },                                
 
  178          {
"BE", 
N_( 
"Belgium" ) },                           
 
  179          {
"BF", 
N_( 
"Burkina Faso" ) },                      
 
  180          {
"BG", 
N_( 
"Bulgaria" ) },                          
 
  181          {
"BH", 
N_( 
"Bahrain" ) },                           
 
  182          {
"BI", 
N_( 
"Burundi" ) },                           
 
  183          {
"BJ", 
N_( 
"Benin" ) },                             
 
  184          {
"BM", 
N_( 
"Bermuda" ) },                           
 
  185          {
"BN", 
N_( 
"Brunei Darussalam" ) },                         
 
  186          {
"BO", 
N_( 
"Bolivia" ) },                           
 
  187          {
"BR", 
N_( 
"Brazil" ) },                            
 
  188          {
"BS", 
N_( 
"Bahamas" ) },                           
 
  189          {
"BT", 
N_( 
"Bhutan" ) },                            
 
  190          {
"BV", 
N_( 
"Bouvet Island" ) },                     
 
  191          {
"BW", 
N_( 
"Botswana" ) },                          
 
  192          {
"BY", 
N_( 
"Belarus" ) },                           
 
  193          {
"BZ", 
N_( 
"Belize" ) },                            
 
  194          {
"CA", 
N_( 
"Canada" ) },                            
 
  195          {
"CC", 
N_( 
"Cocos (Keeling) Islands" ) },           
 
  196          {
"CD", 
N_( 
"Congo" ) },                             
 
  197          {
"CF", 
N_( 
"Central African Republic" ) },          
 
  198          {
"CG", 
N_( 
"Congo" ) },                             
 
  199          {
"CH", 
N_( 
"Switzerland" ) },                       
 
  200          {
"CI", 
N_( 
"Cote D'Ivoire" ) },                     
 
  201          {
"CK", 
N_( 
"Cook Islands" ) },                      
 
  202          {
"CL", 
N_( 
"Chile" ) },                             
 
  203          {
"CM", 
N_( 
"Cameroon" ) },                          
 
  204          {
"CN", 
N_( 
"China" ) },                             
 
  205          {
"CO", 
N_( 
"Colombia" ) },                          
 
  206          {
"CR", 
N_( 
"Costa Rica" ) },                                
 
  207          {
"CU", 
N_( 
"Cuba" ) },                              
 
  208          {
"CV", 
N_( 
"Cape Verde" ) },                                
 
  209          {
"CX", 
N_( 
"Christmas Island" ) },                  
 
  210          {
"CY", 
N_( 
"Cyprus" ) },                            
 
  211          {
"CZ", 
N_( 
"Czech Republic" ) },                    
 
  212          {
"DE", 
N_( 
"Germany" ) },                           
 
  213          {
"DJ", 
N_( 
"Djibouti" ) },                          
 
  214          {
"DK", 
N_( 
"Denmark" ) },                           
 
  215          {
"DM", 
N_( 
"Dominica" ) },                          
 
  216          {
"DO", 
N_( 
"Dominican Republic" ) },                        
 
  217          {
"DZ", 
N_( 
"Algeria" ) },                           
 
  218          {
"EC", 
N_( 
"Ecuador" ) },                           
 
  219          {
"EE", 
N_( 
"Estonia" ) },                           
 
  220          {
"EG", 
N_( 
"Egypt" ) },                             
 
  221          {
"EH", 
N_( 
"Western Sahara" ) },                    
 
  222          {
"ER", 
N_( 
"Eritrea" ) },                           
 
  223          {
"ES", 
N_( 
"Spain" ) },                             
 
  224          {
"ET", 
N_( 
"Ethiopia" ) },                          
 
  225          {
"FI", 
N_( 
"Finland" ) },                           
 
  226          {
"FJ", 
N_( 
"Fiji" ) },                              
 
  227          {
"FK", 
N_( 
"Falkland Islands (Malvinas)" ) },       
 
  228          {
"FM", 
N_( 
"Federated States of Micronesia" ) },    
 
  229          {
"FO", 
N_( 
"Faroe Islands" ) },                     
 
  230          {
"FR", 
N_( 
"France" ) },                            
 
  231          {
"FX", 
N_( 
"Metropolitan France" ) },               
 
  232          {
"GA", 
N_( 
"Gabon" ) },                             
 
  233          {
"GB", 
N_( 
"United Kingdom" ) },                    
 
  234          {
"GD", 
N_( 
"Grenada" ) },                           
 
  235          {
"GE", 
N_( 
"Georgia" ) },                           
 
  236          {
"GF", 
N_( 
"French Guiana" ) },                     
 
  237          {
"GG", 
N_( 
"Guernsey" ) },
 
  238          {
"GH", 
N_( 
"Ghana" ) },                             
 
  239          {
"GI", 
N_( 
"Gibraltar" ) },                                 
 
  240          {
"GL", 
N_( 
"Greenland" ) },                                 
 
  241          {
"GM", 
N_( 
"Gambia" ) },                            
 
  242          {
"GN", 
N_( 
"Guinea" ) },                            
 
  243          {
"GP", 
N_( 
"Guadeloupe" ) },                                
 
  244          {
"GQ", 
N_( 
"Equatorial Guinea" ) },                         
 
  245          {
"GR", 
N_( 
"Greece" ) },                            
 
  246          {
"GS", 
N_( 
"South Georgia and the South Sandwich Islands" ) },      
 
  247          {
"GT", 
N_( 
"Guatemala" ) },                                 
 
  248          {
"GU", 
N_( 
"Guam" ) },                              
 
  249          {
"GW", 
N_( 
"Guinea-Bissau" ) },                     
 
  250          {
"GY", 
N_( 
"Guyana" ) },                            
 
  251          {
"HK", 
N_( 
"Hong Kong" ) },                                 
 
  252          {
"HM", 
N_( 
"Heard Island and McDonald Islands" ) }, 
 
  253          {
"HN", 
N_( 
"Honduras" ) },                          
 
  254          {
"HR", 
N_( 
"Croatia" ) },                           
 
  255          {
"HT", 
N_( 
"Haiti" ) },                             
 
  256          {
"HU", 
N_( 
"Hungary" ) },                           
 
  257          {
"ID", 
N_( 
"Indonesia" ) },                                 
 
  258          {
"IE", 
N_( 
"Ireland" ) },                           
 
  259          {
"IL", 
N_( 
"Israel" ) },                            
 
  260          {
"IM", 
N_( 
"Isle of Man" ) },
 
  261          {
"IN", 
N_( 
"India" ) },                             
 
  262          {
"IO", 
N_( 
"British Indian Ocean Territory" ) },    
 
  263          {
"IQ", 
N_( 
"Iraq" ) },                              
 
  264          {
"IR", 
N_( 
"Iran" ) },                              
 
  265          {
"IS", 
N_( 
"Iceland" ) },                           
 
  266          {
"IT", 
N_( 
"Italy" ) },                             
 
  267          {
"JE", 
N_( 
"Jersey" ) },
 
  268          {
"JM", 
N_( 
"Jamaica" ) },                           
 
  269          {
"JO", 
N_( 
"Jordan" ) },                            
 
  270          {
"JP", 
N_( 
"Japan" ) },                             
 
  271          {
"KE", 
N_( 
"Kenya" ) },                             
 
  272          {
"KG", 
N_( 
"Kyrgyzstan" ) },                                
 
  273          {
"KH", 
N_( 
"Cambodia" ) },                          
 
  274          {
"KI", 
N_( 
"Kiribati" ) },                          
 
  275          {
"KM", 
N_( 
"Comoros" ) },                           
 
  276          {
"KN", 
N_( 
"Saint Kitts and Nevis" ) },             
 
  277          {
"KP", 
N_( 
"North Korea" ) },                       
 
  278          {
"KR", 
N_( 
"South Korea" ) },                       
 
  279          {
"KW", 
N_( 
"Kuwait" ) },                            
 
  280          {
"KY", 
N_( 
"Cayman Islands" ) },                    
 
  281          {
"KZ", 
N_( 
"Kazakhstan" ) },                                
 
  282          {
"LA", 
N_( 
"Lao People's Democratic Republic" ) },  
 
  283          {
"LB", 
N_( 
"Lebanon" ) },                           
 
  284          {
"LC", 
N_( 
"Saint Lucia" ) },                       
 
  285          {
"LI", 
N_( 
"Liechtenstein" ) },                     
 
  286          {
"LK", 
N_( 
"Sri Lanka" ) },                                 
 
  287          {
"LR", 
N_( 
"Liberia" ) },                           
 
  288          {
"LS", 
N_( 
"Lesotho" ) },                           
 
  289          {
"LT", 
N_( 
"Lithuania" ) },                                 
 
  290          {
"LU", 
N_( 
"Luxembourg" ) },                                
 
  291          {
"LV", 
N_( 
"Latvia" ) },                            
 
  292          {
"LY", 
N_( 
"Libya" ) },                             
 
  293          {
"MA", 
N_( 
"Morocco" ) },                           
 
  294          {
"MC", 
N_( 
"Monaco" ) },                            
 
  295          {
"MD", 
N_( 
"Moldova" ) },                           
 
  296          {
"ME", 
N_( 
"Montenegro" ) },
 
  297          {
"MF", 
N_( 
"Saint Martin" ) },
 
  298          {
"MG", 
N_( 
"Madagascar" ) },                                
 
  299          {
"MH", 
N_( 
"Marshall Islands" ) },                  
 
  300          {
"MK", 
N_( 
"Macedonia" ) },                                 
 
  301          {
"ML", 
N_( 
"Mali" ) },                              
 
  302          {
"MM", 
N_( 
"Myanmar" ) },                           
 
  303          {
"MN", 
N_( 
"Mongolia" ) },                          
 
  304          {
"MO", 
N_( 
"Macao" ) },                             
 
  305          {
"MP", 
N_( 
"Northern Mariana Islands" ) },          
 
  306          {
"MQ", 
N_( 
"Martinique" ) },                                
 
  307          {
"MR", 
N_( 
"Mauritania" ) },                                
 
  308          {
"MS", 
N_( 
"Montserrat" ) },                                
 
  309          {
"MT", 
N_( 
"Malta" ) },                             
 
  310          {
"MU", 
N_( 
"Mauritius" ) },                                 
 
  311          {
"MV", 
N_( 
"Maldives" ) },                          
 
  312          {
"MW", 
N_( 
"Malawi" ) },                            
 
  313          {
"MX", 
N_( 
"Mexico" ) },                            
 
  314          {
"MY", 
N_( 
"Malaysia" ) },                          
 
  315          {
"MZ", 
N_( 
"Mozambique" ) },                                
 
  316          {
"NA", 
N_( 
"Namibia" ) },                           
 
  317          {
"NC", 
N_( 
"New Caledonia" ) },                     
 
  318          {
"NE", 
N_( 
"Niger" ) },                             
 
  319          {
"NF", 
N_( 
"Norfolk Island" ) },                    
 
  320          {
"NG", 
N_( 
"Nigeria" ) },                           
 
  321          {
"NI", 
N_( 
"Nicaragua" ) },                                 
 
  322          {
"NL", 
N_( 
"Netherlands" ) },                       
 
  323          {
"NO", 
N_( 
"Norway" ) },                            
 
  324          {
"NP", 
N_( 
"Nepal" ) },                             
 
  325          {
"NR", 
N_( 
"Nauru" ) },                             
 
  326          {
"NU", 
N_( 
"Niue" ) },                              
 
  327          {
"NZ", 
N_( 
"New Zealand" ) },                       
 
  328          {
"OM", 
N_( 
"Oman" ) },                              
 
  329          {
"PA", 
N_( 
"Panama" ) },                            
 
  330          {
"PE", 
N_( 
"Peru" ) },                              
 
  331          {
"PF", 
N_( 
"French Polynesia" ) },                  
 
  332          {
"PG", 
N_( 
"Papua New Guinea" ) },                  
 
  333          {
"PH", 
N_( 
"Philippines" ) },                       
 
  334          {
"PK", 
N_( 
"Pakistan" ) },                          
 
  335          {
"PL", 
N_( 
"Poland" ) },                            
 
  336          {
"PM", 
N_( 
"Saint Pierre and Miquelon" ) },                 
 
  337          {
"PN", 
N_( 
"Pitcairn" ) },                          
 
  338          {
"PR", 
N_( 
"Puerto Rico" ) },                       
 
  339          {
"PS", 
N_( 
"Palestinian Territory" ) },             
 
  340          {
"PT", 
N_( 
"Portugal" ) },                          
 
  341          {
"PW", 
N_( 
"Palau" ) },                             
 
  342          {
"PY", 
N_( 
"Paraguay" ) },                          
 
  343          {
"QA", 
N_( 
"Qatar" ) },                             
 
  344          {
"RE", 
N_( 
"Reunion" ) },                           
 
  345          {
"RO", 
N_( 
"Romania" ) },                           
 
  346          {
"RS", 
N_( 
"Serbia" ) },
 
  347          {
"RU", 
N_( 
"Russian Federation" ) },                        
 
  348          {
"RW", 
N_( 
"Rwanda" ) },                            
 
  349          {
"SA", 
N_( 
"Saudi Arabia" ) },                      
 
  350          {
"SB", 
N_( 
"Solomon Islands" ) },                   
 
  351          {
"SC", 
N_( 
"Seychelles" ) },                                
 
  352          {
"SD", 
N_( 
"Sudan" ) },                             
 
  353          {
"SE", 
N_( 
"Sweden" ) },                            
 
  354          {
"SG", 
N_( 
"Singapore" ) },                                 
 
  355          {
"SH", 
N_( 
"Saint Helena" ) },                      
 
  356          {
"SI", 
N_( 
"Slovenia" ) },                          
 
  357          {
"SJ", 
N_( 
"Svalbard and Jan Mayen" ) },            
 
  358          {
"SK", 
N_( 
"Slovakia" ) },                          
 
  359          {
"SL", 
N_( 
"Sierra Leone" ) },                      
 
  360          {
"SM", 
N_( 
"San Marino" ) },                                
 
  361          {
"SN", 
N_( 
"Senegal" ) },                           
 
  362          {
"SO", 
N_( 
"Somalia" ) },                           
 
  363          {
"SR", 
N_( 
"Suriname" ) },                          
 
  364          {
"ST", 
N_( 
"Sao Tome and Principe" ) },             
 
  365          {
"SV", 
N_( 
"El Salvador" ) },                       
 
  366          {
"SY", 
N_( 
"Syria" ) },                             
 
  367          {
"SZ", 
N_( 
"Swaziland" ) },                                 
 
  368          {
"TC", 
N_( 
"Turks and Caicos Islands" ) },          
 
  369          {
"TD", 
N_( 
"Chad" ) },                              
 
  370          {
"TF", 
N_( 
"French Southern Territories" ) },       
 
  371          {
"TG", 
N_( 
"Togo" ) },                              
 
  372          {
"TH", 
N_( 
"Thailand" ) },                          
 
  373          {
"TJ", 
N_( 
"Tajikistan" ) },                                
 
  374          {
"TK", 
N_( 
"Tokelau" ) },                           
 
  375          {
"TM", 
N_( 
"Turkmenistan" ) },                      
 
  376          {
"TN", 
N_( 
"Tunisia" ) },                           
 
  377          {
"TO", 
N_( 
"Tonga" ) },                             
 
  378          {
"TL", 
N_( 
"East Timor" ) },                                
 
  379          {
"TR", 
N_( 
"Turkey" ) },                            
 
  380          {
"TT", 
N_( 
"Trinidad and Tobago" ) },               
 
  381          {
"TV", 
N_( 
"Tuvalu" ) },                            
 
  382          {
"TW", 
N_( 
"Taiwan" ) },                            
 
  383          {
"TZ", 
N_( 
"Tanzania" ) },                          
 
  384          {
"UA", 
N_( 
"Ukraine" ) },                           
 
  385          {
"UG", 
N_( 
"Uganda" ) },                            
 
  386          {
"UM", 
N_( 
"United States Minor Outlying Islands" ) },
 
  387          {
"US", 
N_( 
"United States" ) },                     
 
  388          {
"UY", 
N_( 
"Uruguay" ) },                           
 
  389          {
"UZ", 
N_( 
"Uzbekistan" ) },                                
 
  390          {
"VA", 
N_( 
"Holy See (Vatican City State)" ) },     
 
  391          {
"VC", 
N_( 
"Saint Vincent and the Grenadines" ) },  
 
  392          {
"VE", 
N_( 
"Venezuela" ) },                                 
 
  393          {
"VG", 
N_( 
"British Virgin Islands" ) },            
 
  394          {
"VI", 
N_( 
"Virgin Islands, U.S." ) },              
 
  395          {
"VN", 
N_( 
"Vietnam" ) },                           
 
  396          {
"VU", 
N_( 
"Vanuatu" ) },                           
 
  397          {
"WF", 
N_( 
"Wallis and Futuna" ) },                         
 
  398          {
"WS", 
N_( 
"Samoa" ) },                             
 
  399          {
"YE", 
N_( 
"Yemen" ) },                             
 
  400          {
"YT", 
N_( 
"Mayotte" ) },                           
 
  401          {
"ZA", 
N_( 
"South Africa" ) },                      
 
  402          {
"ZM", 
N_( 
"Zambia" ) },                            
 
  403          {
"ZW", 
N_( 
"Zimbabwe" ) },                          
 
  408      for (
const Init * i = init; i->iso3166 != NULL; ++i)
 
  409          _codeMap[i->iso3166] = i->name;
 
Country codes (iso3166-1-alpha-2).
std::string name() const
Return the translated country name; if unknown the country code.
static const CountryCode noCode
Empty code.
CountryCode()
Default Ctor: noCode.
Access to the sat-pools string space.
std::string toUpper(const std::string &s)
Return uppercase version of s.
Easy-to use interface to the ZYPP dependency resolver.
CodeMaps()
Ctor initializes the code maps.
const LC & getIndex(IdString index_r)
Return LC for index_r, creating it if necessary.
std::string name(IdString index_r)
static CodeMaps & instance()
The singleton.