Class for representing a locale and its settings. More...
Public Member Functions | |
BLocale (const BLanguage *language=NULL, const BFormattingConventions *conventions=NULL) | |
Initializes a BLocale object corresponding to the passed in language and conventions. | |
BLocale (const BLocale &other) | |
Initializes a BLocale object as a copy of other. | |
~BLocale () | |
Destructor method. | |
status_t | GetCollator (BCollator *collator) const |
Sets collator object to the default collator for the BLocale. | |
status_t | GetFormattingConventions (BFormattingConventions *conventions) const |
Fills out conventions with the default formatting conventions for the BLocale. | |
status_t | GetLanguage (BLanguage *language) const |
Sets language object to the default language for the BLocale. | |
const char * | GetString (uint32 id) const |
Gets the language string for the locale. | |
BLocale & | operator= (const BLocale &other) |
Gets the collator associated to this locale. | |
void | SetCollator (const BCollator &newCollator) |
Set the collator for this locale. | |
void | SetFormattingConventions (const BFormattingConventions &conventions) |
Sets the formatting convention for this locale. | |
void | SetLanguage (const BLanguage &newLanguage) |
Set the language for this locale. | |
Class for representing a locale and its settings.
A locale is defined by the combination of a country and a language. Using these two informations, it is possible to determine the format to use for date, time, and number formatting. The BLocale class also provide collators, which allows you to sort a list of strings properly depending on a set of rules about accented chars and other special cases that vary over the different locales.
BLocale is also the class to use when you want to perform formatting or parsing of dates, times, and numbers, in the natural language of the user.
BLocale::BLocale | ( | const BLanguage * | language = NULL , |
const BFormattingConventions * | conventions = NULL |
||
) |
Initializes a BLocale object corresponding to the passed in language and conventions.
BLocale::BLocale | ( | const BLocale & | other | ) |
BLocale::~BLocale | ( | ) |
Destructor method.
status_t BLocale::GetFormattingConventions | ( | BFormattingConventions * | conventions | ) | const |
Fills out conventions with the default formatting conventions for the BLocale.
conventions | A pointer to a BFormattingConventions object to fill out. |
B_OK | Everything went well. |
B_BAD_VALUE | NULL conventions object passed in. |
B_ERROR | Unable to lock the BLocale. |
status_t BLocale::GetLanguage | ( | BLanguage * | language | ) | const |
const char * BLocale::GetString | ( | uint32 | id | ) | const |
Gets the language string for the locale.
id | The locale id to get the language of. |
Gets the collator associated to this locale.
status_t BLocale::GetCollator(BCollator* collator) const
Returns the collator in use for this locale, allowing you to use it to sort a set of strings.
Initializes a BLocale object as a copy of other by overloading the = operator.
other | The BLocale object to initialize from. |
void BLocale::SetCollator | ( | const BCollator & | newCollator | ) |
Set the collator for this locale.
If unable to lock the BLocale newCollator is left untouched.
newCollator | The collator to set. |
void BLocale::SetFormattingConventions | ( | const BFormattingConventions & | conventions | ) |
Sets the formatting convention for this locale.
If unable to lock the BLocale conventions is left untouched.
conventions | The formatting convention to set. |
void BLocale::SetLanguage | ( | const BLanguage & | newLanguage | ) |
Set the language for this locale.
If unable to lock the BLocale newLanguage is left untouched.
newLanguage | The code of the language to set to locale to. |