MyScript Interactive Ink SDK  3.2.0
String.h
1 // Copyright @ MyScript. All rights reserved.
2 
3 #pragma once
4 
5 #ifndef IINK_API
6 #if defined(_WIN32)
7 #ifdef IINK_IMPL
8 #define IINK_API __declspec(dllexport)
9 #else
10 #define IINK_API __declspec(dllimport)
11 #endif
12 #else
13 #define IINK_API
14 #endif
15 #endif
16 
17 #include <string>
18 
19 namespace myscript {
20 namespace iink {
21 
26 class String
27 {
28 public:
32  IINK_API String();
33 
38  IINK_API String(const String& str);
39 
44  IINK_API String(String&& str);
45 
50  IINK_API String(const std::string& str);
51 
56  IINK_API String(std::string&& str);
57 
62  IINK_API String(const char* str);
63 
68  IINK_API String(const std::u16string& str);
69 
74  IINK_API String(std::u16string&& str);
75 
80  IINK_API String(const char16_t* str);
81 
82  IINK_API virtual ~String();
83 
89  IINK_API String& operator=(const String& other);
90 
96  IINK_API String& operator=(String&& other);
97 
104  IINK_API bool isUtf8() const;
105 
112  IINK_API bool isUtf16() const;
113 
118  IINK_API bool isEmpty() const;
119 
125  IINK_API size_t size() const;
126 
134  IINK_API const char* c_str() const;
135 
142  IINK_API String toUtf8() const;
143 
150  IINK_API String toUtf16() const;
151 
157  IINK_API const std::string& asUtf8() const;
158 
163  IINK_API operator std::string() const;
164 
169  IINK_API explicit operator std::u16string() const;
170 
171  IINK_API int compare(const char* other) const;
172 
173  IINK_API int compare(const std::string& other) const;
174 
175  IINK_API int compare(const char16_t* other) const;
176 
177  IINK_API int compare(const std::u16string& other) const;
178 
179  IINK_API int compare(const String& other) const;
180 
181  IINK_API bool operator==(const String& other) const;
182 
183  IINK_API bool operator!=(const String& other) const;
184 
185  IINK_API bool operator<(const String& other) const;
186 
187  IINK_API bool operator<=(const String& other) const;
188 
189  IINK_API bool operator>(const String& other) const;
190 
191  IINK_API bool operator>=(const String& other) const;
192 
193 private:
194  std::string impl;
195 };
196 
197 inline bool operator==(const String& s1, const char* s2) { return s1.compare(s2) == 0; }
198 inline bool operator!=(const String& s1, const char* s2) { return s1.compare(s2) != 0; }
199 inline bool operator< (const String& s1, const char* s2) { return s1.compare(s2) < 0; }
200 inline bool operator<=(const String& s1, const char* s2) { return s1.compare(s2) <= 0; }
201 inline bool operator> (const String& s1, const char* s2) { return s1.compare(s2) > 0; }
202 inline bool operator>=(const String& s1, const char* s2) { return s1.compare(s2) >= 0; }
203 
204 inline bool operator==(const String& s1, const char16_t* s2) { return s1.compare(s2) == 0; }
205 inline bool operator!=(const String& s1, const char16_t* s2) { return s1.compare(s2) != 0; }
206 inline bool operator< (const String& s1, const char16_t* s2) { return s1.compare(s2) < 0; }
207 inline bool operator<=(const String& s1, const char16_t* s2) { return s1.compare(s2) <= 0; }
208 inline bool operator> (const String& s1, const char16_t* s2) { return s1.compare(s2) > 0; }
209 inline bool operator>=(const String& s1, const char16_t* s2) { return s1.compare(s2) >= 0; }
210 
211 inline bool operator==(const String& s1, const std::string& s2) { return s1.compare(s2) == 0; }
212 inline bool operator!=(const String& s1, const std::string& s2) { return s1.compare(s2) != 0; }
213 inline bool operator< (const String& s1, const std::string& s2) { return s1.compare(s2) < 0; }
214 inline bool operator<=(const String& s1, const std::string& s2) { return s1.compare(s2) <= 0; }
215 inline bool operator> (const String& s1, const std::string& s2) { return s1.compare(s2) > 0; }
216 inline bool operator>=(const String& s1, const std::string& s2) { return s1.compare(s2) >= 0; }
217 
218 inline bool operator==(const String& s1, const std::u16string& s2) { return s1.compare(s2) == 0; }
219 inline bool operator!=(const String& s1, const std::u16string& s2) { return s1.compare(s2) != 0; }
220 inline bool operator< (const String& s1, const std::u16string& s2) { return s1.compare(s2) < 0; }
221 inline bool operator<=(const String& s1, const std::u16string& s2) { return s1.compare(s2) <= 0; }
222 inline bool operator> (const String& s1, const std::u16string& s2) { return s1.compare(s2) > 0; }
223 inline bool operator>=(const String& s1, const std::u16string& s2) { return s1.compare(s2) >= 0; }
224 
225 inline bool operator==(const char* s1, const String& s2) { return s2.compare(s1) == 0; }
226 inline bool operator!=(const char* s1, const String& s2) { return s2.compare(s1) != 0; }
227 inline bool operator< (const char* s1, const String& s2) { return s2.compare(s1) >= 0; }
228 inline bool operator<=(const char* s1, const String& s2) { return s2.compare(s1) > 0; }
229 inline bool operator> (const char* s1, const String& s2) { return s2.compare(s1) <= 0; }
230 inline bool operator>=(const char* s1, const String& s2) { return s2.compare(s1) < 0; }
231 
232 inline bool operator==(const char16_t* s1, const String& s2) { return s2.compare(s1) == 0; }
233 inline bool operator!=(const char16_t* s1, const String& s2) { return s2.compare(s1) != 0; }
234 inline bool operator< (const char16_t* s1, const String& s2) { return s2.compare(s1) >= 0; }
235 inline bool operator<=(const char16_t* s1, const String& s2) { return s2.compare(s1) > 0; }
236 inline bool operator> (const char16_t* s1, const String& s2) { return s2.compare(s1) <= 0; }
237 inline bool operator>=(const char16_t* s1, const String& s2) { return s2.compare(s1) < 0; }
238 
239 inline bool operator==(const std::string& s1, const String& s2) { return s2.compare(s1) == 0; }
240 inline bool operator!=(const std::string& s1, const String& s2) { return s2.compare(s1) != 0; }
241 inline bool operator< (const std::string& s1, const String& s2) { return s2.compare(s1) >= 0; }
242 inline bool operator<=(const std::string& s1, const String& s2) { return s2.compare(s1) > 0; }
243 inline bool operator> (const std::string& s1, const String& s2) { return s2.compare(s1) <= 0; }
244 inline bool operator>=(const std::string& s1, const String& s2) { return s2.compare(s1) < 0; }
245 
246 inline bool operator==(const std::u16string& s1, const String& s2) { return s2.compare(s1) == 0; }
247 inline bool operator!=(const std::u16string& s1, const String& s2) { return s2.compare(s1) != 0; }
248 inline bool operator< (const std::u16string& s1, const String& s2) { return s2.compare(s1) >= 0; }
249 inline bool operator<=(const std::u16string& s1, const String& s2) { return s2.compare(s1) > 0; }
250 inline bool operator> (const std::u16string& s1, const String& s2) { return s2.compare(s1) <= 0; }
251 inline bool operator>=(const std::u16string& s1, const String& s2) { return s2.compare(s1) < 0; }
252 
253 } // end of: namespace iink
254 } // end of: namespace myscript
Definition: String.h:27
String & operator=(String &&other)
String & operator=(const String &other)
String(const std::string &str)
String(const std::u16string &str)
const std::string & asUtf8() const
String(String &&str)
bool operator<(const String &other) const
String(const char16_t *str)
bool operator==(const String &other) const
int compare(const std::string &other) const
bool operator>(const String &other) const
String(const char *str)
String(const String &str)
int compare(const char *other) const
int compare(const String &other) const
String(std::u16string &&str)
bool operator<=(const String &other) const
size_t size() const
const char * c_str() const
String(std::string &&str)
int compare(const char16_t *other) const
int compare(const std::u16string &other) const
String toUtf8() const
String toUtf16() const
bool operator>=(const String &other) const
bool operator!=(const String &other) const
bool operator<(const String &s1, const char *s2)
Definition: String.h:199
bool operator<=(const String &s1, const char *s2)
Definition: String.h:200
bool operator==(const String &s1, const char *s2)
Definition: String.h:197
bool operator>(const String &s1, const char *s2)
Definition: String.h:201
bool operator>=(const String &s1, const char *s2)
Definition: String.h:202
bool operator!=(const String &s1, const char *s2)
Definition: String.h:198
Definition: Configuration.h:11