MyScript Interactive Ink SDK 4.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
19namespace myscript {
20namespace iink {
21
26class String
27{
28public:
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
193private:
194 std::string impl;
195};
196
197inline bool operator==(const String& s1, const char* s2) { return s1.compare(s2) == 0; }
198inline bool operator!=(const String& s1, const char* s2) { return s1.compare(s2) != 0; }
199inline bool operator< (const String& s1, const char* s2) { return s1.compare(s2) < 0; }
200inline bool operator<=(const String& s1, const char* s2) { return s1.compare(s2) <= 0; }
201inline bool operator> (const String& s1, const char* s2) { return s1.compare(s2) > 0; }
202inline bool operator>=(const String& s1, const char* s2) { return s1.compare(s2) >= 0; }
203
204inline bool operator==(const String& s1, const char16_t* s2) { return s1.compare(s2) == 0; }
205inline bool operator!=(const String& s1, const char16_t* s2) { return s1.compare(s2) != 0; }
206inline bool operator< (const String& s1, const char16_t* s2) { return s1.compare(s2) < 0; }
207inline bool operator<=(const String& s1, const char16_t* s2) { return s1.compare(s2) <= 0; }
208inline bool operator> (const String& s1, const char16_t* s2) { return s1.compare(s2) > 0; }
209inline bool operator>=(const String& s1, const char16_t* s2) { return s1.compare(s2) >= 0; }
210
211inline bool operator==(const String& s1, const std::string& s2) { return s1.compare(s2) == 0; }
212inline bool operator!=(const String& s1, const std::string& s2) { return s1.compare(s2) != 0; }
213inline bool operator< (const String& s1, const std::string& s2) { return s1.compare(s2) < 0; }
214inline bool operator<=(const String& s1, const std::string& s2) { return s1.compare(s2) <= 0; }
215inline bool operator> (const String& s1, const std::string& s2) { return s1.compare(s2) > 0; }
216inline bool operator>=(const String& s1, const std::string& s2) { return s1.compare(s2) >= 0; }
217
218inline bool operator==(const String& s1, const std::u16string& s2) { return s1.compare(s2) == 0; }
219inline bool operator!=(const String& s1, const std::u16string& s2) { return s1.compare(s2) != 0; }
220inline bool operator< (const String& s1, const std::u16string& s2) { return s1.compare(s2) < 0; }
221inline bool operator<=(const String& s1, const std::u16string& s2) { return s1.compare(s2) <= 0; }
222inline bool operator> (const String& s1, const std::u16string& s2) { return s1.compare(s2) > 0; }
223inline bool operator>=(const String& s1, const std::u16string& s2) { return s1.compare(s2) >= 0; }
224
225inline bool operator==(const char* s1, const String& s2) { return s2.compare(s1) == 0; }
226inline bool operator!=(const char* s1, const String& s2) { return s2.compare(s1) != 0; }
227inline bool operator< (const char* s1, const String& s2) { return s2.compare(s1) >= 0; }
228inline bool operator<=(const char* s1, const String& s2) { return s2.compare(s1) > 0; }
229inline bool operator> (const char* s1, const String& s2) { return s2.compare(s1) <= 0; }
230inline bool operator>=(const char* s1, const String& s2) { return s2.compare(s1) < 0; }
231
232inline bool operator==(const char16_t* s1, const String& s2) { return s2.compare(s1) == 0; }
233inline bool operator!=(const char16_t* s1, const String& s2) { return s2.compare(s1) != 0; }
234inline bool operator< (const char16_t* s1, const String& s2) { return s2.compare(s1) >= 0; }
235inline bool operator<=(const char16_t* s1, const String& s2) { return s2.compare(s1) > 0; }
236inline bool operator> (const char16_t* s1, const String& s2) { return s2.compare(s1) <= 0; }
237inline bool operator>=(const char16_t* s1, const String& s2) { return s2.compare(s1) < 0; }
238
239inline bool operator==(const std::string& s1, const String& s2) { return s2.compare(s1) == 0; }
240inline bool operator!=(const std::string& s1, const String& s2) { return s2.compare(s1) != 0; }
241inline bool operator< (const std::string& s1, const String& s2) { return s2.compare(s1) >= 0; }
242inline bool operator<=(const std::string& s1, const String& s2) { return s2.compare(s1) > 0; }
243inline bool operator> (const std::string& s1, const String& s2) { return s2.compare(s1) <= 0; }
244inline bool operator>=(const std::string& s1, const String& s2) { return s2.compare(s1) < 0; }
245
246inline bool operator==(const std::u16string& s1, const String& s2) { return s2.compare(s1) == 0; }
247inline bool operator!=(const std::u16string& s1, const String& s2) { return s2.compare(s1) != 0; }
248inline bool operator< (const std::u16string& s1, const String& s2) { return s2.compare(s1) >= 0; }
249inline bool operator<=(const std::u16string& s1, const String& s2) { return s2.compare(s1) > 0; }
250inline bool operator> (const std::u16string& s1, const String& s2) { return s2.compare(s1) <= 0; }
251inline 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(const std::string &str)
String(const std::u16string &str)
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
const char * c_str() 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
String & operator=(String &&other)
String(std::string &&str)
int compare(const char16_t *other) const
int compare(const std::u16string &other) const
String toUtf8() const
String & operator=(const String &other)
String toUtf16() const
bool operator>=(const String &other) const
const std::string & asUtf8() 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:10