MyScript Interactive Ink SDK  3.0.1
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(const char* str);
54 
59  IINK_API String(const std::u16string& str);
60 
65  IINK_API String(const char16_t* str);
66 
67  IINK_API virtual ~String();
68 
74  IINK_API String& operator=(const String& other);
75 
80  IINK_API bool isUtf8() const;
81 
86  IINK_API bool isUtf16() const;
87 
92  IINK_API bool isEmpty() const;
93 
98  IINK_API String toUtf8() const;
99 
104  IINK_API String toUtf16() const;
105 
110  IINK_API operator std::string() const;
111 
116  IINK_API operator std::u16string() const;
117 
118  IINK_API int compare(const char* other) const;
119 
120  IINK_API int compare(const std::string& other) const;
121 
122  IINK_API int compare(const char16_t* other) const;
123 
124  IINK_API int compare(const std::u16string& other) const;
125 
126  IINK_API int compare(const String& other) const;
127 
128  IINK_API bool operator==(const String& other) const;
129 
130  IINK_API bool operator!=(const String& other) const;
131 
132  IINK_API bool operator<(const String& other) const;
133 
134  IINK_API bool operator<=(const String& other) const;
135 
136  IINK_API bool operator>(const String& other) const;
137 
138  IINK_API bool operator>=(const String& other) const;
139 
140 private:
141  String(StringImpl* impl);
142 
143  std::unique_ptr<StringImpl> impl;
144 };
145 
146 inline bool operator==(const String& s1, const char* s2) { return s1.compare(s2) == 0; }
147 inline bool operator!=(const String& s1, const char* s2) { return s1.compare(s2) != 0; }
148 inline bool operator< (const String& s1, const char* s2) { return s1.compare(s2) < 0; }
149 inline bool operator<=(const String& s1, const char* s2) { return s1.compare(s2) <= 0; }
150 inline bool operator> (const String& s1, const char* s2) { return s1.compare(s2) > 0; }
151 inline bool operator>=(const String& s1, const char* s2) { return s1.compare(s2) >= 0; }
152 
153 inline bool operator==(const String& s1, const char16_t* s2) { return s1.compare(s2) == 0; }
154 inline bool operator!=(const String& s1, const char16_t* s2) { return s1.compare(s2) != 0; }
155 inline bool operator< (const String& s1, const char16_t* s2) { return s1.compare(s2) < 0; }
156 inline bool operator<=(const String& s1, const char16_t* s2) { return s1.compare(s2) <= 0; }
157 inline bool operator> (const String& s1, const char16_t* s2) { return s1.compare(s2) > 0; }
158 inline bool operator>=(const String& s1, const char16_t* s2) { return s1.compare(s2) >= 0; }
159 
160 inline bool operator==(const String& s1, const std::string& s2) { return s1.compare(s2) == 0; }
161 inline bool operator!=(const String& s1, const std::string& s2) { return s1.compare(s2) != 0; }
162 inline bool operator< (const String& s1, const std::string& s2) { return s1.compare(s2) < 0; }
163 inline bool operator<=(const String& s1, const std::string& s2) { return s1.compare(s2) <= 0; }
164 inline bool operator> (const String& s1, const std::string& s2) { return s1.compare(s2) > 0; }
165 inline bool operator>=(const String& s1, const std::string& s2) { return s1.compare(s2) >= 0; }
166 
167 inline bool operator==(const String& s1, const std::u16string& s2) { return s1.compare(s2) == 0; }
168 inline bool operator!=(const String& s1, const std::u16string& s2) { return s1.compare(s2) != 0; }
169 inline bool operator< (const String& s1, const std::u16string& s2) { return s1.compare(s2) < 0; }
170 inline bool operator<=(const String& s1, const std::u16string& s2) { return s1.compare(s2) <= 0; }
171 inline bool operator> (const String& s1, const std::u16string& s2) { return s1.compare(s2) > 0; }
172 inline bool operator>=(const String& s1, const std::u16string& s2) { return s1.compare(s2) >= 0; }
173 
174 inline bool operator==(const char* s1, const String& s2) { return s2.compare(s1) == 0; }
175 inline bool operator!=(const char* s1, const String& s2) { return s2.compare(s1) != 0; }
176 inline bool operator< (const char* s1, const String& s2) { return s2.compare(s1) >= 0; }
177 inline bool operator<=(const char* s1, const String& s2) { return s2.compare(s1) > 0; }
178 inline bool operator> (const char* s1, const String& s2) { return s2.compare(s1) <= 0; }
179 inline bool operator>=(const char* s1, const String& s2) { return s2.compare(s1) < 0; }
180 
181 inline bool operator==(const char16_t* s1, const String& s2) { return s2.compare(s1) == 0; }
182 inline bool operator!=(const char16_t* s1, const String& s2) { return s2.compare(s1) != 0; }
183 inline bool operator< (const char16_t* s1, const String& s2) { return s2.compare(s1) >= 0; }
184 inline bool operator<=(const char16_t* s1, const String& s2) { return s2.compare(s1) > 0; }
185 inline bool operator> (const char16_t* s1, const String& s2) { return s2.compare(s1) <= 0; }
186 inline bool operator>=(const char16_t* s1, const String& s2) { return s2.compare(s1) < 0; }
187 
188 inline bool operator==(const std::string& s1, const String& s2) { return s2.compare(s1) == 0; }
189 inline bool operator!=(const std::string& s1, const String& s2) { return s2.compare(s1) != 0; }
190 inline bool operator< (const std::string& s1, const String& s2) { return s2.compare(s1) >= 0; }
191 inline bool operator<=(const std::string& s1, const String& s2) { return s2.compare(s1) > 0; }
192 inline bool operator> (const std::string& s1, const String& s2) { return s2.compare(s1) <= 0; }
193 inline bool operator>=(const std::string& s1, const String& s2) { return s2.compare(s1) < 0; }
194 
195 inline bool operator==(const std::u16string& s1, const String& s2) { return s2.compare(s1) == 0; }
196 inline bool operator!=(const std::u16string& s1, const String& s2) { return s2.compare(s1) != 0; }
197 inline bool operator< (const std::u16string& s1, const String& s2) { return s2.compare(s1) >= 0; }
198 inline bool operator<=(const std::u16string& s1, const String& s2) { return s2.compare(s1) > 0; }
199 inline bool operator> (const std::u16string& s1, const String& s2) { return s2.compare(s1) <= 0; }
200 inline bool operator>=(const std::u16string& s1, const String& s2) { return s2.compare(s1) < 0; }
201 
202 } // end of: namespace iink
203 } // end of: namespace myscript
Definition: String.h:30
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
bool operator<=(const String &other) const
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:148
bool operator<=(const String &s1, const char *s2)
Definition: String.h:149
bool operator==(const String &s1, const char *s2)
Definition: String.h:146
bool operator>(const String &s1, const char *s2)
Definition: String.h:150
bool operator>=(const String &s1, const char *s2)
Definition: String.h:151
bool operator!=(const String &s1, const char *s2)
Definition: String.h:147
Definition: Configuration.h:11