#include <opennurbs_locale.h>
Public Types | |
enum | { BUFFER_MAXIMUM_CAPACITY = 128 } |
enum | WindowsLCID : unsigned int { OrdinalLCID = 0, InvariantCultureLCID = 0x0027, cs_CZ_LCID = 0x0405, de_DE_LCID = 0x0407, en_US_LCID = 0x0409, en_CA_LCID = 0x1009, es_ES_tradnl_LCID = 0x040A, es_ES_LCID = 0x0c0a, fr_FR_LCID = 0x040c, it_IT_LCID = 0x0410, ja_JP_LCID = 0x0411, ko_KR_LCID = 0x0412, pl_PL_LCID = 0x0415, pt_PT_LCID = 0x0816, zh_CN_LCID = 0x0804, zh_TW_LCID = 0x0404 } |
Public Member Functions | |
ON_Locale () ON_NOEXCEPT | |
Default construction creates a copy of ON_Local::Ordinal. More... | |
ON_Locale (const ON_Locale &)=default | |
~ON_Locale ()=default | |
const char * | BCP47LanguageTag () const |
const char * | GetAppleLanguageName (char *buffer, size_t buffer_capacity) const |
const wchar_t * | GetAppleLanguageName (wchar_t *buffer, size_t buffer_capacity) const |
const char * | GetAppleLocaleName (char *buffer, size_t buffer_capacity) const |
const wchar_t * | GetAppleLocaleName (wchar_t *buffer, size_t buffer_capacity) const |
const char * | GetBCP47LanguageTag (char *buffer, size_t buffer_capacity) const |
Get the language id. More... | |
const wchar_t * | GetBCP47LanguageTag (wchar_t *buffer, size_t buffer_capacity) const |
const char * | GetWindowsLocaleName (char *buffer, size_t buffer_capacity) const |
Get the Microsoft Windows locale id. More... | |
const wchar_t * | GetWindowsLocaleName (wchar_t *buffer, size_t buffer_capacity) const |
bool | IsInvariantCulture () const |
bool | IsOrdinal () const |
bool | IsOrdinalOrInvariantCulture () const |
const char * | LanguageCode () const |
ON_CRT_locale_t | NumericLocalePtr () const |
NumericLocalePtr() is an expert user function needed to call C-runtime functions that format or parse numbers. This locale must never be used to collate or map strings. More... | |
ON_Locale & | operator= (const ON_Locale &)=default |
const char * | RegionCode () const |
const char * | ScriptCode () const |
ON_CRT_locale_t | StringCollateAndMapLocalePtr () const |
StringCollateAndMapLocalePtr() is an expert user function needed to call C-runtime functions that collate (compare) and map (toupper/tolower) strings. This locale must never be used for formatting or parsing numbers. More... | |
ON__UINT32 | WindowsLCID () const |
const char * | WindowsSortOrder () const |
Static Public Member Functions | |
static unsigned int | EnforcePeriodAsCRuntimeDecimalPoint () |
Use a call like setlocale(LC_NUMERIC,"C") to configure the C runtime formatted printing and scanning functions to use the period character as the decimal point for doubles and floats. More... | |
static ON_Locale | FromAppleName (const char *apple_name) |
Create a locale from an Apple locale or language name More... | |
static ON_Locale | FromAppleName (const wchar_t *apple_name) |
static ON_Locale | FromBCP47LanguageName (const char *language_name) |
Create a locale from a BCP 47 language name. More... | |
static ON_Locale | FromBCP47LanguageName (const wchar_t *language_name) |
static ON_Locale | FromSubtags (const char *language_code, const char *script_code, const char *region_code) |
Create a locale from BCP 47 lanugage code, script code and region code. More... | |
static ON_Locale | FromSubtags (const wchar_t *language_code, const wchar_t *script_code, const wchar_t *region_code) |
static ON_Locale | FromWindowsLCID (ON__UINT32 windows_lcid) |
Create a locale from a Windows locale id. More... | |
static ON_Locale | FromWindowsName (const char *windows_name) |
Create a locale from a Windows locale name. More... | |
static ON_Locale | FromWindowsName (const wchar_t *windows_name) |
static bool | ParseName (const wchar_t *locale_name, int locale_name_element_count, wchar_t *language_code, size_t language_code_capacity, wchar_t *extlang_code, size_t extlang_code_capacity, wchar_t *script_code, size_t script_code_capacity, wchar_t *region_code, size_t region_code_capacity, wchar_t *windows_sortorder, size_t windows_sortorder_capacity) |
Attempt to parse a string that is a language name or locale name and extract language code, extlang code script code, region code and Windows sort order. More... | |
static bool | ParseName (const char *locale_name, int locale_name_element_count, char *language_code, size_t language_code_capacity, char *extlang_code, size_t extlang_code_capacity, char *script_code, size_t script_code_capacity, char *region_code, size_t region_code_capacity, char *windows_sortorder, size_t windows_sortorder_capacity) |
static bool | PeriodIsCRuntimeDecimalPoint () |
static bool | SetCurrentCulture (const ON_Locale ¤t_culture_locale) |
Set the current culture locale More... | |
static bool | SetPeriodAsCRuntimeDecimalPoint () |
Use a call like setlocale(LC_NUMERIC,"C") to configure the C runtime formatted printing and scanning functions to use the period character as the decimal point for doubles and floats. More... | |
Static Public Attributes | |
static const ON_Locale & | CurrentCulture |
static const ON_Locale | InvariantCulture |
static const ON_Locale | Ordinal |
enum ON_Locale::WindowsLCID : unsigned int |
ON_Locale::ON_Locale | ( | ) |
Default construction creates a copy of ON_Local::Ordinal.
|
default |
|
default |
const char* ON_Locale::BCP47LanguageTag | ( | ) | const |
TODODOC: A string of the form TODODOC: TODODOC: <language>[-<Script>][-<REGION>] TODODOC: TODODOC: <language> TODODOC: ISO 639 language code. TODODOC: http://www.iso.org/iso/language_codes TODODOC: TODODOC: <Script> is optional. TODODOC: If present, it is a 4 alpha letter ISO 15924 script code TODODOC: http://www.unicode.org/iso15924/iso15924-codes.html TODODOC: TODODOC: <REGION> TODODOC: ISO 3166-1 country/region identifier. (2 alpha letters) TODODOC: or UN M.49 code (3 digits) TODODOC: http://www.iso.org/iso/home/standards/country_codes.htm TODODOC:
ON_Locale::InvariantCulture.BCP47LanguageName() = ""; ON_Locale::Oridnal.BCP47LanguageName() = "";
|
static |
Use a call like setlocale(LC_NUMERIC,"C") to configure the C runtime formatted printing and scanning functions to use the period character as the decimal point for doubles and floats.
|
static |
Create a locale from an Apple locale or language name
apple_name | [in] The Apple name has the form <language>[-<Script>][-<REGION>]. An underbar (_) may be used in place of a hyphen (-). Case is not important. |
ON_Locale identified by locale_name. If locale_name is not valid or not supported, a copy of ON_Locale::Ordinal is returned.
|
static |
|
static |
Create a locale from a BCP 47 language name.
language_name | [in] The language name has the form <language>[-<Script>][-<REGION>] Case is not important. |
|
static |
|
static |
Create a locale from BCP 47 lanugage code, script code and region code.
language_code | [in] ISO 639 language code. When avilable, two letter codes from ISO 639-1 are prefered. http://www.iso.org/iso/language_codes |
script | [in] nullptr, empty string, or a 4 letter ISO 15924 script code http://www.unicode.org/iso15924/iso15924-codes.html |
<REGION> nullptr, empty string, or an ISO 3166 country/region identifier. http://www.iso.org/iso/home/standards/country_codes.htm
|
static |
|
static |
Create a locale from a Windows locale id.
lcid | [in] Windows LCID value or zero for the "ordinal" locale. |
|
static |
Create a locale from a Windows locale name.
windows_name | [in] The Windows name has the form <language>[-<Script>][-<REGION>][_<sort_order>] Case is not important. |
|
static |
const char* ON_Locale::GetAppleLanguageName | ( | char * | buffer, |
size_t | buffer_capacity | ||
) | const |
Apple OS X / iOS locale name in the form <language>[-<Script>][-<REGION>]
<language> ISO 639 language code. When avilable, two letter codes from ISO 639-1 are prefered. http://www.iso.org/iso/language_codes
<Script> is optional. If present, it is a 4 alpha letter ISO 15924 script code http://www.unicode.org/iso15924/iso15924-codes.html
<REGION> ISO 3166-1 country/region identifier. (2 alpha letters) or UN M.49 code (3 digits) http://www.iso.org/iso/home/standards/country_codes.htm
The Invariant locale name is the empty string "". Apple language names have a hyphen (-) before the region. Apple locale names have an underbar (_) before the region.
const wchar_t* ON_Locale::GetAppleLanguageName | ( | wchar_t * | buffer, |
size_t | buffer_capacity | ||
) | const |
const char* ON_Locale::GetAppleLocaleName | ( | char * | buffer, |
size_t | buffer_capacity | ||
) | const |
Apple OS X / iOS locale name in the form <language>[-<Script>][_<REGION>]
<language> ISO 639 language code. When avilable, two letter codes from ISO 639-1 are prefered. http://www.iso.org/iso/language_codes
<Script> is optional. If present, it is a 4 alpha letter ISO 15924 script code http://www.unicode.org/iso15924/iso15924-codes.html
<REGION> ISO 3166-1 country/region identifier. (2 alpha letters) or UN M.49 code (3 digits) http://www.iso.org/iso/home/standards/country_codes.htm
The Invariant locale name is the empty string "". Apple language names have a hyphen (-) before the region. Apple locale names have an underbar (_) before the region.
const wchar_t* ON_Locale::GetAppleLocaleName | ( | wchar_t * | buffer, |
size_t | buffer_capacity | ||
) | const |
const char* ON_Locale::GetBCP47LanguageTag | ( | char * | buffer, |
size_t | buffer_capacity | ||
) | const |
Get the language id.
buffer | [out] A null terminated string containing the language id is returned in this buffer. The string has the form: |
<language>[-<Script>][-<REGION>]
<language> ISO 639 language code. http://www.iso.org/iso/language_codes
<Script> is optional. If present, it is a 4 alpha letter ISO 15924 script code http://www.unicode.org/iso15924/iso15924-codes.html
<REGION> ISO 3166-1 country/region identifier. (2 alpha letters) or UN M.49 code (3 digits) http://www.iso.org/iso/home/standards/country_codes.htm
buffer_capacity | [in] number of elements in the buffer. A capacity >= ON_Locale::BUFFER_MAXIMUM_CAPACITY will be large enough to hold all possible output. |
If buffer_capacity is to small or buffer is nullptr, then nullptr is returned. Otherwise the pointer to buffer is returned.
The Invariant language name is the empty string "".
const wchar_t* ON_Locale::GetBCP47LanguageTag | ( | wchar_t * | buffer, |
size_t | buffer_capacity | ||
) | const |
const char* ON_Locale::GetWindowsLocaleName | ( | char * | buffer, |
size_t | buffer_capacity | ||
) | const |
Get the Microsoft Windows locale id.
buffer | [out] A null terminated string containing the Microsoft Windows locale id is returned in this buffer. The string has the form: |
<language>[-<Script>][-<REGION>][_<sort_order>] (UTF-8 string encoding)
<language> ISO 639 language code. http://www.iso.org/iso/language_codes
<Script> is optional. If present, it is a 4 alpha letter ISO 15924 script code http://www.unicode.org/iso15924/iso15924-codes.html
<REGION> ISO 3166-1 country/region identifier. (2 alpha letters) or UN M.49 code (3 digits) http://www.iso.org/iso/home/standards/country_codes.htm
<sort_order> Up to six letters specifying a sort order. Microsoft Windows codes are used.
buffer_capacity | [in] number of elements in the buffer. A capacity >= ON_Locale::BUFFER_MAXIMUM_CAPACITY will be large enough to hold all possible output. |
If buffer_capacity is to small or buffer is nullptr, then nullptr is returned. Otherwise the pointer to buffer is returned.
The Invariant locale name is the empty string "".
const wchar_t* ON_Locale::GetWindowsLocaleName | ( | wchar_t * | buffer, |
size_t | buffer_capacity | ||
) | const |
bool ON_Locale::IsInvariantCulture | ( | ) | const |
bool ON_Locale::IsOrdinal | ( | ) | const |
bool ON_Locale::IsOrdinalOrInvariantCulture | ( | ) | const |
const char* ON_Locale::LanguageCode | ( | ) | const |
The InvariantCulture.LanguageCode() is "".
ON_CRT_locale_t ON_Locale::NumericLocalePtr | ( | ) | const |
NumericLocalePtr() is an expert user function needed to call C-runtime functions that format or parse numbers. This locale must never be used to collate or map strings.
The primary use for this function is in opennurbs implementations of ON_String and ON_wString number formatting and parsing functions.
|
static |
Attempt to parse a string that is a language name or locale name and extract language code, extlang code script code, region code and Windows sort order.
The language name has the form <language>[<-extlang>][-<Script>][-<REGION>]
If the Microsoft [_<windows_sort_order>] appears after the language name, it is parsed.
Apple "locale ids" of the form <language>_<REGION>" are parsed as well (an underbar separator instead of a hyphen before <REGION>).
locale_name | [in] name to parse. Case is ignored. |
locale_name_element_count | [in] number of elements to parse in locale_name[] If locale_name_element_count < 0, then a null terminator ends parsing. |
language_code | [out] |
language_code_capacity | [in] number of elements available in language_code[]. |
extlang_code | [out] |
extlang_code_capacity | [in] number of elements available in extlang_code[]. |
script_code | [out] |
script_code_capacity | [in] number of elements available in script_code[]. |
region_code | [out] |
region_code_capacity | [in] number of elements available in region_code[]. |
windows_sortorder | [out] |
windows_sortorder_capacity | [in] number of elements available in windows_sortorder[]. |
The standards for language identifiers (RFC 5646 and BCP 47) states that a hyphen ( Unicode U+002D ) is supposed to be the separator between subtags.
|
static |
|
static |
const char* ON_Locale::RegionCode | ( | ) | const |
The returned string can be "" if the no region is specified. The InvariantCulture.RegionCode() is "".
const char* ON_Locale::ScriptCode | ( | ) | const |
The returned string can be "" if the no script is specified for the locale. The InvariantCulture.ScriptCode() is "".
|
static |
Set the current culture locale
current_culture_locale | [in] |
|
static |
Use a call like setlocale(LC_NUMERIC,"C") to configure the C runtime formatted printing and scanning functions to use the period character as the decimal point for doubles and floats.
ON_CRT_locale_t ON_Locale::StringCollateAndMapLocalePtr | ( | ) | const |
StringCollateAndMapLocalePtr() is an expert user function needed to call C-runtime functions that collate (compare) and map (toupper/tolower) strings. This locale must never be used for formatting or parsing numbers.
The primary use for this function is in opennurbs implementations of ON_String and ON_wString collate and map functions.
ON__UINT32 ON_Locale::WindowsLCID | ( | ) | const |
const char* ON_Locale::WindowsSortOrder | ( | ) | const |
The returned string can be "" if the no sort order is specified for the locale. The InvariantCulture.WindowsSortOrder() is "".
|
static |
|
static |
|
static |