YSTest  PreAlpha_b400_20130424
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
ystring.h
浏览该文件的文档.
1 /*
2  Copyright by FrankHB 2010 - 2013.
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 "yobject.h"
32 #include "../Adaptor/ycont.h"
33 #include "../Adaptor/YTextBase.h"
34 
36 
38 
39 
45 class YF_API String : public ucs2string
46 {
47 private:
48  static ucs2_t* s_str;
49 
50 public:
54  inline DefDeCtor(String)
58  inline DefDeCopyCtor(String)
62  inline DefDeMoveCtor(String)
66  String(const ucs2_t* s)
67  : ucs2string(s)
68  {}
73  template<typename _tChar>
74  String(const _tChar* s, Encoding cp = CS_Default)
75  : ucs2string(s_str = ucsdup(s, cp))
76  {
77  std::free(s_str);
78  }
82  String(const ucs2string& s)
83  : ucs2string(s)
84  {}
89  String(ucs2string&& s)
90  : ucs2string(std::move(s))
91  {}
96  template<typename _tChar>
97  String(const std::basic_string<_tChar>& s, Encoding cs = CS_Default)
98  : ucs2string(s_str = ucsdup(s.c_str(), cs))
99  {
100  std::free(s_str);
101  }
102  inline DefDeDtor(String)
103 
104 
114 
119  string
120  GetMBCS(Encoding enc = CS_Default) const
121  {
122  return GetMBCSOf<string>(*this, enc);
123  }
124 };
125 
126 YSL_END_NAMESPACE(Text)
127 
128 YSL_END
129 
130 #endif
131