KCountry
#include <KCountry>
Properties | |
QString | alpha2 |
QString | alpha3 |
QString | currencyCode |
QString | emojiFlag |
QString | name |
QList< KCountrySubdivision > | subdivisions |
QStringList | timeZoneIds |
Public Member Functions | |
KCountry () | |
KCountry (const KCountry &) | |
QString | alpha2 () const |
QString | alpha3 () const |
QLocale::Country | country () const |
QString | currencyCode () const |
QString | emojiFlag () const |
bool | isValid () const |
QString | name () const |
bool | operator!= (const KCountry &other) const |
KCountry & | operator= (const KCountry &) |
bool | operator== (const KCountry &other) const |
QList< KCountrySubdivision > | subdivisions () const |
QList< const char * > | timeZoneIds () const |
Static Public Member Functions | |
static QList< KCountry > | allCountries () |
static KCountry | fromAlpha2 (const char *alpha2Code) |
static KCountry | fromAlpha2 (QStringView alpha2Code) |
static KCountry | fromAlpha3 (const char *alpha3Code) |
static KCountry | fromAlpha3 (QStringView alpha3Code) |
static KCountry | fromLocation (float latitude, float longitude) |
static KCountry | fromName (QStringView name) |
static KCountry | fromQLocale (QLocale::Country country) |
Detailed Description
Information about an ISO 3166-1 country.
The information provided here are aggregated from the following sources:
- Note
- This requires the iso-codes data files and translation catalogs to be available at runtime.
- Since
- 5.88
Definition at line 39 of file kcountry.h.
Property Documentation
◆ alpha2
|
read |
Definition at line 42 of file kcountry.h.
◆ alpha3
|
read |
Definition at line 43 of file kcountry.h.
◆ currencyCode
|
read |
Definition at line 46 of file kcountry.h.
◆ emojiFlag
|
read |
Definition at line 45 of file kcountry.h.
◆ name
|
read |
Definition at line 44 of file kcountry.h.
◆ subdivisions
|
read |
Definition at line 47 of file kcountry.h.
◆ timeZoneIds
|
read |
Definition at line 48 of file kcountry.h.
Constructor & Destructor Documentation
◆ KCountry()
KCountry::KCountry | ( | ) |
Creates an invalid/empty KCountry instance.
See the fromX() methods for creating a valid instance.
Definition at line 22 of file kcountry.cpp.
Member Function Documentation
◆ allCountries()
List all countries.
Definition at line 403 of file kcountry.cpp.
◆ alpha2()
QString KCountry::alpha2 | ( | ) | const |
ISO 3166-1 alpha 2 country code.
Definition at line 47 of file kcountry.cpp.
◆ alpha3()
QString KCountry::alpha3 | ( | ) | const |
ISO 3166-1 alpha 3 country code.
Definition at line 59 of file kcountry.cpp.
◆ country()
QLocale::Country KCountry::country | ( | ) | const |
Returns the QLocale::Country value matching this country, or QLocale::AnyCountry if there is none.
Definition at line 108 of file kcountry.cpp.
◆ currencyCode()
QString KCountry::currencyCode | ( | ) | const |
Currency used in this country as ISO 4217 code.
Definition at line 147 of file kcountry.cpp.
◆ emojiFlag()
QString KCountry::emojiFlag | ( | ) | const |
Returns the Unicode flag emoji for this country.
Definition at line 93 of file kcountry.cpp.
◆ fromAlpha2() [1/2]
|
static |
Create a KCountry instance from an ISO 3166-1 alpha 2 code.
Definition at line 222 of file kcountry.cpp.
◆ fromAlpha2() [2/2]
|
static |
Create a KCountry instance from an ISO 3166-1 alpha 2 code.
Definition at line 215 of file kcountry.cpp.
◆ fromAlpha3() [1/2]
|
static |
Create a KCountry instance from an ISO 3166-1 alpha 3 code.
Definition at line 254 of file kcountry.cpp.
◆ fromAlpha3() [2/2]
|
static |
Create a KCountry instance from an ISO 3166-1 alpha 3 code.
Definition at line 247 of file kcountry.cpp.
◆ fromLocation()
|
static |
Looks up the country at the given geographic coordinate.
This can return an invalid object if the country could not be determined. This can happen in a number of cases:
- on oceans
- in polar regions
- close to a land border
- in disputed territories
Definition at line 264 of file kcountry.cpp.
◆ fromName()
|
static |
Attempts to identify the country from the given name.
The name can be in any language.
Definition at line 347 of file kcountry.cpp.
◆ fromQLocale()
|
static |
Returns a KCountry instance matching the given QLocale::Country code.
Definition at line 272 of file kcountry.cpp.
◆ isValid()
bool KCountry::isValid | ( | ) | const |
Returns false
if this is an empty/invalid/default constructed instance, true
otherwise.
Definition at line 42 of file kcountry.cpp.
◆ name()
QString KCountry::name | ( | ) | const |
Translated country name.
Definition at line 78 of file kcountry.cpp.
◆ operator!=()
bool KCountry::operator!= | ( | const KCountry & | other | ) | const |
Definition at line 37 of file kcountry.cpp.
◆ operator==()
bool KCountry::operator== | ( | const KCountry & | other | ) | const |
Definition at line 32 of file kcountry.cpp.
◆ subdivisions()
QList< KCountrySubdivision > KCountry::subdivisions | ( | ) | const |
Highest level of ISO 3166-2 country subdivisions.
If there is only one level of subdivisions this lists all of them, for countries with multiple levels, this only includes the top-level subdivisions (ie. those having no parent subdivision).
- Note
- : This can be empty.
Definition at line 166 of file kcountry.cpp.
◆ timeZoneIds()
QList< const char * > KCountry::timeZoneIds | ( | ) | const |
Timezones in use in this country.
Definition at line 117 of file kcountry.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:34 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.