KCountry

Search for usage in LXR

#include <KCountry>

Properties

QString alpha2
 
QString alpha3
 
QString currencyCode
 
QString emojiFlag
 
QString name
 
QList< KCountrySubdivisionsubdivisions
 
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
 
KCountryoperator= (const KCountry &)
 
bool operator== (const KCountry &other) const
 
QList< KCountrySubdivisionsubdivisions () const
 
QList< const char * > timeZoneIds () const
 

Static Public Member Functions

static QList< KCountryallCountries ()
 
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.

Constructor & Destructor Documentation

◆ KCountry()

KCountry::KCountry ( )

Creates an invalid/empty KCountry instance.

See the fromX() methods for creating a valid instance.

Definition at line 24 of file kcountry.cpp.

Member Function Documentation

◆ allCountries()

QList< KCountry > KCountry::allCountries ( )
static

List all countries.

Definition at line 395 of file kcountry.cpp.

◆ alpha2()

QString KCountry::alpha2 ( ) const

ISO 3166-1 alpha 2 country code.

◆ alpha3()

QString KCountry::alpha3 ( ) const

ISO 3166-1 alpha 3 country code.

◆ country()

QLocale::Country KCountry::country ( ) const

Returns the QLocale::Country value matching this country, or QLocale::AnyCountry if there is none.

Definition at line 110 of file kcountry.cpp.

◆ currencyCode()

QString KCountry::currencyCode ( ) const

Currency used in this country as ISO 4217 code.

◆ emojiFlag()

QString KCountry::emojiFlag ( ) const

Returns the Unicode flag emoji for this country.

◆ fromAlpha2() [1/2]

KCountry KCountry::fromAlpha2 ( const char *  alpha2Code)
static

Create a KCountry instance from an ISO 3166-1 alpha 2 code.

Definition at line 228 of file kcountry.cpp.

◆ fromAlpha2() [2/2]

KCountry KCountry::fromAlpha2 ( QStringView  alpha2Code)
static

Create a KCountry instance from an ISO 3166-1 alpha 2 code.

Definition at line 221 of file kcountry.cpp.

◆ fromAlpha3() [1/2]

KCountry KCountry::fromAlpha3 ( const char *  alpha3Code)
static

Create a KCountry instance from an ISO 3166-1 alpha 3 code.

Definition at line 260 of file kcountry.cpp.

◆ fromAlpha3() [2/2]

KCountry KCountry::fromAlpha3 ( QStringView  alpha3Code)
static

Create a KCountry instance from an ISO 3166-1 alpha 3 code.

Definition at line 253 of file kcountry.cpp.

◆ fromLocation()

KCountry KCountry::fromLocation ( float  latitude,
float  longitude 
)
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 270 of file kcountry.cpp.

◆ fromName()

KCountry KCountry::fromName ( QStringView  name)
static

Attempts to identify the country from the given name.

The name can be in any language.

Definition at line 339 of file kcountry.cpp.

◆ fromQLocale()

KCountry KCountry::fromQLocale ( QLocale::Country  country)
static

Returns a KCountry instance matching the given QLocale::Country code.

Definition at line 278 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 44 of file kcountry.cpp.

◆ name()

QString KCountry::name ( ) const

Translated country name.

◆ 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.

◆ timeZoneIds()

QList<const char *> KCountry::timeZoneIds ( ) const

Timezones in use in this country.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Sep 26 2023 03:59:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.