std::ctype_byname
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <locale> 中定义
|
||
template< class CharT > class ctype_byname : public std::ctype<CharT>; |
||
std::ctype_byname是一个std::ctype方面,它封装在其建设中指定的区域设置的字符分类规则.
原文:
std::ctype_byname is a std::ctype facet which encapsulates character classification rules of the locale specified at its construction.
两个专业所提供的标准库
原文:
Two specializations are provided by the standard library
在头文件
<locale> 中定义 | |
std::ctype_byname<char> | 提供窄字符分类。这种专业化表中查找字符分类
原文: provides narrow character classification. This specialization uses table lookup for character classification |
std::ctype_byname<wchar_t>
|
提供了广阔的字符分类
原文: provides wide character classification |
目录 |
[编辑] 会员类型
会员类型
|
Definition |
mask
|
ctype<charT>::mask
|
[编辑] 成员函数
构造一个新ctype_byname方面 原文: constructs a new ctype_byname facet (公共成员函数) | |
解构一个ctype_byname方面 (受保护的成员函数) |
Inherited from std::ctype<CharT>
Member types
会员类型
|
Definition |
char_type
|
CharT
|
Member objects
会员名称
|
Type |
id (静态的)
|
std::locale::id |
Member functions
调用 do_is (公共成员函数of std::ctype )
| |
调用 do_scan_is (公共成员函数of std::ctype )
| |
调用 do_scan_not (公共成员函数of std::ctype )
| |
调用 do_toupper (公共成员函数of std::ctype )
| |
调用 do_tolower (公共成员函数of std::ctype )
| |
调用 do_widen (公共成员函数of std::ctype )
| |
调用 do_narrow (公共成员函数of std::ctype )
|
Protected member functions
[虚]</div></div>
|
分类的字符或字符序列 原文: classifies a character or a character sequence (虚拟保护成员函数of std::ctype )
|
[虚]</div></div>
|
找到的第一个字符序列中符合给定的分类 原文: locates the first character in a sequence that conforms to given classification (虚拟保护成员函数of std::ctype )
|
[虚]</div></div>
|
定位,未能通过givne分类序列中的第一个字符 原文: locates the first character in a sequence that fails givne classification (虚拟保护成员函数of std::ctype )
|
[虚]</div></div>
|
将一个或多个字符转换为大写 原文: converts a character or characters to uppercase (虚拟保护成员函数of std::ctype )
|
[虚]</div></div>
|
一个或多个字符转换为小写 原文: converts a character or characters to lowercase (虚拟保护成员函数of std::ctype )
|
[虚]</div></div>
|
将一个或多个字符从 char charT 原文: converts a character or characters from char to charT (虚拟保护成员函数of std::ctype )
|
[虚]</div></div>
|
将一个或多个字符从 charT char 原文: converts a character or characters from charT to char (虚拟保护成员函数of std::ctype )
|
</div>
Inherited from std::ctype_base
Member types
类型
|
Definition |
mask
|
未指定的位掩码类型(枚举,整数类型,或bitset的)
原文: unspecified bitmask type (enumeration, integer type, or bitset) |
Member constants
space [静态的]</div></div>
|
mask 识别的空白字符分类 原文: the value of mask identifying whitespace character classification (公共静态成员常量) |
print [静态的]</div></div>
|
mask 确定可打印字符分类的价值 原文: the value of mask identifying printable character classification (公共静态成员常量) |
cntrl [静态的]</div></div>
|
mask 识别控制字符分类 原文: the value of mask identifying control character classification (公共静态成员常量) |
upper [静态的]</div></div>
|
mask 确定的价值大写字符分类 原文: the value of mask identifying uppercase character classification (公共静态成员常量) |
lower [静态的]</div></div>
|
值 mask 识别小写字母分类 原文: the value of mask identifying lowercase character classification (公共静态成员常量) |
alpha [静态的]</div></div>
|
mask 识别英文字母分类的价值 原文: the value of mask identifying alphabetic character classification (公共静态成员常量) |
digit [静态的]</div></div>
|
mask 识别数字字符分类的价值 原文: the value of mask identifying digit character classification (公共静态成员常量) |
punct [静态的]</div></div>
|
mask 识别的标点字符分类 原文: the value of mask identifying punctuation character classification (公共静态成员常量) |
xdigit [静态的]</div></div>
|
mask 识别十六进制数字字符分类的价值 原文: the value of mask identifying hexadecimal digit character classification (公共静态成员常量) |
blank [静态的] (C++11)</div></div>
|
mask 识别空白字符分类的价值 原文: the value of mask identifying blank character classification (公共静态成员常量) |
alnum [静态的]</div></div>
|
alpha | digit (公共静态成员常量) |
graph [静态的]</div></div>
|
alnum | punct (公共静态成员常量) |
</div>
[编辑] 示例
#include <iostream> #include <locale> int main() { wchar_t c = L'\u00de'; // capital letter thorn std::locale loc("C"); std::cout << "isupper('Þ', C locale) returned " << std::boolalpha << std::isupper(c, loc) << '\n'; loc = std::locale(loc, new std::ctype_byname<wchar_t>("en_US.utf8")); std::cout << "isupper('Þ', C locale with Unicode ctype) returned " << std::boolalpha << std::isupper(c, loc) << '\n'; }
输出:
isupper('Þ', C locale) returned false isupper('Þ', C locale with Unicode ctype) returned true
[编辑] 另请参阅
定义字符分类表 原文: defines character classification tables (类模板) | |
专业化的类型std::ctypechar 原文: specialization of std::ctype for type char (类模板特化) |