QtlMovie 1.12 (A specialized FFmpeg front-end)
QtlIsoLanguages Class Reference

Using ISO language and country codes. More...

Inheritance diagram for QtlIsoLanguages:

Public Member Functions

QStringList country2LetterCodes () const
 Get the sorted list of all ISO 3166 2-letter codes for country names. More...
 
QStringList country3DigitCodes () const
 Get the sorted list of all ISO 3166 3-digit codes for country names. More...
 
QStringList country3LetterCodes () const
 Get the sorted list of all ISO 3166 3-letter codes for country names. More...
 
QString countryName (const QString &code, const QString &defaultValue=QString()) const
 Get a localized country name from a country code. More...
 
QStringList language2LetterCodes () const
 Get the sorted list of all ISO 639-1 2-letter codes for language names. More...
 
QStringList language3LetterCodes () const
 Get the sorted list of all ISO 639-2 3-letter codes for language names. More...
 
QString languageName (const QString &code, const QString &defaultValue=QString()) const
 Get a localized language name from a language code. More...
 

Static Public Member Functions

static const QtlIsoLanguagesinstance ()
 Get the single instance of QtlIsoLanguages. More...
 

Private Types

typedef QMap< QString, QString > StringMap
 Mapping a string to another string. More...
 

Private Member Functions

 QtlIsoLanguages ()
 Private constructor. More...
 
void addCountry (const QString &code2, const QString &code3, const QString &digit3, const QString &name)
 Add an ISO 3166-1 country code. More...
 
void addLanguage (const QString &code3, const QString &code3alt, const QString &code2, const QString &name)
 Add an ISO 639 language code. More...
 
QStringList codeList (const StringMap &map) const
 Get the sorted list of all codes for a given map. More...
 

Private Attributes

StringMap _countryBy2Letter
 Map key = 2-letter code to value = country name. More...
 
StringMap _countryBy3Digit
 Map key = 3-digit code to value = country name. More...
 
StringMap _countryBy3Letter
 Map key = 3-letter code to value = country name. More...
 
StringMap _languageBy2Letter
 Map key = 2-letter code to value = language name. More...
 
StringMap _languageBy3Letter
 Map key = 3-letter code to value = language name. More...
 

Static Private Attributes

static const QtlIsoLanguages_instance
 Single instance. More...
 
static QMutex _instanceMutex
 Protect the creation of the mutex. More...
 

Detailed Description

Using ISO language and country codes.

The following standards are covered:

  • ISO 639-1: 2-letter codes for language names.
  • ISO 639-2: 3-letter codes for language names.
  • ISO 3166-1: 2 letter, 3-letter and 3-digit codes for country names.
See also
http://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt
http://www.davros.org/misc/iso3166.txt

Member Typedef Documentation

◆ StringMap

typedef QMap<QString, QString> QtlIsoLanguages::StringMap
private

Mapping a string to another string.

Constructor & Destructor Documentation

◆ QtlIsoLanguages()

QtlIsoLanguages::QtlIsoLanguages ( )
private

Private constructor.

Member Function Documentation

◆ instance()

const QtlIsoLanguages * QtlIsoLanguages::instance ( )
static

Get the single instance of QtlIsoLanguages.

Returns
The single instance of QtlIsoLanguages.

◆ languageName()

QString QtlIsoLanguages::languageName ( const QString &  code,
const QString &  defaultValue = QString() 
) const

Get a localized language name from a language code.

Parameters
codeThe language code as a string, either an ISO 639-1 2-letter code or an ISO 638-2 3-letter code.
defaultValueThe string value to return is code is not found. By default, return the code string if not found. If defaultValue is an explicit empty string (""), then the empty string will be returned if code is not found.
Returns
The corresponding language code or a default value if not found.

◆ countryName()

QString QtlIsoLanguages::countryName ( const QString &  code,
const QString &  defaultValue = QString() 
) const

Get a localized country name from a country code.

Parameters
codeThe ISO 6166-1 country code as a string, either a 2-letter, 3-letter or 3-digit code.
defaultValueThe string value to return is code is not found. By default, return the code string if not found. If defaultValue is an explicit empty string (""), then the empty string will be returned if code is not found.
Returns
The corresponding country code or a default value if not found.

◆ language2LetterCodes()

QStringList QtlIsoLanguages::language2LetterCodes ( ) const
inline

Get the sorted list of all ISO 639-1 2-letter codes for language names.

Returns
The sorted list of all ISO 639-1 2-letter codes for language names.

◆ language3LetterCodes()

QStringList QtlIsoLanguages::language3LetterCodes ( ) const
inline

Get the sorted list of all ISO 639-2 3-letter codes for language names.

Returns
The sorted list of all ISO 639-2 3-letter codes for language names.

◆ country2LetterCodes()

QStringList QtlIsoLanguages::country2LetterCodes ( ) const
inline

Get the sorted list of all ISO 3166 2-letter codes for country names.

Returns
The sorted list of all ISO 3166 2-letter codes for country names.

◆ country3LetterCodes()

QStringList QtlIsoLanguages::country3LetterCodes ( ) const
inline

Get the sorted list of all ISO 3166 3-letter codes for country names.

Returns
The sorted list of all ISO 3166 3-letter codes for country names.

◆ country3DigitCodes()

QStringList QtlIsoLanguages::country3DigitCodes ( ) const
inline

Get the sorted list of all ISO 3166 3-digit codes for country names.

Returns
The sorted list of all ISO 3166 3-digit codes for country names.

◆ codeList()

QStringList QtlIsoLanguages::codeList ( const StringMap map) const
private

Get the sorted list of all codes for a given map.

Returns
The sorted list of all codes for a given map.

◆ addLanguage()

void QtlIsoLanguages::addLanguage ( const QString &  code3,
const QString &  code3alt,
const QString &  code2,
const QString &  name 
)
private

Add an ISO 639 language code.

Parameters
[in]code3ISO 639-1 3-letter code.
[in]code3altOptional alternate ISO 639-1 3-letter code.
[in]code2ISO 639-1 2-letter code.
[in]nameLanguage name.

◆ addCountry()

void QtlIsoLanguages::addCountry ( const QString &  code2,
const QString &  code3,
const QString &  digit3,
const QString &  name 
)
private

Add an ISO 3166-1 country code.

Parameters
[in]code22-letter code.
[in]code33-letter code.
[in]digit33-digit code.
[in]nameCountry name.

Member Data Documentation

◆ _languageBy2Letter

StringMap QtlIsoLanguages::_languageBy2Letter
private

Map key = 2-letter code to value = language name.

◆ _languageBy3Letter

StringMap QtlIsoLanguages::_languageBy3Letter
private

Map key = 3-letter code to value = language name.

◆ _countryBy2Letter

StringMap QtlIsoLanguages::_countryBy2Letter
private

Map key = 2-letter code to value = country name.

◆ _countryBy3Letter

StringMap QtlIsoLanguages::_countryBy3Letter
private

Map key = 3-letter code to value = country name.

◆ _countryBy3Digit

StringMap QtlIsoLanguages::_countryBy3Digit
private

Map key = 3-digit code to value = country name.

◆ _instance

const QtlIsoLanguages * QtlIsoLanguages::_instance
staticprivate

Single instance.

◆ _instanceMutex

QMutex QtlIsoLanguages::_instanceMutex
staticprivate

Protect the creation of the mutex.


The documentation for this class was generated from the following files: