YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
ystring.h
浏览该文件的文档.
1 /*
2  © 2010-2014 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_YContainer
34 #include YFM_YSLib_Adaptor_YTextBase
35 
36 namespace YSLib
37 {
38 
39 namespace Text
40 {
41 
47 class YF_API String : public ucs2string
48 {
49 public:
65  String(const ucs2_t* s)
66  : ucs2string(s)
67  {}
72  template<typename _tChar>
73  String(const _tChar* s, Encoding enc = CS_Default)
75  {}
80  : ucs2string(s)
81  {}
87  : ucs2string(std::move(s))
88  {}
93  template<typename _tChar>
94  String(const std::basic_string<_tChar>& s, Encoding enc = CS_Default)
95  : String(s.c_str(), enc)
96  {}
98 
99 
109 
114  String&
115  operator*=(size_t);
116 
121  PDefH(string, GetMBCS, Encoding enc = CS_Default) const
122  ImplRet(GetMBCSOf<string>(*this, enc))
123 };
124 
125 } // namespace Text;
126 
127 } // namespace YSLib;
128 
129 #endif
130 
#define DefDeDtor(_t)
定义默认析构函数。
Definition: YBaseMacro.h:146
#define ImplRet(...)
Definition: YBaseMacro.h:97
yconstexpr Encoding CS_Default
默认字符编码。
Definition: chrmap.h:45
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:136
#define YF_API
Definition: Platform.h:64
DefDeCtor(String) DefDeCopyCtor(String) DefDeMoveCtor(String) String(const ucs2_t *s)
无参数构造:默认实现。
Definition: ystring.h:53
String(const _tChar *s, Encoding enc=CS_Default)
构造:使用字符指针表示的 NTCTS 和指定编码。
Definition: ystring.h:73
GSStringTemplate< CHRLib::ucs2_t >::basic_string ucs2string
Definition: ycont.h:167
String(const std::basic_string< _tChar > &s, Encoding enc=CS_Default)
构造:使用指定字符类型的 std::basic_string 和指定编码。
Definition: ystring.h:94
YSLib 标准字符串(使用 UCS-2 作为内部编码)。
Definition: ystring.h:47
#define DefDeMoveCtor(_t)
Definition: YBaseMacro.h:141
String(ucs2string &&s)
构造:使用 YSLib 基本字符串右值引用。
Definition: ystring.h:86
char16_t ucs2_t
UCS-2 字符类型。
Definition: chrdef.h:44
#define DefDeMoveAssignment(_t)
Definition: YBaseMacro.h:159
_tDst MakeUCS2LEString(const char *s, Encoding enc=CS_Default)
复制指定编码的多字节字符串为指定类型的 UCS-2 字符串。
Definition: chrproc.h:208
_tDst GetMBCSOf(const _tSrc &src, Encoding enc=CS_Default)
取 UCS-2 字符串转换的指定编码的多字节字符串。
Definition: chrproc.h:150
String(const ucs2string &s)
构造:使用 YSLib 基本字符串。
Definition: ystring.h:79
#define DefDeCopyAssignment(_t)
Definition: YBaseMacro.h:154