|
dasmig-core 1.2.0
Shared random engine, distributions and data tiers for the dasmig generator libraries
|
Helpers for ISO 3166-1 alpha-2 country codes. More...
#include <stdexcept>#include <string>#include <string_view>Go to the source code of this file.
Functions | |
| constexpr bool | dasmig::core::is_alpha2 (std::string_view code) noexcept |
| Whether text has the shape of an ISO 3166-1 alpha-2 code: exactly two capital ASCII letters. | |
| std::invalid_argument | dasmig::core::unknown_country_error (std::string_view code) |
The exception libraries throw for a country code they have no data for. Its message is Unknown country code: <code>. | |
Helpers for ISO 3166-1 alpha-2 country codes.
Definition in file country.hpp.
|
constexprnoexcept |
Whether text has the shape of an ISO 3166-1 alpha-2 code: exactly two capital ASCII letters.
This checks the shape only. It does not know which codes are assigned or which a library has data for.
| code | Text to check. |
true for "BR", false for "br", "BRA", "" or "B1". Definition at line 26 of file country.hpp.
|
inline |
The exception libraries throw for a country code they have no data for. Its message is Unknown country code: <code>.
| code | The code that was not found. |
std::invalid_argument to throw. Definition at line 40 of file country.hpp.