Multi diag tools
All Classes Namespaces Functions Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
Mdt::Translation::LanguageCode Class Reference

LanguageCode is a 2 letter ISO 639-1 laguage representation. More...

#include <LanguageCode.h>

Public Member Functions

 LanguageCode () noexcept
 Construct a null language code.
 
 LanguageCode (const char *const code)
 Construct a language code. More...
 
 LanguageCode (const LanguageCode &other)=default
 Copy construct a language code from other.
 
LanguageCodeoperator= (const LanguageCode &other)=default
 Copy assign other language code to this.
 
 LanguageCode (LanguageCode &&other)=default
 Move construct a language code from other.
 
LanguageCodeoperator= (LanguageCode &&other)=default
 Move assign other language code to this.
 
bool isNull () const noexcept
 Check if this language code is null.
 
QString toString () const
 Get a string version of this language code.
 

Static Public Member Functions

static LanguageCode fromString (const QString &code)
 Construct a language code from a string. More...
 
static LanguageCode fromLanguageCountry (const QString &languageCountry)
 Construct a language code from language_COUNTRY string. More...
 

Friends

bool operator== (const LanguageCode &a, const LanguageCode &b) noexcept
 Check if language code a is equal to b.
 
bool operator!= (const LanguageCode &a, const LanguageCode &b) noexcept
 Check if language code a is not equal to b.
 

Detailed Description

LanguageCode is a 2 letter ISO 639-1 laguage representation.

Definition at line 33 of file LanguageCode.h.

Constructor & Destructor Documentation

Mdt::Translation::LanguageCode::LanguageCode ( const char *const  code)
explicit

Construct a language code.

Precondition
code must contain exactly 2 lower case letters

Definition at line 33 of file LanguageCode.cpp.

Member Function Documentation

LanguageCode Mdt::Translation::LanguageCode::fromLanguageCountry ( const QString &  languageCountry)
static

Construct a language code from language_COUNTRY string.

const auto code = LanguageCode::fromLanguageCountry("fr_CH");
// code will contain "fr"
Precondition
languageCountry must contain at least 2 letters

Definition at line 63 of file LanguageCode.cpp.

LanguageCode Mdt::Translation::LanguageCode::fromString ( const QString &  code)
static

Construct a language code from a string.

Precondition
code must contain exactly 2 letters

Definition at line 52 of file LanguageCode.cpp.


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