![]() |
Country Generator 3.3.2
Procedural country generation for C++23
|
Return type for country generation, holding all data fields. More...
#include <countrygen.hpp>
Public Member Functions | |
| std::vector< std::string > | language_list () const |
The language names of languages as a list. | |
| std::vector< language_share > | language_distribution () const |
| The languages and the share of the population that speaks each. | |
| std::string | primary_language () const |
| The language most of the population speaks. | |
| const std::string & | demonym (sex bio_sex) const |
| The English demonym for a person of this country. | |
| std::uint64_t | seed () const |
| Retrieve the random seed used to generate this country. | |
| const core::seed_signature & | signature () const |
| The seed and the data this country was drawn from. | |
| void | to_json (core::json_writer &w) const |
| Write this country as a JSON object. | |
| std::string | to_json () const |
| This country as a JSON document. | |
| operator std::string () const | |
| Implicit conversion to std::string. | |
Public Attributes | |
| std::string | cca2 |
| ISO 3166-1 alpha-2 code (e.g. "BR"). | |
| std::string | cca3 |
| ISO 3166-1 alpha-3 code (e.g. "BRA"). | |
| std::string | ccn3 |
| ISO 3166-1 numeric code (e.g. "076"). | |
| std::string | name_common |
| Common English name (e.g. "Brazil"). | |
| std::string | name_official |
| Official English name (e.g. "Federative Republic of Brazil"). | |
| std::string | capital |
| Capital city (semicolon-separated if multiple). | |
| std::string | region |
| UN geoscheme region (e.g. "Americas"). | |
| std::string | subregion |
| UN geoscheme subregion (e.g. "South America"). | |
| std::string | continent |
| Continent (semicolon-separated if multiple). | |
| double | latitude {0.0} |
| WGS84 latitude in decimal degrees. | |
| double | longitude {0.0} |
| WGS84 longitude in decimal degrees. | |
| std::uint64_t | area {0} |
| Total land area in km². | |
| std::uint64_t | population {0} |
| Total population. | |
| bool | landlocked {false} |
| Whether the country is landlocked. | |
| bool | independent {false} |
| Whether the country is an independent sovereign state. | |
| bool | un_member {false} |
| Whether the country is a UN member. | |
| std::string | languages |
| Semicolon-separated language names (e.g. "Portuguese"). | |
| std::string | language_shares |
Semicolon-separated Name:percent pairs, largest first, for the languages at least 1% of the population speaks (for example "Portuguese:91;English:8"); empty when the data has none. | |
| std::string | currency_code |
| Primary ISO 4217 currency code (e.g. "BRL"). | |
| std::string | currency_name |
| Primary currency name (e.g. "Brazilian real"). | |
| std::string | currency_symbol |
| Primary currency symbol (e.g. "R$"). | |
| std::string | borders |
| Semicolon-separated ISO alpha-3 border codes. | |
| std::string | timezones |
| Semicolon-separated UTC offset strings. | |
| std::string | driving_side |
| Driving side: "right" or "left". | |
| std::string | tld |
| Country-code top-level domain (e.g. ".br"). | |
| std::string | idd_root |
| IDD root (e.g. "+5"). | |
| std::string | idd_suffix |
| IDD primary suffix (e.g. "5"). | |
| std::string | demonym_m |
| English male demonym (e.g. "Brazilian"). | |
| std::string | demonym_f |
| English female demonym (e.g. "Brazilian"). | |
| std::string | flag_emoji |
| Unicode flag emoji. | |
| std::string | income_level |
| World Bank income level (e.g. "Upper middle income"). | |
| std::string | start_of_week |
| Start of the week: "monday", "sunday", or "saturday". | |
Friends | |
| class | cntg |
| std::ostream & | operator<< (std::ostream &os, const country &c) |
| Stream the common name to an output stream. | |
Return type for country generation, holding all data fields.
Supports implicit conversion to std::string (returns the common name), streaming via operator<< and JSON output via to_json().
Definition at line 58 of file countrygen.hpp.
|
inline |
The English demonym for a person of this country.
| bio_sex | The person's sex. |
demonym_m or demonym_f, falling back to the other when empty. Definition at line 213 of file countrygen.hpp.
|
inline |
The languages and the share of the population that speaks each.
language_shares parsed, largest first; empty when the data has none. Definition at line 195 of file countrygen.hpp.
|
inline |
The language names of languages as a list.
Definition at line 180 of file countrygen.hpp.
|
inline |
Implicit conversion to std::string.
Definition at line 307 of file countrygen.hpp.
|
inline |
The language most of the population speaks.
languages, else empty. Definition at line 202 of file countrygen.hpp.
|
inline |
Retrieve the random seed used to generate this country.
Definition at line 224 of file countrygen.hpp.
|
inline |
The seed and the data this country was drawn from.
data is cntg::data_hash() at the time of generation. Definition at line 232 of file countrygen.hpp.
|
inline |
This country as a JSON document.
Definition at line 298 of file countrygen.hpp.
|
inline |
Write this country as a JSON object.
Semicolon-separated fields (capital, continent, languages, borders, timezones) are written as arrays.
| w | Writer positioned where a value is allowed. |
Definition at line 243 of file countrygen.hpp.
|
friend |
Definition at line 357 of file countrygen.hpp.
|
friend |
Stream the common name to an output stream.
| os | Output stream. |
| c | Country to stream. |
Definition at line 316 of file countrygen.hpp.
| std::uint64_t dasmig::country::area {0} |
Total land area in km².
Definition at line 99 of file countrygen.hpp.
| std::string dasmig::country::borders |
Semicolon-separated ISO alpha-3 border codes.
Definition at line 140 of file countrygen.hpp.
| std::string dasmig::country::capital |
Capital city (semicolon-separated if multiple).
Definition at line 79 of file countrygen.hpp.
| std::string dasmig::country::cca2 |
ISO 3166-1 alpha-2 code (e.g. "BR").
Definition at line 64 of file countrygen.hpp.
| std::string dasmig::country::cca3 |
ISO 3166-1 alpha-3 code (e.g. "BRA").
Definition at line 67 of file countrygen.hpp.
| std::string dasmig::country::ccn3 |
ISO 3166-1 numeric code (e.g. "076").
Definition at line 70 of file countrygen.hpp.
| std::string dasmig::country::continent |
Continent (semicolon-separated if multiple).
Definition at line 90 of file countrygen.hpp.
| std::string dasmig::country::currency_code |
Primary ISO 4217 currency code (e.g. "BRL").
Definition at line 129 of file countrygen.hpp.
| std::string dasmig::country::currency_name |
Primary currency name (e.g. "Brazilian real").
Definition at line 132 of file countrygen.hpp.
| std::string dasmig::country::currency_symbol |
Primary currency symbol (e.g. "R$").
Definition at line 135 of file countrygen.hpp.
| std::string dasmig::country::demonym_f |
English female demonym (e.g. "Brazilian").
Definition at line 165 of file countrygen.hpp.
| std::string dasmig::country::demonym_m |
English male demonym (e.g. "Brazilian").
Definition at line 162 of file countrygen.hpp.
| std::string dasmig::country::driving_side |
Driving side: "right" or "left".
Definition at line 146 of file countrygen.hpp.
| std::string dasmig::country::flag_emoji |
Unicode flag emoji.
Definition at line 168 of file countrygen.hpp.
| std::string dasmig::country::idd_root |
IDD root (e.g. "+5").
Definition at line 154 of file countrygen.hpp.
| std::string dasmig::country::idd_suffix |
IDD primary suffix (e.g. "5").
Definition at line 157 of file countrygen.hpp.
| std::string dasmig::country::income_level |
World Bank income level (e.g. "Upper middle income").
Definition at line 171 of file countrygen.hpp.
| bool dasmig::country::independent {false} |
Whether the country is an independent sovereign state.
Definition at line 110 of file countrygen.hpp.
| bool dasmig::country::landlocked {false} |
Whether the country is landlocked.
Definition at line 105 of file countrygen.hpp.
| std::string dasmig::country::language_shares |
Semicolon-separated Name:percent pairs, largest first, for the languages at least 1% of the population speaks (for example "Portuguese:91;English:8"); empty when the data has none.
Each percent is the share of people who speak that language, so they overlap and can sum above 100. Use language_distribution() to read them.
Definition at line 126 of file countrygen.hpp.
| std::string dasmig::country::languages |
Semicolon-separated language names (e.g. "Portuguese").
Definition at line 118 of file countrygen.hpp.
| double dasmig::country::latitude {0.0} |
WGS84 latitude in decimal degrees.
Definition at line 93 of file countrygen.hpp.
| double dasmig::country::longitude {0.0} |
WGS84 longitude in decimal degrees.
Definition at line 96 of file countrygen.hpp.
| std::string dasmig::country::name_common |
Common English name (e.g. "Brazil").
Definition at line 73 of file countrygen.hpp.
| std::string dasmig::country::name_official |
Official English name (e.g. "Federative Republic of Brazil").
Definition at line 76 of file countrygen.hpp.
| std::uint64_t dasmig::country::population {0} |
Total population.
Definition at line 102 of file countrygen.hpp.
| std::string dasmig::country::region |
UN geoscheme region (e.g. "Americas").
Definition at line 84 of file countrygen.hpp.
| std::string dasmig::country::start_of_week |
Start of the week: "monday", "sunday", or "saturday".
Definition at line 174 of file countrygen.hpp.
| std::string dasmig::country::subregion |
UN geoscheme subregion (e.g. "South America").
Definition at line 87 of file countrygen.hpp.
| std::string dasmig::country::timezones |
Semicolon-separated UTC offset strings.
Definition at line 143 of file countrygen.hpp.
| std::string dasmig::country::tld |
Country-code top-level domain (e.g. ".br").
Definition at line 151 of file countrygen.hpp.
| bool dasmig::country::un_member {false} |
Whether the country is a UN member.
Definition at line 113 of file countrygen.hpp.