You.i Engine
CYILocale Class Reference

Detailed Description

A class representing a locale.

Instances of this class represent locales. Locales are typically instantiated with a 2 character ISO-639-1 language code and a 2 character ISO-3166-1 country code though it is possible to default construct a locale. Additionally, this class manages the global locale.

#include <utility/YiLocale.h>

Inheritance diagram for CYILocale:

Public Member Functions

 CYILocale ()
 
 CYILocale (const CYIString &rLanguageCode, const CYIString &rCountryCode)
 
virtual ~CYILocale ()
 
const CYIStringGetLanguageCode () const
 
const CYIStringGetCountryCode () const
 
CYIString ToString () const
 
- Public Member Functions inherited from CYIScriptableObject
 CYIScriptableObject ()
 
 CYIScriptableObject (const CYIScriptableObject &other)
 
CYIScriptableObjectoperator= (const CYIScriptableObject &other)
 
virtual ~CYIScriptableObject ()
 
CYIBindingImplementationGetBindingImplementation () const
 
void SetBindingImplementation (CYIBindingImplementation *pBindingImplementation)
 
virtual const CYIRuntimeTypeInfoGetRuntimeTypeInfoForScriptObject () const
 

Static Public Member Functions

static const CYILocaleGetLocale ()
 
static void SetLocale (const CYILocale &rLocale)
 
static const CYIStringCountryCodeAlpha3ToAlpha2 (const CYIString &country)
 

Protected Attributes

CYIString m_LanguageCode
 
CYIString m_CountryCode
 

Constructor & Destructor Documentation

CYILocale::CYILocale ( )

Constructs an empty locale.

CYILocale::CYILocale ( const CYIString rLanguageCode,
const CYIString rCountryCode 
)

Constructs a locale with the given language and country codes. The language code should be a valid 2 character ISO-639-1 code and the country code should be a valid 2 character ISO-3166-1 code. No validation on the codes is performed.

virtual CYILocale::~CYILocale ( )
virtual

Destroys the locale.

Member Function Documentation

static const CYIString& CYILocale::CountryCodeAlpha3ToAlpha2 ( const CYIString country)
static

Converts an ISO 3166-1 alpha 3 country code, country, to an ISO 3166-1 alpha 2 country code.

const CYIString& CYILocale::GetCountryCode ( ) const

Returns the country code if the locale has one and an empty string otherwise. If the locale has a country code it is usually a 2 character ISO-3166-1 code but this is not guaranteed.

const CYIString& CYILocale::GetLanguageCode ( ) const

Returns the language code if the locale has one and an empty string otherwise. If the locale has a language code it is usually a 2 character ISO-639-1 code but this is not guaranteed.

static const CYILocale& CYILocale::GetLocale ( )
static

Returns the global locale.

static void CYILocale::SetLocale ( const CYILocale rLocale)
static

Sets the global locale.

CYIString CYILocale::ToString ( ) const

Returns a string representation of the locale or an empty string if the language or country codes (or both) are missing. The string representation is in the form of "en_US" where en is the language code (English) and US is the country code (United States).

Member Data Documentation

CYIString CYILocale::m_CountryCode
protected
CYIString CYILocale::m_LanguageCode
protected

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