Skip to content

Commit

Permalink
Update location_data.h
Browse files Browse the repository at this point in the history
added continents
  • Loading branch information
charan-003 authored Nov 16, 2024
1 parent 58d922c commit f522f55
Showing 1 changed file with 264 additions and 0 deletions.
264 changes: 264 additions & 0 deletions src/modules/location_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
#include <span>
#include <string_view>

#include <unordered_map>
namespace faker::location
{
std::string_view continent();
}

namespace faker::location
{
struct CountryAddressesInfo
Expand All @@ -23,6 +29,264 @@ struct CountryAddressesInfo
std::span<const std::string_view> states;
};

const auto allContinents = std::to_array<std::string_view>({
"Africa",
"Antarctica",
"Asia",
"Europe",
"North America",
"Oceania",
"South America"
});
const std::unordered_map<std::string_view, std::string_view> countryToContinent = {
{"Afghanistan", "Asia"},
{"Aland Islands", "Europe"},
{"Albania", "Europe"},
{"Algeria", "Africa"},
{"American Samoa", "Oceania"},
{"Andorra", "Europe"},
{"Angola", "Africa"},
{"Anguilla", "North America"},
{"Antarctica", "Antarctica"},
{"Antigua and Barbuda", "North America"},
{"Argentina", "South America"},
{"Armenia", "Asia"},
{"Aruba", "North America"},
{"Australia", "Oceania"},
{"Austria", "Europe"},
{"Azerbaijan", "Asia"},
{"Bahamas", "North America"},
{"Bahrain", "Asia"},
{"Bangladesh", "Asia"},
{"Barbados", "North America"},
{"Belarus", "Europe"},
{"Belgium", "Europe"},
{"Belize", "North America"},
{"Benin", "Africa"},
{"Bermuda", "North America"},
{"Bhutan", "Asia"},
{"Bolivia", "South America"},
{"Bonaire Sint Eustatius and Saba", "North America"},
{"Bosnia and Herzegovina", "Europe"},
{"Botswana", "Africa"},
{"Bouvet Island", "Antarctica"},
{"Brazil", "South America"},
{"British Indian Ocean Territory (Chagos Archipelago)", "Asia"},
{"Brunei Darussalam", "Asia"},
{"Bulgaria", "Europe"},
{"Burkina Faso", "Africa"},
{"Burundi", "Africa"},
{"Cambodia", "Asia"},
{"Cameroon", "Africa"},
{"Canada", "North America"},
{"Cape Verde", "Africa"},
{"Cayman Islands", "North America"},
{"Central African Republic", "Africa"},
{"Chad", "Africa"},
{"Chile", "South America"},
{"China", "Asia"},
{"Christmas Island", "Asia"},
{"Cocos (Keeling) Islands", "Asia"},
{"Colombia", "South America"},
{"Comoros", "Africa"},
{"Congo", "Africa"},
{"Cook Islands", "Oceania"},
{"Costa Rica", "North America"},
{"Croatia", "Europe"},
{"Cuba", "North America"},
{"Curacao", "North America"},
{"Cyprus", "Asia"},
{"Czechia", "Europe"},
{"Democratic Republic of the Congo", "Africa"},
{"Denmark", "Europe"},
{"Djibouti", "Africa"},
{"Dominica", "North America"},
{"Dominican Republic", "North America"},
{"Ecuador", "South America"},
{"Egypt", "Africa"},
{"El Salvador", "North America"},
{"Equatorial Guinea", "Africa"},
{"Eritrea", "Africa"},
{"Estonia", "Europe"},
{"Eswatini", "Africa"},
{"Ethiopia", "Africa"},
{"Falkland Islands (Malvinas)", "South America"},
{"Faroe Islands", "Europe"},
{"Fiji", "Oceania"},
{"Finland", "Europe"},
{"France", "Europe"},
{"French Guiana", "South America"},
{"French Polynesia", "Oceania"},
{"French Southern Territories", "Antarctica"},
{"Gabon", "Africa"},
{"Gambia", "Africa"},
{"Georgia", "Asia"},
{"Germany", "Europe"},
{"Ghana", "Africa"},
{"Gibraltar", "Europe"},
{"Greece", "Europe"},
{"Greenland", "North America"},
{"Grenada", "North America"},
{"Guadeloupe", "North America"},
{"Guam", "Oceania"},
{"Guatemala", "North America"},
{"Guernsey", "Europe"},
{"Guinea", "Africa"},
{"Guinea-Bissau", "Africa"},
{"Guyana", "South America"},
{"Haiti", "North America"},
{"Heard Island and McDonald Islands", "Antarctica"},
{"Holy See (Vatican City State)", "Europe"},
{"Honduras", "North America"},
{"Hong Kong", "Asia"},
{"Hungary", "Europe"},
{"Iceland", "Europe"},
{"India", "Asia"},
{"Indonesia", "Asia"},
{"Iran", "Asia"},
{"Iraq", "Asia"},
{"Ireland", "Europe"},
{"Isle of Man", "Europe"},
{"Israel", "Asia"},
{"Italy", "Europe"},
{"Jamaica", "North America"},
{"Japan", "Asia"},
{"Jersey", "Europe"},
{"Jordan", "Asia"},
{"Kazakhstan", "Asia"},
{"Kenya", "Africa"},
{"Kiribati", "Oceania"},
{"Kuwait", "Asia"},
{"Kyrgyz Republic", "Asia"},
{"Latvia", "Europe"},
{"Lebanon", "Asia"},
{"Lesotho", "Africa"},
{"Liberia", "Africa"},
{"Libyan Arab Jamahiriya", "Africa"},
{"Liechtenstein", "Europe"},
{"Lithuania", "Europe"},
{"Luxembourg", "Europe"},
{"Macao", "Asia"},
{"Madagascar", "Africa"},
{"Malawi", "Africa"},
{"Malaysia", "Asia"},
{"Maldives", "Asia"},
{"Mali", "Africa"},
{"Malta", "Europe"},
{"Marshall Islands", "Oceania"},
{"Martinique", "North America"},
{"Mauritania", "Africa"},
{"Mauritius", "Africa"},
{"Mayotte", "Africa"},
{"Mexico", "North America"},
{"Micronesia", "Oceania"},
{"Moldova", "Europe"},
{"Monaco", "Europe"},
{"Mongolia", "Asia"},
{"Montenegro", "Europe"},
{"Montserrat", "North America"},
{"Morocco", "Africa"},
{"Mozambique", "Africa"},
{"Myanmar", "Asia"},
{"Namibia", "Africa"},
{"Nauru", "Oceania"},
{"Nepal", "Asia"},
{"Netherlands", "Europe"},
{"New Caledonia", "Oceania"},
{"New Zealand", "Oceania"},
{"Nicaragua", "North America"},
{"Niger", "Africa"},
{"Nigeria", "Africa"},
{"Niue", "Oceania"},
{"Norfolk Island", "Oceania"},
{"North Macedonia", "Europe"},
{"Northern Mariana Islands", "Oceania"},
{"Norway", "Europe"},
{"Oman", "Asia"},
{"Pakistan", "Asia"},
{"Palau", "Oceania"},
{"Palestine", "Asia"},
{"Panama", "North America"},
{"Papua New Guinea", "Oceania"},
{"Paraguay", "South America"},
{"Peru", "South America"},
{"Philippines", "Asia"},
{"Pitcairn Islands", "Oceania"},
{"Poland", "Europe"},
{"Portugal", "Europe"},
{"Puerto Rico", "North America"},
{"Qatar", "Asia"},
{"Republic of Korea", "Asia"},
{"Reunion", "Africa"},
{"Romania", "Europe"},
{"Russian Federation", "Europe/Asia"},
{"Rwanda", "Africa"},
{"Saint Barthelemy", "North America"},
{"Saint Helena", "Africa"},
{"Saint Kitts and Nevis", "North America"},
{"Saint Lucia", "North America"},
{"Saint Martin", "North America"},
{"Saint Pierre and Miquelon", "North America"},
{"Saint Vincent and the Grenadines", "North America"},
{"Samoa", "Oceania"},
{"San Marino", "Europe"},
{"Sao Tome and Principe", "Africa"},
{"Saudi Arabia", "Asia"},
{"Senegal", "Africa"},
{"Serbia", "Europe"},
{"Seychelles", "Africa"},
{"Sierra Leone", "Africa"},
{"Singapore", "Asia"},
{"Sint Maarten", "North America"},
{"Slovakia", "Europe"},
{"Slovenia", "Europe"},
{"Solomon Islands", "Oceania"},
{"Somalia", "Africa"},
{"South Africa", "Africa"},
{"South Georgia and the South Sandwich Islands", "Antarctica"},
{"South Sudan", "Africa"},
{"Spain", "Europe"},
{"Sri Lanka", "Asia"},
{"Sudan", "Africa"},
{"Suriname", "South America"},
{"Svalbard & Jan Mayen Islands", "Europe"},
{"Sweden", "Europe"},
{"Switzerland", "Europe"},
{"Syrian Arab Republic", "Asia"},
{"Taiwan", "Asia"},
{"Tajikistan", "Asia"},
{"Tanzania", "Africa"},
{"Thailand", "Asia"},
{"Timor-Leste", "Asia"},
{"Togo", "Africa"},
{"Tokelau", "Oceania"},
{"Tonga", "Oceania"},
{"Trinidad and Tobago", "North America"},
{"Tunisia", "Africa"},
{"Turkey", "Asia/Europe"},
{"Turkmenistan", "Asia"},
{"Turks and Caicos Islands", "North America"},
{"Tuvalu", "Oceania"},
{"Uganda", "Africa"},
{"Ukraine", "Europe"},
{"United Arab Emirates", "Asia"},
{"United Kingdom", "Europe"},
{"United States Minor Outlying Islands", "Oceania"},
{"United States of America", "North America"},
{"Uruguay", "South America"},
{"Uzbekistan", "Asia"},
{"Vanuatu", "Oceania"},
{"Venezuela", "South America"},
{"Vietnam", "Asia"},
{"Virgin Islands British", "North America"},
{"Virgin Islands U.S.", "North America"},
{"Wallis and Futuna", "Oceania"},
{"Western Sahara", "Africa"},
{"Yemen", "Asia"},
{"Zambia", "Africa"},
{"Zimbabwe", "Africa"}
};

const auto allCountries = std::to_array<std::string_view>({
// clang-format off
"Afghanistan",
Expand Down

0 comments on commit f522f55

Please sign in to comment.