3 #include <opals/fwd.hpp>
10 struct random_access_iterator_tag;
41 template<
bool Const,
bool Forward>
49 using value_type = char;
50 using pointer =
char*;
51 using reference =
char&;
52 using const_reference =
char const&;
53 using size_type = std::size_t;
54 using difference_type = std::ptrdiff_t;
56 static const size_type& npos();
62 String(
const String& that, size_type pos, size_type n = npos());
65 String(
const char* s, size_type n);
66 String(size_type n,
char c);
78 String& operator=(
const char* that);
81 String& assign(
const String& s, size_type pos, size_type n);
82 String& assign(
const char* s, size_type n);
83 String& assign(
const char* s);
84 String& assign(size_type n,
char c);
114 reference at(size_type n);
115 const_reference at(size_type n)
const;
116 reference operator[](size_type n);
117 const_reference operator[](size_type n)
const;
119 const_reference front()
const;
121 const_reference back()
const;
122 const char* c_str()
const;
123 const char* data()
const;
128 size_type size()
const;
129 size_type length()
const;
130 size_type max_size()
const;
131 size_type capacity()
const;
134 void resize(size_type n,
char c =
char());
140 String& append(
const String& s, size_type pos, size_type n);
141 String& append(
const char* s);
142 String& append(
const char* s, size_type n);
143 String& append(size_type n,
char c);
149 void push_back(
char c);
152 String& operator+=(
const char* s);
153 String& operator+=(
char c);
159 void insert(
iterator pos, size_type n,
const char& s);
161 String& insert(size_type pos,
const String& s, size_type pos1, size_type n);
162 String& insert(size_type pos,
const char* s);
163 String& insert(size_type pos,
const char* s, size_type n);
164 String& insert(size_type pos, size_type n,
char c);
175 String& erase(size_type pos = 0, size_type n = npos());
180 String& replace(size_type pos, size_type n,
const String& s);
181 String& replace(size_type pos, size_type n,
const String& s, size_type pos1, size_type n1);
182 String& replace(size_type pos, size_type n,
const char* s, size_type n1);
183 String& replace(size_type pos, size_type n,
const char* s);
184 String& replace(size_type pos, size_type n, size_type n1,
char c);
198 size_type find(
const String& s, size_type pos = 0)
const;
199 size_type find(
const char* s, size_type pos, size_type n)
const;
200 size_type find(
const char* s, size_type pos = 0)
const;
201 size_type find(
char c, size_type pos = 0)
const;
202 size_type rfind(
const String& s, size_type pos = npos())
const;
203 size_type rfind(
const char* s, size_type pos, size_type n)
const;
204 size_type rfind(
const char* s, size_type pos = npos())
const;
205 size_type rfind(
char c, size_type pos = npos())
const;
206 size_type find_first_of(
const String& s, size_type pos = 0)
const;
207 size_type find_first_of(
const char* s, size_type pos, size_type n)
const;
208 size_type find_first_of(
const char* s, size_type pos = 0)
const;
209 size_type find_first_of(
char c, size_type pos = 0)
const;
210 size_type find_first_not_of(
const String& s, size_type pos = 0)
const;
211 size_type find_first_not_of(
const char* s, size_type pos, size_type n)
const;
212 size_type find_first_not_of(
const char* s, size_type pos = 0)
const;
213 size_type find_first_not_of(
char c, size_type pos = 0)
const;
214 size_type find_last_of(
const String& s, size_type pos = npos())
const;
215 size_type find_last_of(
const char* s, size_type pos, size_type n)
const;
216 size_type find_last_of(
const char* s, size_type pos = npos())
const;
217 size_type find_last_of(
char c, size_type pos = npos())
const;
218 size_type find_last_not_of(
const String& s, size_type pos = npos())
const;
219 size_type find_last_not_of(
const char* s, size_type pos, size_type n)
const;
220 size_type find_last_not_of(
const char* s, size_type pos = npos())
const;
221 size_type find_last_not_of(
char c, size_type pos = npos())
const;
226 String substr(size_type pos = 0, size_type n = npos())
const;
231 size_type copy(
char* buf, size_type n, size_type pos = 0)
const;
236 int compare(
const String& s)
const;
237 int compare(size_type pos, size_type n,
const String& s)
const;
238 int compare(size_type pos, size_type n,
const String& s, size_type pos1, size_type n1)
const;
239 int compare(
const char* s)
const;
240 int compare(size_type pos, size_type n,
const char* s, size_type len = npos())
const;
253 template<
bool Const,
bool Forward>
256 using Char =
typename std::conditional<Const, const char, char>::type;
261 using iterator_category = std::random_access_iterator_tag;
262 using value_type = char;
263 using difference_type = String::difference_type;
264 using reference = Char&;
265 using pointer = Char*;
273 reference operator* ()
const;
274 pointer operator->()
const;
279 Iterator& operator+=(difference_type offset);
280 Iterator operator+ (difference_type offset)
const;
281 Iterator& operator-=(difference_type offset);
282 Iterator operator- (difference_type offset)
const;
285 reference operator[](difference_type offset)
const;
306 OPALS_API
String operator+(
const char* s1,
const String& s2);
308 OPALS_API
String operator+(
const String& s1,
const char* s2);
315 OPALS_API
bool operator==(
const String& s1,
const String& s2);
317 OPALS_API
bool operator==(
const char* s1,
const String& s2);
319 OPALS_API
bool operator==(
const String& s1,
const char* s2);
322 OPALS_API
bool operator!=(
const String& s1,
const String& s2);
324 OPALS_API
bool operator!=(
const char* s1,
const String& s2);
326 OPALS_API
bool operator!=(
const String& s1,
const char* s2);
329 OPALS_API
bool operator<(
const String& s1,
const String& s2);
331 OPALS_API
bool operator<(
const char* s1,
const String& s2);
333 OPALS_API
bool operator<(
const String& s1,
const char* s2);