1 #ifndef OPALS_STRING_HPP_INCLUDED
2 #define OPALS_STRING_HPP_INCLUDED
4 #include <opals/fwd.hpp>
11 struct random_access_iterator_tag;
42 template<
bool Const,
bool Forward>
50 typedef char value_type;
51 typedef char* pointer;
52 typedef char& reference;
53 typedef char const& const_reference;
54 typedef std::size_t size_type;
55 typedef std::ptrdiff_t difference_type;
57 static const size_type& npos();
62 String(
const String& other, size_type pos = 0, size_type n = npos() );
64 String(
const char* s, size_type n );
65 String( size_type n,
char c );
76 String& operator=(
const char* other );
77 String& operator=(
char c );
79 String& assign(
const String& s, size_type pos, size_type n);
80 String& assign(
const char* s, size_type n);
81 String& assign(
const char* s);
82 String& assign(size_type n,
char c);
112 reference at( size_type n );
113 const_reference at( size_type n )
const;
114 reference operator[]( size_type n );
115 const_reference operator[]( size_type n )
const;
117 const_reference front()
const;
119 const_reference back()
const;
120 const char* c_str()
const;
121 const char* data()
const;
126 size_type size()
const;
127 size_type length()
const;
128 size_type max_size()
const;
129 size_type capacity()
const;
132 void resize(size_type n,
char c =
char());
138 String& append(
const String& s, size_type pos, size_type n );
139 String& append(
const char* s );
140 String& append(
const char* s, size_type n );
141 String& append( size_type n,
char c);
147 void push_back(
char c);
150 String& operator+=(
const char* s);
151 String& operator+=(
char c);
157 void insert(
iterator pos, size_type n,
const char& s );
159 String& insert( size_type pos,
const String& s, size_type pos1, size_type n );
160 String& insert( size_type pos,
const char* s );
161 String& insert( size_type pos,
const char* s, size_type n );
162 String& insert( size_type pos, size_type n,
char c );
173 String& erase( size_type pos = 0, size_type n = npos() );
178 String& replace( size_type pos, size_type n,
const String& s );
179 String& replace( size_type pos, size_type n,
const String& s, size_type pos1, size_type n1 );
180 String& replace( size_type pos, size_type n,
const char* s, size_type n1 );
181 String& replace( size_type pos, size_type n,
const char* s );
182 String& replace( size_type pos, size_type n, size_type n1,
char c );
196 size_type find(
const String& s, size_type pos = 0 )
const;
197 size_type find(
const char* s, size_type pos, size_type n )
const;
198 size_type find(
const char* s, size_type pos = 0 )
const;
199 size_type find(
char c, size_type pos = 0 )
const;
200 size_type rfind(
const String& s, size_type pos = npos() )
const;
201 size_type rfind(
const char* s, size_type pos, size_type n )
const;
202 size_type rfind(
const char* s, size_type pos = npos() )
const;
203 size_type rfind(
char c, size_type pos = npos() )
const;
204 size_type find_first_of(
const String& s, size_type pos = 0 )
const;
205 size_type find_first_of(
const char* s, size_type pos, size_type n )
const;
206 size_type find_first_of(
const char* s, size_type pos = 0 )
const;
207 size_type find_first_of(
char c, size_type pos = 0 )
const;
208 size_type find_first_not_of(
const String& s, size_type pos = 0 )
const;
209 size_type find_first_not_of(
const char* s, size_type pos, size_type n )
const;
210 size_type find_first_not_of(
const char* s, size_type pos = 0 )
const;
211 size_type find_first_not_of(
char c, size_type pos = 0 )
const;
212 size_type find_last_of(
const String& s, size_type pos = npos() )
const;
213 size_type find_last_of(
const char* s, size_type pos, size_type n )
const;
214 size_type find_last_of(
const char* s, size_type pos = npos() )
const;
215 size_type find_last_of(
char c, size_type pos = npos() )
const;
216 size_type find_last_not_of(
const String& s, size_type pos = npos() )
const;
217 size_type find_last_not_of(
const char* s, size_type pos, size_type n )
const;
218 size_type find_last_not_of(
const char* s, size_type pos = npos() )
const;
219 size_type find_last_not_of(
char c, size_type pos = npos() )
const;
224 String substr( size_type pos = 0, size_type n = npos() )
const;
229 size_type copy(
char* buf, size_type n, size_type pos = 0 )
const;
234 int compare(
const String& s )
const;
235 int compare( size_type pos, size_type n,
const String& s )
const;
236 int compare( size_type pos, size_type n,
const String& s, size_type pos1, size_type n1 )
const;
237 int compare(
const char* s )
const;
238 int compare( size_type pos, size_type n,
const char* s, size_type len = npos() )
const;
251 template<
bool Const,
bool Forward>
254 typedef typename std::conditional< Const, const char, char >::type Char;
259 typedef std::random_access_iterator_tag iterator_category;
260 typedef char value_type;
261 typedef String::difference_type difference_type;
262 typedef Char& reference;
263 typedef Char* pointer;
271 reference operator* ()
const;
272 pointer operator->()
const;
277 Iterator& operator+=( difference_type offset );
279 Iterator& operator-=( difference_type offset );
280 Iterator operator- ( difference_type offset )
const;
283 reference operator[]( difference_type offset )
const;
289 bool operator< ( const Iterator<true, Forward>& other )
const;
290 bool operator< ( const Iterator<false,Forward>& other )
const;
293 bool operator<=( const Iterator<true, Forward>& other )
const;
294 bool operator<=( const Iterator<false,Forward>& other )
const;