ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 
55  DBCSString(const value_type *beginP, const value_type *endP) : BaseString<uint16>(beginP, endP) {}
56 
58  DBCSString(const DBCSString &str) : BaseString<uint16>(str) {}
59 
61  DBCSString(DBCSString &&str) : BaseString<uint16>(static_cast<BaseString<uint16> &&>(str)) {}
62 
64  explicit DBCSString(const char *str);
65 
67  DBCSString(const char *str, uint32 len);
68 
70  DBCSString(const char *beginP, const char *endP);
71 
73  explicit DBCSString(const String &str);
74 
76  explicit constexpr DBCSString(value_type c) : BaseString<uint16>(c) {}
77 
79  DBCSString &operator=(const DBCSString &str);
80 
83 
85  DBCSString &operator=(const String &str);
86 
88  DBCSString &operator=(const value_type *str);
89 
91  DBCSString &operator=(const char *str);
92 
94  DBCSString &operator=(value_type c);
95 
97  DBCSString &operator+=(const DBCSString &str);
98 
100  DBCSString &operator+=(const value_type *str);
101 
103  DBCSString &operator+=(value_type c);
104 
107 
109  bool operator==(const String &x) const;
110 
112  bool operator==(const char *x) const;
113 
115  bool operator!=(const String &x) const;
116 
118  bool operator!=(const char *x) const;
119 
121  String convertToString() const;
122 
124  DBCSString substr(size_t pos = 0, size_t len = npos) const;
125 
126 private:
127  void decodeDBCS(const char *str, uint32 len);
128 
129  friend class String;
130 };
131 
133 DBCSString operator+(const DBCSString &x, const DBCSString &y);
134 
136 DBCSString operator+(const DBCSString &x, DBCSString::value_type y);
137 
140 } // End of namespace Common
141 
142 #endif
Definition: str.h:59
DBCSString(const value_type *beginP, const value_type *endP)
Definition: dbcs-str.h:55
uint32 unsigned_type
Definition: dbcs-str.h:43
DBCSString(const value_type *str)
Definition: dbcs-str.h:49
constexpr DBCSString(value_type c)
Definition: dbcs-str.h:76
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:58
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:61
Definition: dbcs-str.h:41
bool operator!=(const String &x) const
constexpr DBCSString()
Definition: dbcs-str.h:46
bool operator==(const String &x) const