|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
区域设置管理类 更多...
#include <locale.hpp>
类 | |
| struct | numeric_info |
| 数字格式信息 更多... | |
| struct | monetary_info |
| 货币格式信息 更多... | |
| struct | time_info |
| 时间格式信息 更多... | |
Public 类型 | |
| enum class | collate_strength : int32_t { primary = 1 , secondary = 2 , tertiary = 3 , identical = 4 } |
| 字符串比较强度 更多... | |
Public 成员函数 | |
| locale () | |
| 默认构造函数 | |
| locale (const string &name) | |
| 从名称构造区域设置 | |
| ~locale () | |
| 析构函数 | |
| locale (const locale &other) | |
| 拷贝构造函数 | |
| locale & | operator= (const locale &other) |
| 拷贝赋值运算符 | |
| locale (locale &&other) noexcept | |
| 移动构造函数 | |
| locale & | operator= (locale &&other) noexcept |
| 移动赋值运算符 | |
| const string & | name () const noexcept |
| 获取区域设置名称 | |
| const string & | encoding () const noexcept |
| 获取字符编码 | |
| bool | operator== (const locale &o) const noexcept |
| 相等比较运算符 | |
| bool | operator!= (const locale &o) const noexcept |
| 不等比较运算符 | |
| numeric_info | numeric () const |
| 获取数字格式信息 | |
| monetary_info | monetary () const |
| 获取货币格式信息 | |
| time_info | time () const |
| 获取时间格式信息 | |
| bool | is_alpha (char32_t cp) const noexcept |
| 是否为字母 | |
| bool | is_digit (char32_t cp) const noexcept |
| 是否为数字 | |
| bool | is_alnum (char32_t cp) const noexcept |
| 是否为字母或数字 | |
| bool | is_space (char32_t cp) const noexcept |
| 是否为空白字符 | |
| bool | is_upper (char32_t cp) const noexcept |
| 是否为大写字母 | |
| bool | is_lower (char32_t cp) const noexcept |
| 是否为小写字母 | |
| bool | is_punct (char32_t cp) const noexcept |
| 是否为标点符号 | |
| bool | is_print (char32_t cp) const noexcept |
| 是否为可打印字符 | |
| char32_t | to_upper (char32_t cp) const noexcept |
| 转换为大写 | |
| char32_t | to_lower (char32_t cp) const noexcept |
| 转换为小写 | |
| int | compare (const string &a, const string &b, collate_strength strength=collate_strength::tertiary) const |
| 比较两个字符串 | |
| string | collation_key (const string &s) const |
| 生成排序键 | |
| string | to_multibyte (const u32string &ucs4) const |
| 将UTF-32字符串转换为当前区域设置的多字节字符串 | |
| u32string | to_ucs4 (const string &mb) const |
| 将当前区域设置的多字节字符串转换为UTF-32 | |
静态 Public 成员函数 | |
| static locale | classic () |
| 获取"C"区域设置 | |
| static locale | system () |
| 获取系统区域设置 | |
| static locale | from_name (const string &name) |
| 从名称创建区域设置 | |
| static vector< string > | available_locales () |
| 获取系统所有可用的区域设置列表 | |
区域设置管理类
提供跨平台的区域设置信息查询和字符处理功能。
使用场景:
在文件 locale.hpp 第 64 行定义.
|
strong |
字符串比较强度
定义字符串比较时考虑的敏感度级别。
| 枚举值 | |
|---|---|
| primary | 一级比较:忽略大小写、变音符号、标点符号 |
| secondary | 二级比较:忽略大小写、区分变音符号 |
| tertiary | 三级比较:区分大小写 |
| identical | 完全比较:完全比较 |
在文件 locale.hpp 第 116 行定义.
| locale::locale | ( | ) |
默认构造函数
创建"C"区域设置。
被这些函数引用 classic(), from_name(), locale(), locale(), operator!=(), operator=(), operator=(), operator==() , 以及 system().
|
explicit |
生成排序键
| s | 源字符串 |
排序键可直接用于快速比较,但需要更多存储空间。
|
nodiscard |
|
inlinenodiscardnoexcept |
|
nodiscard |
获取货币格式信息
|
inlinenodiscardnoexcept |
|
nodiscard |
获取数字格式信息
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
|
nodiscard |
获取时间格式信息
将UTF-32字符串转换为当前区域设置的多字节字符串
| ucs4 | UTF-32字符串 |
将当前区域设置的多字节字符串转换为UTF-32
| mb | 多字节字符串 |