#include <ut_locale.h>
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. | |
const std::string & | getLanguage () const |
Returns empty string or language. | |
const std::string & | getTerritory () const |
Returns empty string or territory. | |
const std::string & | getEncoding () const |
Returns empty string or encoding. | |
std::string | 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 std::string &locale) |
Private Attributes | |
std::string | mLanguage |
std::string | mTerritory |
std::string | mEncoding |
UT_LocaleInfo::UT_LocaleInfo | ( | ) |
Essentially identical to UT_LocaleInfo(getenv("LANG")), except works on non-unix platforms too (i.e.
win32)
References XAP_EncodingManager::get_instance(), XAP_EncodingManager::getLanguageISOName(), XAP_EncodingManager::getLanguageISOTerritory(), XAP_EncodingManager::getNative8BitEncodingName(), instance, mEncoding, mLanguage, and mTerritory.
Referenced by system().
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().
const std::string & UT_LocaleInfo::getEncoding | ( | ) | const |
const std::string & 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().
const std::string & 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.
Referenced by toString().
bool UT_LocaleInfo::hasLanguage | ( | ) | const |
True if language field is non-null/non-empty, false if not.
References mLanguage.
bool UT_LocaleInfo::hasTerritory | ( | ) | const |
True if territory field is non-null/non-empty, false if not.
References mTerritory.
Referenced by toString().
void UT_LocaleInfo::init | ( | const std::string & | locale | ) | [private] |
References mEncoding, mLanguage, mTerritory, and UT_String_findCh().
Referenced by UT_LocaleInfo().
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] |
References UT_LocaleInfo().
Referenced by buildTemplateList(), ODe_Style_Style::ParagraphProps::fetchAttributesFromAbiProps(), and UT_Wctomb::UT_Wctomb().
std::string 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().
std::string UT_LocaleInfo::mEncoding [private] |
Referenced by getEncoding(), hasEncoding(), init(), operator==(), toString(), and UT_LocaleInfo().
std::string UT_LocaleInfo::mLanguage [private] |
Referenced by getLanguage(), hasLanguage(), init(), operator==(), toString(), and UT_LocaleInfo().
std::string UT_LocaleInfo::mTerritory [private] |
Referenced by getTerritory(), hasTerritory(), init(), operator==(), toString(), and UT_LocaleInfo().