YSTest: cwctype.cpp 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

cwctype.cpp
浏览该文件的文档.
1 /*
2 © 2014-2015 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #include "ystdex/cwctype.h"
29
30 namespace ystdex
31 {
32
33 bool
34 iswprint(wchar_t wc) ynothrow
35 {
36 // TODO: See https://www.sourceware.org/cgi-bin/cvsweb.cgi/src/newlib/libc/ctype/iswprint.c?cvsroot=src.
37 // NOTE: See http://git.musl-libc.org/cgit/musl/tree/src/ctype/iswprint.c.
38 const auto c = unsigned(wc);
39
40 if(c < 0xFFU)
41 return ((c + 1) & 0x7F) >= 0x21;
42 if(c < 0x2028U || c - 0x202AU < 0xD800 - 0x202A
43 || c - 0xE000U < 0xFFF9 - 0xE000)
44 return true;
45 return !(c - 0xFFFCU > 0x10FFFF-0xFFFC || (c & 0xFFFE) == 0xFFFE);
46 }
47
48 bool
49 iswspace(wchar_t wc) ynothrow
50 {
51 // NOTE: See https://www.sourceware.org/cgi-bin/cvsweb.cgi/src/newlib/libc/ctype/iswprint.c?cvsroot=src.
52 return (wc >= 0x0009 && wc <= 0x000D) || wc == 0x0020 || wc == 0x1680
53 || wc == 0x180e || (wc >= 0x2000 && wc <= 0x200A && wc != 2007)
54 || wc == 0x2028 || wc == 0x2029 || wc == 0x205F || wc == 0x3000;
55 }
56
57 } // namespace ystdex;
58
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:740
CHRLib::c
c
Definition: CharacterProcessing.h:81
ystdex::iswprint
bool iswprint(wchar_t)
区域无关的 std::isprint 实现。
Definition: cwctype.cpp:34
platform_ex::Windows::unsigned
YF_API unsigned
Definition: MinGW32.h:630
ystdex
特性测试宏。
Definition: ydef.h:796
cwctype.h
ISO C 宽字符分类操作扩展。
ystdex::iswspace
bool iswspace(wchar_t)
区域无关的 std::iswspace 实现。
Definition: cwctype.cpp:49