Rhino C++ API
8.14
|
#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 |
const wchar_t * | GetBCP47LanguageTag (wchar_t *buffer, size_t buffer_capacity) const |
const char * | GetWindowsLocaleName (char *buffer, size_t buffer_capacity) const |
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 |
ON_Locale & | operator= (const ON_Locale &)=default |
const char * | RegionCode () const |
const char * | ScriptCode () const |
ON_CRT_locale_t | StringCollateAndMapLocalePtr () const |
ON__UINT32 | WindowsLCID () const |
const char * | WindowsSortOrder () const |
Static Public Member Functions | |
static unsigned int | EnforcePeriodAsCRuntimeDecimalPoint () |
static ON_Locale | FromAppleName (const char *apple_name) |
static ON_Locale | FromAppleName (const wchar_t *apple_name) |
static ON_Locale | FromBCP47LanguageName (const char *language_name) |
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) |
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) |
static ON_Locale | FromWindowsName (const char *windows_name) |
static ON_Locale | FromWindowsName (const wchar_t *windows_name) |
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 | 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) |
static bool | PeriodIsCRuntimeDecimalPoint () |
static bool | SetCurrentCulture (const ON_Locale ¤t_culture_locale) |
static bool | SetPeriodAsCRuntimeDecimalPoint () |
Static Public Attributes | |
static const ON_Locale & | CurrentCulture |
static const ON_Locale | InvariantCulture |
static const ON_Locale | Ordinal |
anonymous enum |
Maximum buffer capacity for any ON_Locale functions that return string information in a buffer.
Enumerator | |
---|---|
BUFFER_MAXIMUM_CAPACITY |
enum ON_Locale::WindowsLCID : unsigned int |
Enumerator | |
---|---|
OrdinalLCID | not a real Windows LCID |
InvariantCultureLCID | 39 decimal |
cs_CZ_LCID | Windows LCID for languages Rhino supports. "cs-CZ" Czech, ???? script implied 1029 decimal |
de_DE_LCID | "de-DE" German, Germany, Latn script implied 1031 decimal |
en_US_LCID | "en-US" English, US, Latn script implied 1033 decimal |
en_CA_LCID | "en-CA" English, Canada, Latn script implied 4105 decimal |
es_ES_tradnl_LCID | "es-ES_tradnl" Spanish, Spain, Latn script implied, traditional sort 1034 decimal |
es_ES_LCID | "es-ES" Spanish, Spain, Latn script implied, modern sort 3082 decimal |
fr_FR_LCID | "fr-FR" French, France, Latn script implied 1036 decimal |
it_IT_LCID | "it-IT" Italian, Italy, Latn script implied 1040 decimal |
ja_JP_LCID | "ja-JP" Japanese, Japan, ???? script implied 1041 decimal |
ko_KR_LCID | Korean, Republic of Korea, ???? script implied. 1042 decimal |
pl_PL_LCID | Polish, Poland, ???? script implied. 1045 decimal |
pt_PT_LCID | Portuguese, Portugal, Latn script implied. 2070 decimal |
zh_CN_LCID | Standard Chinese (Mandarin), Peoples Republic of China, Hans script implied (simplified characters) According to https://en.wikipedia.org/wiki/Chinese_language, Chinese is a family of language varieties, often mutually unintelligible. Specifying both Script and REGION (zh-Hans-CN or zh-Hant-TW) doesn't narrow things down nearly enough. Basically we have to hope the string collate and mapping functions supplied by the OS and the translations supplied by our staff work well for our customers who select from the two types of "Chinese" Rhino offers. 2052 decimal |
zh_TW_LCID | Standard Chinese (Mandarin), Taiwan, Hant script implied (traditional characters) 1028 decimal |
ON_Locale::ON_Locale | ( | ) |
Default construction creates a copy of ON_Local::Ordinal.
|
default |
|
default |
const char* ON_Locale::BCP47LanguageTag | ( | ) | const |
Parameters: A string of 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
Remarks: ON_Locale::InvariantCulture.BCP47LanguageName() = ""; ON_Locale::Ordinal.BCP47LanguageName() = "";
|
static |
Description: 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. Returns: 0: failed 1: success Currently The decimal point is a period in the C-runtime formatted printing and scanning functions. 2: success When called, the decimal point was not a period, but a call to ON_Locale::SetPeriodAsCRuntimeDecimalPoint() restored the default behavior.
|
static |
Description: Create a locale from an Apple locale or language name Parameters: 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. Returns: 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 |
Description: Create a locale from a BCP 47 language name.
Parameters: language_name - [in] The language name has the form <language>[-<Script>][-<REGION>] Case is not important.
Returns: ON_Locale identified by language_name. If locale_name is not valid or not supported, a copy of ON_Locale::Ordinal is returned.
|
static |
|
static |
Description: Create a locale from BCP 47 language code, script code and region code.
Parameters: language_code - [in] ISO 639 language code. When available, two letter codes from ISO 639-1 are preferred. 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
Returns: ON_Locale identified by the locale name. If the locale name is not valid or not supported, a copy of ON_Locale::Ordinal is returned.
|
static |
|
static |
Description: Create a locale from a Windows locale id.
Parameters: lcid - [in] Windows LCID value or zero for the "ordinal" locale.
Returns: ON_Locale identified by lcid. If lcid is not valid or not supported, a copy of ON_Locale::Ordinal is returned.
|
static |
Description: Create a locale from a Windows locale name.
Parameters: windows_name - [in] The Windows name has the form <language>[-<Script>][-<REGION>][_<sort_order>] Case is not important.
Returns: ON_Locale identified by locale_name. If locale_name is not valid or not supported, a copy of ON_Locale::Ordinal is returned.
|
static |
const char* ON_Locale::GetAppleLanguageName | ( | char * | buffer, |
size_t | buffer_capacity | ||
) | const |
Returns: Apple OS X / iOS locale name in the form <language>[-<Script>][-<REGION>]
<language> ISO 639 language code. When available, two letter codes from ISO 639-1 are preferred. 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
Remarks: 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 |
Returns: Apple OS X / iOS locale name in the form <language>[-<Script>][_<REGION>]
<language> ISO 639 language code. When available, two letter codes from ISO 639-1 are preferred. 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
Remarks: 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 |
Description: Get the language id.
Parameters: 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.
Returns: If buffer_capacity is to small or buffer is nullptr, then nullptr is returned. Otherwise the pointer to buffer is returned.
Remarks: 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 |
Description: Get the Microsoft Windows locale id.
Parameters: 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.
Returns: If buffer_capacity is to small or buffer is nullptr, then nullptr is returned. Otherwise the pointer to buffer is returned.
Remarks: 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 |
Returns: True if this is ON_Locale:InvariantCulture or a copy.
bool ON_Locale::IsOrdinal | ( | ) | const |
Returns: True if this is ON_Locale:Ordinal or a copy.
bool ON_Locale::IsOrdinalOrInvariantCulture | ( | ) | const |
const char* ON_Locale::LanguageCode | ( | ) | const |
Returns: ISO 639 language code. When available, two letter codes from ISO 639-1 are preferred. Remarks: The InvariantCulture.LanguageCode() is "". See Also: http://www.iso.org/iso/language_codes
ON_CRT_locale_t ON_Locale::NumericLocalePtr | ( | ) | const |
Description: 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. Example:
/ Call _sprintf_p_l ON_CRT_locale_t numeric_locale = ON_Locale::CurrentCulture::NumericLocalePtr(); _sprintf_p_l(....,locale,...);
Returns: A value that can be passed into C-runtime functions that take a locale parameter.
|
static |
|
static |
Description: 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>).
Parameters: 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[].
Remarks: 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 |
Returns: True if the C runtime formatted printing and scanning functions are using the period character as the decimal point for doubles and floats.
const char* ON_Locale::RegionCode | ( | ) | const |
Returns: ISO 3166-1 country/region identifier (2 alpha) or UN M.49 code (3 digits) Remarks: The returned string can be "" if the no region is specified. The InvariantCulture.RegionCode() is "". See Also: http://www.iso.org/iso/home/standards/country_codes.htm
const char* ON_Locale::ScriptCode | ( | ) | const |
Returns: A 4 letter ISO 15924 script code Remarks: The returned string can be "" if the no script is specified for the locale. The InvariantCulture.ScriptCode() is "". See Also: http://www.unicode.org/iso15924/iso15924-codes.html
|
static |
Description: Set the current culture locale Parameters: current_culture_locale - [in]
|
static |
Description: 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. Returns: True if successful.
ON_CRT_locale_t ON_Locale::StringCollateAndMapLocalePtr | ( | ) | const |
Description: 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. Example:
/ Call _wcsicoll_l ON_CRT_locale_t coll_locale = ON_Locale::CurrentCulture::StringCollateAndMapLocalePtr(); _wcsicoll_l(....,coll_locale);
Returns: A value that can be passed into C-runtime functions that take a locale parameter.
ON__UINT32 ON_Locale::WindowsLCID | ( | ) | const |
Returns: Microsoft Windows LCID value ON_LocaleLCID::OrdinalLCID (=0) The locale is a copy of ON_Locale::Ordinal. ON_Locale::InvariantCultureLCID (=0x00000027U) The locale is a copy of ON_Locale::InvariantCulture.
const char* ON_Locale::WindowsSortOrder | ( | ) | const |
Returns: A 6 letter locale sort order. Remarks: The returned string can be "" if the no sort order is specified for the locale. The InvariantCulture.WindowsSortOrder() is "". See Also: https://msdn.microsoft.com/en-us/library/windows/desktop/dd374060(v=vs.85).aspx
|
static |
Reference to ON_Locale::m_CurrentCulture. The value is set by calling ON_Locale::SetCurrentCulture(); The default is a copy of ON_Locale::Ordinal.
|
static |
The invariant culture locale. The decimal point is a period.
|
static |
The ordinal locale.
String compares use ordinal element values. The decimal point is a period.