MyScript Interactive Ink SDK  3.1.3
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 <memory>
18 #include <string>
19 
20 namespace myscript {
21 namespace iink {
22 
23 class StringImpl;
24 
29 class String
30 {
31 public:
35  IINK_API String();
36 
41  IINK_API String(const String& str);
42 
47  IINK_API String(const std::string& str);
48 
53  IINK_API String(std::string&& str);
54 
59  IINK_API String(const char* str);
60 
65  IINK_API String(const std::u16string& str);
66 
71  IINK_API String(std::u16string&& str);
72 
77  IINK_API String(const char16_t* str);
78 
79  IINK_API virtual ~String();
80 
86  IINK_API String& operator=(const String& other);
87 
93  IINK_API String& operator=(String&& other);
94 
99  IINK_API bool isUtf8() const;
100 
105  IINK_API bool isUtf16() const;
106 
111  IINK_API bool isEmpty() const;
112 
117  IINK_API String toUtf8() const;
118 
123  IINK_API String toUtf16() const;
124 
129  IINK_API operator std::string() const;
130 
135  IINK_API operator std::u16string() const;
136 
137  IINK_API int compare(const char* other) const;
138 
139  IINK_API int compare(const std::string& other) const;
140 
141  IINK_API int compare(const char16_t* other) const;
142 
143  IINK_API int compare(const std::u16string& other) const;
144 
145  IINK_API int compare(const String& other) const;
146 
147  IINK_API bool operator==(const String& other) const;
148 
149  IINK_API bool operator!=(const String& other) const;
150 
151  IINK_API bool operator<(const String& other) const;
152 
153  IINK_API bool operator<=(const String& other) const;
154 
155  IINK_API bool operator>(const String& other) const;
156 
157  IINK_API bool operator>=(const String& other) const;
158 
159 private:
160  String(StringImpl* impl);
161 
162  std::unique_ptr<StringImpl> impl;
163 };
164 
165 inline bool operator==(const String& s1, const char* s2) { return s1.compare(s2) == 0; }
166 inline bool operator!=(const String& s1, const char* s2) { return s1.compare(s2) != 0; }
167 inline bool operator< (const String& s1, const char* s2) { return s1.compare(s2) < 0; }
168 inline bool operator<=(const String& s1, const char* s2) { return s1.compare(s2) <= 0; }
169 inline bool operator> (const String& s1, const char* s2) { return s1.compare(s2) > 0; }
170 inline bool operator>=(const String& s1, const char* s2) { return s1.compare(s2) >= 0; }
171 
172 inline bool operator==(const String& s1, const char16_t* s2) { return s1.compare(s2) == 0; }
173 inline bool operator!=(const String& s1, const char16_t* s2) { return s1.compare(s2) != 0; }
174 inline bool operator< (const String& s1, const char16_t* s2) { return s1.compare(s2) < 0; }
175 inline bool operator<=(const String& s1, const char16_t* s2) { return s1.compare(s2) <= 0; }
176 inline bool operator> (const String& s1, const char16_t* s2) { return s1.compare(s2) > 0; }
177 inline bool operator>=(const String& s1, const char16_t* s2) { return s1.compare(s2) >= 0; }
178 
179 inline bool operator==(const String& s1, const std::string& s2) { return s1.compare(s2) == 0; }
180 inline bool operator!=(const String& s1, const std::string& s2) { return s1.compare(s2) != 0; }
181 inline bool operator< (const String& s1, const std::string& s2) { return s1.compare(s2) < 0; }
182 inline bool operator<=(const String& s1, const std::string& s2) { return s1.compare(s2) <= 0; }
183 inline bool operator> (const String& s1, const std::string& s2) { return s1.compare(s2) > 0; }
184 inline bool operator>=(const String& s1, const std::string& s2) { return s1.compare(s2) >= 0; }
185 
186 inline bool operator==(const String& s1, const std::u16string& s2) { return s1.compare(s2) == 0; }
187 inline bool operator!=(const String& s1, const std::u16string& s2) { return s1.compare(s2) != 0; }
188 inline bool operator< (const String& s1, const std::u16string& s2) { return s1.compare(s2) < 0; }
189 inline bool operator<=(const String& s1, const std::u16string& s2) { return s1.compare(s2) <= 0; }
190 inline bool operator> (const String& s1, const std::u16string& s2) { return s1.compare(s2) > 0; }
191 inline bool operator>=(const String& s1, const std::u16string& s2) { return s1.compare(s2) >= 0; }
192 
193 inline bool operator==(const char* s1, const String& s2) { return s2.compare(s1) == 0; }
194 inline bool operator!=(const char* s1, const String& s2) { return s2.compare(s1) != 0; }
195 inline bool operator< (const char* s1, const String& s2) { return s2.compare(s1) >= 0; }
196 inline bool operator<=(const char* s1, const String& s2) { return s2.compare(s1) > 0; }
197 inline bool operator> (const char* s1, const String& s2) { return s2.compare(s1) <= 0; }
198 inline bool operator>=(const char* s1, const String& s2) { return s2.compare(s1) < 0; }
199 
200 inline bool operator==(const char16_t* s1, const String& s2) { return s2.compare(s1) == 0; }
201 inline bool operator!=(const char16_t* s1, const String& s2) { return s2.compare(s1) != 0; }
202 inline bool operator< (const char16_t* s1, const String& s2) { return s2.compare(s1) >= 0; }
203 inline bool operator<=(const char16_t* s1, const String& s2) { return s2.compare(s1) > 0; }
204 inline bool operator> (const char16_t* s1, const String& s2) { return s2.compare(s1) <= 0; }
205 inline bool operator>=(const char16_t* s1, const String& s2) { return s2.compare(s1) < 0; }
206 
207 inline bool operator==(const std::string& s1, const String& s2) { return s2.compare(s1) == 0; }
208 inline bool operator!=(const std::string& s1, const String& s2) { return s2.compare(s1) != 0; }
209 inline bool operator< (const std::string& s1, const String& s2) { return s2.compare(s1) >= 0; }
210 inline bool operator<=(const std::string& s1, const String& s2) { return s2.compare(s1) > 0; }
211 inline bool operator> (const std::string& s1, const String& s2) { return s2.compare(s1) <= 0; }
212 inline bool operator>=(const std::string& s1, const String& s2) { return s2.compare(s1) < 0; }
213 
214 inline bool operator==(const std::u16string& s1, const String& s2) { return s2.compare(s1) == 0; }
215 inline bool operator!=(const std::u16string& s1, const String& s2) { return s2.compare(s1) != 0; }
216 inline bool operator< (const std::u16string& s1, const String& s2) { return s2.compare(s1) >= 0; }
217 inline bool operator<=(const std::u16string& s1, const String& s2) { return s2.compare(s1) > 0; }
218 inline bool operator> (const std::u16string& s1, const String& s2) { return s2.compare(s1) <= 0; }
219 inline bool operator>=(const std::u16string& s1, const String& s2) { return s2.compare(s1) < 0; }
220 
221 } // end of: namespace iink
222 } // end of: namespace myscript
Definition: String.h:30
String & operator=(String &&other)
String & operator=(const String &other)
String(const std::string &str)
String(const std::u16string &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
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:167
bool operator<=(const String &s1, const char *s2)
Definition: String.h:168
bool operator==(const String &s1, const char *s2)
Definition: String.h:165
bool operator>(const String &s1, const char *s2)
Definition: String.h:169
bool operator>=(const String &s1, const char *s2)
Definition: String.h:170
bool operator!=(const String &s1, const char *s2)
Definition: String.h:166
Definition: Configuration.h:11