YSTest: YString.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

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

- 文件列表
- 文件成员

YString.h
浏览该文件的文档.
1 /*
2 © 2010-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 #ifndef YSL_INC_Core_YString_h_
29 #define YSL_INC_Core_YString_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_Core_YObject
33 #include YFM_YSLib_Adaptor_YTextBase // for u16string;
34
35 namespace YSLib
36 {
37
38 namespace Text
39 {
40
46 class YF_API String : public u16string
47 {
48 public:
52 DefDeCtor(String)
54
55 using u16string::u16string;
57 String(const u16string& s)
58 : u16string(s)
59 {}
61 String(u16string&& s)
62 : u16string(std::move(s))
63 {}
64 explicit
65 String(u16string_view sv)
66 : u16string(sv)
67 {}
69
74 template<typename _tChar>
75 YB_NONNULL(2)
76 String(const _tChar* s, Encoding enc = CS_Default)
77 : u16string(MakeUCS2LE<u16string>(s, enc))
78 {}
84 template<typename _tChar>
85 YB_NONNULL(2)
86 String(const _tChar* s, size_t n, Encoding enc = CS_Default)
87 : String(basic_string_view<_tChar>(s, n), enc)
88 {}
90 template<typename _tChar>
91 explicit
92 String(basic_string_view<_tChar> sv, Encoding enc = CS_Default)
93 : u16string(MakeUCS2LE<u16string>(sv, enc))
94 {}
99 template<typename _tChar>
100 String(const std::basic_string<_tChar>& s, Encoding enc = CS_Default)
101 : String(s.c_str(), enc)
102 {}
107 template<typename _tChar>
108 String(std::initializer_list<_tChar> il)
109 : u16string(il.begin(), il.end())
110 {}
114 DefDeCopyCtor(String)
118 DefDeMoveCtor(String)
119 DefDeDtor(String)
120
125 DefDeCopyAssignment(String)
130 DefDeMoveAssignment(String)
131
136 String&
137 operator*=(size_t);
138
143 PDefH(string, GetMBCS, Encoding enc = CS_Default) const
144 ImplRet(MakeMBCS<string>(*this, enc))
145 };
146
151 inline PDefHOp(String, *, const String& str, size_t n)
152 ImplRet(String(str) *= n)
153
154 } // namespace Text;
155
156 } // namespace YSLib;
157
158 #endif
159
CHRLib::enc
enc
Definition: CharacterProcessing.h:81
YModules.h
CHRLib::MakeUCS2LE
_tDst MakeUCS2LE(basic_string_view< char > sv, _tParams &&...args)
Definition: CharacterProcessing.h:538
platform::containers::u16string
basic_string< char16_t > u16string
Definition: Container.h:103
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
YSLib::PDefH
PDefH(Environment &, FetchEnvironment,) ImplRet(FetchGlobalInstance().GetEnvironmentRef()) inline PDefH(GUIHost &
取单一环境对象引用。
DefDeCopyAssignment
#define DefDeCopyAssignment(_t)
Definition: YBaseMacro.h:185
NPL::SXML::ParseOption::String
CHRLib::CS_Default
yconstexpr const Encoding CS_Default(CharSet::UTF_8)
默认字符编码。
DefDeCtor
#define DefDeCtor(_t)
简单通用成员函数定义。
Definition: YBaseMacro.h:156
YSLib::Text::String
YSLib 标准字符串（使用 UCS-2 作为内部编码）。
Definition: YString.h:46
CHRLib::CharSet::Encoding
Encoding
字符流编码标识。
Definition: Encoding.h:58
std
Definition: memory.hpp:1100
DefDeMoveAssignment
#define DefDeMoveAssignment(_t)
Definition: YBaseMacro.h:190
ystdex::basic_string_view
Definition: string_view.hpp:49
DefDeCopyCtor
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:161
YSLib::Text::str
const char const char * str
Definition: TextFile.h:77
DefDeMoveCtor
#define DefDeMoveCtor(_t)
Definition: YBaseMacro.h:166
YSLib::Text::YB_NONNULL
YB_NONNULL(1, 2) PDefH(bool
检查缓冲区是否具有指定的 BOM 。
ystdex::u16string_view
basic_string_view< char16_t > u16string_view
Definition: string_view.hpp:416
YSLib::Text::String::String
DefDeCtor(String) using u16string String(const u16string &s)
无参数构造：默认实现。
Definition: YString.h:57
DefDeDtor
#define DefDeDtor(_t)
Definition: YBaseMacro.h:176
Text
NPL::c_str
YF_API const char src c_str())) YF_API void InstallDirectory(const string &
安装目录：复制目录树。
CHRLib::MakeMBCS
_tDst MakeMBCS(string_view sv, Encoding enc)
Definition: CharacterProcessing.h:603
YSLib::Text::String::String
String(u16string &&s)
构造：使用 YSLib 基本字符串右值引用。
Definition: YString.h:61
YF_API
#define YF_API
Definition: Platform.h:56
ystdex::cpp2011::begin
_type * begin(_type(&&array)[_vN])
Definition: range.hpp:46
YSLib::Text::ImplRet
const char const char size_t n ImplRet(std::char_traits< char >::compare(buf, str, n)==0) template< size_t _vN > inline YB_NONNULL(1) bool CheckBOM(const char *buf
YSLib::Text::String::String
String(u16string_view sv)
Definition: YString.h:65
ystdex::cpp2011::end
_type * end(_type(&&array)[_vN])
Definition: range.hpp:54
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140
platform::n
size_t n
Definition: YCLib/FileSystem.cpp:321