Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

UT_LocaleInfo Class Reference

#include <ut_locale.h>

List of all members.

Public Member Functions

 UT_LocaleInfo ()
 Essentially identical to UT_LocaleInfo(getenv("LANG")), except works on non-unix platforms too (i.e.
 UT_LocaleInfo (const char *locale)
 Takes in a string of the form "language_TERRITORY.ENCODING" or "language-TERRITORY.ENCODING" and decomposes it.
bool hasLanguage () const
 True if language field is non-null/non-empty, false if not.
bool hasTerritory () const
 True if territory field is non-null/non-empty, false if not.
bool hasEncoding () const
 True if encoding field is non-null/non-empty, false if not.
UT_UTF8String getLanguage () const
 Returns empty string or language.
UT_UTF8String getTerritory () const
 Returns empty string or territory.
UT_UTF8String getEncoding () const
 Returns empty string or encoding.
UT_UTF8String toString () const
 Turns object back into a string of the form language_TERRITORY.ENCODING (eg): en_US.UTF-8.
bool operator== (const UT_LocaleInfo &rhs) const
bool operator!= (const UT_LocaleInfo &rhs) const

Static Public Member Functions

static const UT_LocaleInfo system ()

Private Member Functions

void init (const UT_String &locale)

Private Attributes

UT_UTF8String mLanguage
UT_UTF8String mTerritory
UT_UTF8String mEncoding

Constructor & Destructor Documentation

UT_LocaleInfo::UT_LocaleInfo (  ) 
UT_LocaleInfo::UT_LocaleInfo ( const char *  locale  ) 

Takes in a string of the form "language_TERRITORY.ENCODING" or "language-TERRITORY.ENCODING" and decomposes it.

TERRITORY and ENCODING parts are optional

References init().


Member Function Documentation

UT_UTF8String UT_LocaleInfo::getEncoding (  )  const

Returns empty string or encoding.

Encoding is like "UTF-8" or "ISO-8859-1"

References mEncoding.

UT_UTF8String UT_LocaleInfo::getLanguage ( void   )  const

Returns empty string or language.

Example languages are "en", "wen", "fr", "es"

References mLanguage.

Referenced by buildTemplateList(), and PD_Document::setAttrProp().

UT_UTF8String UT_LocaleInfo::getTerritory (  )  const

Returns empty string or territory.

Example territories are: "US", "GB", "FR", ...

References mTerritory.

Referenced by buildTemplateList(), and PD_Document::setAttrProp().

bool UT_LocaleInfo::hasEncoding (  )  const

True if encoding field is non-null/non-empty, false if not.

References mEncoding, and UT_UTF8String::size().

Referenced by toString().

bool UT_LocaleInfo::hasLanguage (  )  const

True if language field is non-null/non-empty, false if not.

References mLanguage, and UT_UTF8String::size().

bool UT_LocaleInfo::hasTerritory (  )  const

True if territory field is non-null/non-empty, false if not.

References mTerritory, and UT_UTF8String::size().

Referenced by toString().

void UT_LocaleInfo::init ( const UT_String locale  )  [private]
bool UT_LocaleInfo::operator!= ( const UT_LocaleInfo rhs  )  const
bool UT_LocaleInfo::operator== ( const UT_LocaleInfo rhs  )  const

References mEncoding, mLanguage, mTerritory, and this.

const UT_LocaleInfo UT_LocaleInfo::system (  )  [static]
UT_UTF8String UT_LocaleInfo::toString (  )  const

Turns object back into a string of the form language_TERRITORY.ENCODING (eg): en_US.UTF-8.

References hasEncoding(), hasTerritory(), mEncoding, mLanguage, and mTerritory.

Referenced by ODe_Style_Style::ParagraphProps::fetchAttributesFromAbiProps().


Member Data Documentation


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