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.

Property Documentation

◆ alpha2

QString KCountry::alpha2
read

Definition at line 42 of file kcountry.h.

◆ alpha3

QString KCountry::alpha3
read

Definition at line 43 of file kcountry.h.

◆ currencyCode

QString KCountry::currencyCode
read

Definition at line 46 of file kcountry.h.

◆ emojiFlag

QString KCountry::emojiFlag
read

Definition at line 45 of file kcountry.h.

◆ name

QString KCountry::name
read

Definition at line 44 of file kcountry.h.

◆ subdivisions

QList<KCountrySubdivision> KCountry::subdivisions
read

Definition at line 47 of file kcountry.h.

◆ timeZoneIds

QStringList KCountry::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 20 of file kcountry.cpp.

Member Function Documentation

◆ allCountries()

QList< KCountry > KCountry::allCountries ( )
static

List all countries.

Definition at line 383 of file kcountry.cpp.

◆ alpha2()

QString KCountry::alpha2 ( ) const

ISO 3166-1 alpha 2 country code.

Definition at line 45 of file kcountry.cpp.

◆ alpha3()

QString KCountry::alpha3 ( ) const

ISO 3166-1 alpha 3 country code.

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

◆ currencyCode()

QString KCountry::currencyCode ( ) const

Currency used in this country as ISO 4217 code.

Definition at line 145 of file kcountry.cpp.

◆ emojiFlag()

QString KCountry::emojiFlag ( ) const

Returns the Unicode flag emoji for this country.

Definition at line 91 of file kcountry.cpp.

◆ 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 220 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 213 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 252 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 245 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 262 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 327 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 270 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 40 of file kcountry.cpp.

◆ name()

QString KCountry::name ( ) const

Translated country name.

Definition at line 76 of file kcountry.cpp.

◆ operator!=()

bool KCountry::operator!= ( const KCountry & other) const

Definition at line 35 of file kcountry.cpp.

◆ operator==()

bool KCountry::operator== ( const KCountry & other) const

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

◆ timeZoneIds()

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

Timezones in use in this country.

Definition at line 115 of file kcountry.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:50:46 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.