ScummVM API documentation
dbcs-str.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef COMMON_DBCS_STR_H
23 #define COMMON_DBCS_STR_H
24 
25 #include "common/scummsys.h"
26 #include "common/util.h"
27 #include "common/str-enc.h"
28 #include "common/str-base.h"
29 
30 namespace Common {
31 
32 class String;
33 
41 class DBCSString : public BaseString<uint16> {
42 public:
43  typedef uint32 unsigned_type;
44 public:
46  constexpr DBCSString() : BaseString<uint16>() {}
47 
49  explicit DBCSString(const value_type *str) : BaseString<uint16>(str) {}
50 
52  DBCSString(const value_type *str, uint32 len) : BaseString<uint16>(str, len) {}
53 
54  explicit DBCSString(const uint32 *str) : BaseString<uint16>((const value_type *) str) {}
55  DBCSString(const uint32 *str, uint32 len) : BaseString<uint16>((const value_type *) str, len) {}
56  DBCSString(const uint32 *beginP, const uint32 *endP) : BaseString<uint16>((const value_type *) beginP, (const value_type *) endP) {}
57 
59  DBCSString(const value_type *beginP, const value_type *endP) : BaseString<uint16>(beginP, endP) {}
60 
62  DBCSString(const DBCSString &str) : BaseString<uint16>(str) {}
63 
65  DBCSString(DBCSString &&str) : BaseString<uint16>(static_cast<BaseString<uint16> &&>(str)) {}
66 
68  explicit DBCSString(const char *str);
69 
71  DBCSString(const char *str, uint32 len);
72 
74  DBCSString(const char *beginP, const char *endP);
75 
77  explicit DBCSString(const String &str);
78 
80  explicit DBCSString(value_type c);
81 
83  DBCSString &operator=(const DBCSString &str);
84 
87 
89  DBCSString &operator=(const String &str);
90 
92  DBCSString &operator=(const value_type *str);
93 
95  DBCSString &operator=(const char *str);
96 
98  DBCSString &operator=(value_type c);
99 
101  DBCSString &operator+=(const DBCSString &str);
102 
104  DBCSString &operator+=(const value_type *str);
105 
107  DBCSString &operator+=(value_type c);
108 
111 
113  bool operator==(const String &x) const;
114 
116  bool operator==(const char *x) const;
117 
119  bool operator!=(const String &x) const;
120 
122  bool operator!=(const char *x) const;
123 
125  String convertToString() const;
126 
128  DBCSString substr(size_t pos = 0, size_t len = npos) const;
129 
130 private:
131  void decodeDBCS(const char *str, uint32 len);
132 
133  friend class String;
134 };
135 
137 DBCSString operator+(const DBCSString &x, const DBCSString &y);
138 
140 DBCSString operator+(const DBCSString &x, DBCSString::value_type y);
141 
144 } // End of namespace Common
145 
146 #endif
Definition: str.h:59
DBCSString(const value_type *beginP, const value_type *endP)
Definition: dbcs-str.h:59
uint32 unsigned_type
Definition: dbcs-str.h:43
DBCSString(const value_type *str)
Definition: dbcs-str.h:49
Definition: str-base.h:32
DBCSString(const value_type *str, uint32 len)
Definition: dbcs-str.h:52
String convertToString() const
DBCSString & operator=(const DBCSString &str)
DBCSString(const DBCSString &str)
Definition: dbcs-str.h:62
Definition: algorithm.h:29
DBCSString operator+(const DBCSString &x, const DBCSString &y)
DBCSString substr(size_t pos=0, size_t len=npos) const
DBCSString & operator+=(const DBCSString &str)
DBCSString(DBCSString &&str)
Definition: dbcs-str.h:65
Definition: dbcs-str.h:41
bool operator!=(const String &x) const
constexpr DBCSString()
Definition: dbcs-str.h:46
bool operator==(const String &x) const