ReactOS  0.4.13-dev-99-g7e18b6d
_string.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1997-1999
3  * Silicon Graphics Computer Systems, Inc.
4  *
5  * Copyright (c) 1999
6  * Boris Fomitchev
7  *
8  * This material is provided "as is", with absolutely no warranty expressed
9  * or implied. Any use is at your own risk.
10  *
11  * Permission to use or copy this software for any purpose is hereby granted
12  * without fee, provided the above notices are retained on all copies.
13  * Permission to modify the code and to distribute modified code is granted,
14  * provided the above notices are retained, and a notice that the code was
15  * modified is included with the above copyright notice.
16  */
17 
18 #ifndef _STLP_DBG_STRING_H
19 #define _STLP_DBG_STRING_H
20 
21 #ifndef _STLP_DBG_ITERATOR_H
22 # include <stl/debug/_iterator.h>
23 #endif
24 
26 
27 #define _STLP_NON_DBG_STRING_NAME _STLP_NON_DBG_NAME(str)
28 #define _STLP_NON_DBG_STRING _STLP_PRIV _STLP_NON_DBG_STRING_NAME <_CharT, _Traits, _Alloc>
29 
30 #if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS)
31 template <class _CharT,class _Traits, class _Alloc>
32 inline _CharT*
34 { return (_CharT*)0; }
35 template <class _CharT, class _Traits, class _Alloc>
37 iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&)
38 { return random_access_iterator_tag(); }
39 #endif
40 
41 template <class _CharT, class _Traits, class _Alloc>
42 class basic_string :
43 #if !defined (__DMC__)
44  private
45 #else
46  public
47 #endif
48  _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING >
49 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
50  , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
51 #endif
52 {
53 protected:
58 
59 public:
65 
66 public: // Constructor, destructor, assignment.
68 
69 private:
71  _STLP_PRIV __owned_list _M_iter_list;
72 
74  { _M_iter_list._Invalidate_all(); }
75  void _Compare_Capacity (size_type __old_capacity) {
76  if (this->capacity() > __old_capacity) {
78  }
79  }
81  { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); }
83  { _STLP_PRIV __invalidate_range(&_M_iter_list, __f, __l); }
84 
85 public:
86 #include <stl/_string_npos.h>
87 
88  allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); }
89 
90  explicit basic_string(const allocator_type& __a = allocator_type())
92 
94  const allocator_type& __a = allocator_type())
96 
97  basic_string(const _Self& __s)
98  : _ConstructCheck(__s),
100 
102  const allocator_type& __a = allocator_type())
103  : _M_non_dbg_impl(__s._M_non_dbg_impl, __pos, __n, __a),
105 
106  basic_string(const _CharT* __s, size_type __n,
107  const allocator_type& __a = allocator_type())
108  : _ConstructCheck(__s), _M_non_dbg_impl(__s, __n, __a),
110 
111  basic_string(const _CharT* __s,
112  const allocator_type& __a = allocator_type())
113  : _ConstructCheck(__s),
115 
117  const allocator_type& __a = allocator_type())
119 
120 #if !defined (_STLP_NO_MOVE_SEMANTIC)
124 # if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
125  src.get()._M_iter_list._Invalidate_all();
126 # else
127  src.get()._M_iter_list._Set_owner(_M_iter_list);
128 # endif
129  }
130 #endif
131 
132 #if !defined (_STLP_MEMBER_TEMPLATES)
133  basic_string(const _CharT* __f, const _CharT* __l,
134  const allocator_type& __a = allocator_type())
135  : _ConstructCheck(__f, __l),
137  }
139  const allocator_type & __a = allocator_type())
140  : _ConstructCheck(__f, __l),
141  _M_non_dbg_impl(__f._M_iterator, __l._M_iterator, __a), _M_iter_list(&_M_non_dbg_impl) {
142  }
143 #else
144  template <class _InputIterator>
145  basic_string(_InputIterator __f, _InputIterator __l,
147  : _ConstructCheck(__f, __l),
150 # if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
151  template <class _InputIterator>
152  basic_string(_InputIterator __f, _InputIterator __l)
153  : _ConstructCheck(__f, __l),
156 # endif
157 #endif
158 
159 private:
160  // constructor from non-debug version for substr
161  basic_string (const _Base& __x)
163 
164 public:
165  _Self& operator=(const _Self& __s) {
166  if (this != &__s) {
167  assign(__s);
168  }
169  return *this;
170  }
171 
172  _Self& operator=(const _CharT* __s) {
174  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
175  return assign(__s);
176  }
177 
178  _Self& operator=(_CharT __c) {
179  return assign(1, __c);
180  }
181 
182  // Iterators.
187 
189  const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
191  const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
192 
193  // Size, capacity, etc.
194  size_type size() const { return _M_non_dbg_impl.size(); }
195  size_type length() const { return _M_non_dbg_impl.length(); }
196  size_t max_size() const { return _M_non_dbg_impl.max_size(); }
197 
198  void resize(size_type __n, _CharT __c) {
199  if (__n > capacity())
200  _Invalidate_all();
201  else if (__n < size())
203  _M_non_dbg_impl.resize(__n, __c);
204  }
206  size_type capacity() const { return _M_non_dbg_impl.capacity(); }
207 
208  void reserve(size_type __s = 0) {
209  if (__s > capacity()) _Invalidate_all();
210  _M_non_dbg_impl.reserve(__s);
211  }
212 
213  void clear() {
214  _Invalidate_all();
215  _M_non_dbg_impl.clear();
216  }
217 
218  bool empty() const { return _M_non_dbg_impl.empty(); }
219 
221  _STLP_VERBOSE_ASSERT(__n <= this->size(), _StlMsg_OUT_OF_BOUNDS);
222  return _M_non_dbg_impl[__n];
223  }
224 
226  _STLP_VERBOSE_ASSERT(__n < this->size(), _StlMsg_OUT_OF_BOUNDS)
227  return _M_non_dbg_impl[__n];
228  }
229 
232 
233  // Append, operator+=, push_back.
234  _Self& operator+=(const _Self& __s) { return append(__s); }
235  _Self& operator+=(const _CharT* __s) {
237  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
238  return append(__s);
239  }
240  _Self& operator+=(_CharT __c) { return append(1, __c); }
241 
242 #if defined (_STLP_MEMBER_TEMPLATES)
243  template <class _InputIter>
244  _Self& append(_InputIter __first, _InputIter __last) {
245  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
246  size_type __old_capacity = capacity();
248  _Compare_Capacity(__old_capacity);
249  return *this;
250  }
251 #endif
252 
253 #if !defined (_STLP_MEMBER_TEMPLATES) || \
254  !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
255  _Self& append(const _CharT* __f, const _CharT* __l) {
257  _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
258  size_type __old_capacity = capacity();
259  _M_non_dbg_impl.append(__f, __l);
260  _Compare_Capacity(__old_capacity);
261  return *this;
262  }
263 
265  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
266  size_type __old_capacity = capacity();
267  _M_non_dbg_impl.append(__f._M_iterator, __l._M_iterator);
268  _Compare_Capacity(__old_capacity);
269  return *this;
270  }
271 #endif
272 
273  _Self& append(const _Self& __s) {
274  size_type __old_capacity = capacity();
275  _M_non_dbg_impl.append(__s._M_non_dbg_impl);
276  _Compare_Capacity(__old_capacity);
277  return *this;
278  }
279 
280  _Self& append(const _Self& __s, size_type __pos, size_type __n) {
281  size_type __old_capacity = capacity();
282  _M_non_dbg_impl.append(__s._M_non_dbg_impl, __pos, __n);
283  _Compare_Capacity(__old_capacity);
284  return *this;
285  }
286 
287  _Self& append(const _CharT* __s, size_type __n) {
289  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
290  size_type __old_capacity = capacity();
291  _M_non_dbg_impl.append(__s, __n);
292  _Compare_Capacity(__old_capacity);
293  return *this;
294  }
295 
296  _Self& append(const _CharT* __s) {
298  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
299  size_type __old_capacity = capacity();
300  _M_non_dbg_impl.append(__s);
301  _Compare_Capacity(__old_capacity);
302  return *this;
303  }
304 
306  size_type __old_capacity = this->capacity();
307  _M_non_dbg_impl.append(__n, __c);
308  _Compare_Capacity(__old_capacity);
309  return *this;
310  }
311 
312  void push_back(_CharT __c) {
313  size_type __old_capacity = this->capacity();
314  _M_non_dbg_impl.push_back(__c);
315  _Compare_Capacity(__old_capacity);
316  }
317 
318  void pop_back() {
319  _Invalidate_iterator(this->end());
320  _M_non_dbg_impl.pop_back();
321  }
322 
323  // Assign
324  _Self& assign(const _Self& __s) {
325  _Invalidate_all();
326  _M_non_dbg_impl.assign(__s._M_non_dbg_impl);
327  return *this;
328  }
329 
330  _Self& assign(const _Self& __s, size_type __pos, size_type __n) {
331  if (__pos < __s.size()) {
332  _Invalidate_all();
333  }
334  _M_non_dbg_impl.assign(__s._M_non_dbg_impl, __pos, __n);
335  return *this;
336  }
337 
338  _Self& assign(const _CharT* __s, size_type __n) {
340  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
341  _Invalidate_all();
342  _M_non_dbg_impl.assign(__s, __s + __n);
343  return *this;
344  }
345 
346  _Self& assign(const _CharT* __s) {
348  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
349  _Invalidate_all();
350  _M_non_dbg_impl.assign(__s);
351  return *this;
352  }
353 
355  _Invalidate_all();
356  _M_non_dbg_impl.assign(__n, __c);
357  return *this;
358  }
359 
360 #if defined(_STLP_MEMBER_TEMPLATES)
361  template <class _InputIter>
362  inline _Self& assign(_InputIter __first, _InputIter __last) {
364  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
365  _Invalidate_all();
367  return *this;
368  }
369 #endif
370 
371 #if !defined (_STLP_MEMBER_TEMPLATES) || \
372  !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
373  _Self& assign(const _CharT* __f, const _CharT* __l) {
375  _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
376  _Invalidate_all();
377  _M_non_dbg_impl.assign(__f, __l);
378  return *this;
379  }
381  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
382  _Invalidate_all();
383  _M_non_dbg_impl.assign(__f._M_iterator, __l._M_iterator);
384  return *this;
385  }
386 #endif
387 
388  // Insert
389  _Self& insert(size_type __pos, const _Self& __s) {
390  size_type __old_capacity = capacity();
391  _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl);
392  _Compare_Capacity(__old_capacity);
393  return *this;
394  }
395 
396  _Self& insert(size_type __pos, const _Self& __s,
397  size_type __beg, size_type __n) {
398  size_type __old_capacity = capacity();
399  _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl, __beg, __n);
400  _Compare_Capacity(__old_capacity);
401  return *this;
402  }
403 
404  _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
406  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
407  size_type __old_capacity = capacity();
408  _M_non_dbg_impl.insert(__pos, __s, __n);
409  _Compare_Capacity(__old_capacity);
410  return *this;
411  }
412 
413  _Self& insert(size_type __pos, const _CharT* __s) {
415  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
416  return insert(__pos, __s, _Traits::length(__s));
417  }
418 
419  _Self& insert(size_type __pos, size_type __n, _CharT __c) {
420  size_type __old_capacity = capacity();
421  _M_non_dbg_impl.insert(__pos, __n, __c);
422  _Compare_Capacity(__old_capacity);
423  return *this;
424  }
425 
426  iterator insert(iterator __p, _CharT __c) {
427  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
428  size_type __old_capacity = capacity();
429  typename _Base::iterator __ret = _M_non_dbg_impl.insert(__p._M_iterator, __c);
430  _Compare_Capacity(__old_capacity);
431  return iterator(&_M_iter_list, __ret);
432  }
433 
434  void insert(iterator __p, size_t __n, _CharT __c) {
435  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
436  size_type __old_capacity = capacity();
437  _M_non_dbg_impl.insert(__p._M_iterator, __n, __c);
438  _Compare_Capacity(__old_capacity);
439  }
440 
441 #if defined (_STLP_MEMBER_TEMPLATES)
442  template <class _InputIter>
443  void insert(iterator __p, _InputIter __first, _InputIter __last) {
444  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
446 
447  size_type __old_capacity = this->capacity();
448  _M_non_dbg_impl.insert(__p._M_iterator,
450  _Compare_Capacity(__old_capacity);
451  }
452 #endif
453 
454 #if !defined (_STLP_MEMBER_TEMPLATES)
455  void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
457  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
458  _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f,__l))
459  size_type __old_capacity = capacity();
460  _M_non_dbg_impl.insert(__p._M_iterator, __f, __l);
461  _Compare_Capacity(__old_capacity);
462  }
463 #endif
464 
465 #if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
466  // Those overloads are necessary to check self referencing correctly in non debug
467  // basic_string implementation
469  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
470  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l))
471 # if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
472  _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __f))
473 # endif
474  size_type __old_capacity = capacity();
475  _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator);
476  _Compare_Capacity(__old_capacity);
477  }
479  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p))
480  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l))
481 # if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL)
482  _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __f))
483 # endif
484  size_type __old_capacity = capacity();
485  _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator);
486  _Compare_Capacity(__old_capacity);
487  }
488 #endif
489 
490  // Erase.
492  if (__pos < size()) {
493  _Invalidate_iterators(begin() + __pos, end());
494  }
495  _M_non_dbg_impl.erase(__pos, __n);
496  return *this;
497  }
500  _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos))
501  _Invalidate_iterators(__pos, end());
502  return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator));
503  }
505  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
507  return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__f._M_iterator, __l._M_iterator));
508  }
509 
510  // Substring.
511  _Self substr(size_type __pos = 0, size_type __n = npos) const
512  { return _M_non_dbg_impl.substr(__pos, __n); }
513 
514  // Replace. (Conceptually equivalent to erase followed by insert.)
515  _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
516  size_type __old_capacity = capacity();
517  _M_non_dbg_impl.replace(__pos, __n, __s._M_non_dbg_impl);
518  _Compare_Capacity(__old_capacity);
519  return *this;
520  }
521 
522  _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
523  size_type __pos2, size_type __n2) {
524  size_type __old_capacity = capacity();
525  _M_non_dbg_impl.replace(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2);
526  _Compare_Capacity(__old_capacity);
527  return *this;
528  }
529 
530  _Self& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) {
532  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
533  size_type __old_capacity = capacity();
534  _M_non_dbg_impl.replace(__pos, __n1, __s, __n2);
535  _Compare_Capacity(__old_capacity);
536  return *this;
537  }
538 
539  _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
541  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
542  size_type __old_capacity = capacity();
543  _M_non_dbg_impl.replace(__pos, __n1, __s);
544  _Compare_Capacity(__old_capacity);
545  return *this;
546  }
547 
548  _Self& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) {
549  size_type __old_capacity = capacity();
550  _M_non_dbg_impl.replace(__pos, __n1, __n2, __c);
551  _Compare_Capacity(__old_capacity);
552  return *this;
553  }
554 
556  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
557  size_type __old_capacity = capacity();
558  _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s._M_non_dbg_impl);
559  _Compare_Capacity(__old_capacity);
560  return *this;
561  }
562 
563  _Self& replace(iterator __f, iterator __l, const _CharT* __s, size_type __n) {
565  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
566  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
567  size_type __old_capacity = capacity();
568  _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s, __n);
569  _Compare_Capacity(__old_capacity);
570  return *this;
571  }
572 
573  _Self& replace(iterator __f, iterator __l, const _CharT* __s) {
575  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
576  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
577  size_type __old_capacity = capacity();
578  _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s);
579  _Compare_Capacity(__old_capacity);
580  return *this;
581  }
582 
584  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end()))
585  size_type __old_capacity = capacity();
586  _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __n, __c);
587  _Compare_Capacity(__old_capacity);
588  return *this;
589  }
590 
591 #if defined (_STLP_MEMBER_TEMPLATES)
592  template <class _InputIter>
594  _InputIter __f, _InputIter __l) {
595  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
596  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
597 
598  size_type __old_capacity = capacity();
599  _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
601  _Compare_Capacity(__old_capacity);
602  return *this;
603  }
604 #endif
605 
606 #if !defined (_STLP_MEMBER_TEMPLATES)
608  const _CharT* __f, const _CharT* __l) {
610  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
611  _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l))
612  size_type __old_capacity = capacity();
613  _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f, __l);
614  _Compare_Capacity(__old_capacity);
615  return *this;
616  }
617 #endif
618 
619 #if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION)
622  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
623  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
624  size_type __old_capacity = capacity();
625  _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
626  __f._M_iterator, __l._M_iterator);
627  _Compare_Capacity(__old_capacity);
628  return *this;
629  }
632  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end()))
633  _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l))
634  size_type __old_capacity = capacity();
635  _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator,
636  __f._M_iterator, __l._M_iterator);
637  _Compare_Capacity(__old_capacity);
638  return *this;
639  }
640 #endif
641 
642  // Other modifier member functions.
643  void swap(_Self& __s) {
644  _M_iter_list._Swap_owners(__s._M_iter_list);
646  }
647 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
648  void _M_swap_workaround(_Self& __x) { swap(__x); }
649 #endif
650 
651  int compare(const _Self& __s) const
652  { return _M_non_dbg_impl.compare(__s._M_non_dbg_impl); }
653  int compare(size_type __pos, size_type __n, const _Self& __s) const
654  { return _M_non_dbg_impl.compare(__pos, __n, __s._M_non_dbg_impl); }
655  int compare(size_type __pos1, size_type __n1, const _Self& __s,
656  size_type __pos2, size_type __n2) const
657  { return _M_non_dbg_impl.compare(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); }
658  int compare(const _CharT* __s) const {
660  return _M_non_dbg_impl.compare(__s);
661  }
662  int compare(size_type __pos, size_type __n, const _CharT* __s) const {
664  return _M_non_dbg_impl.compare(__pos, __n, __s);
665  }
666  int compare(size_type __pos1, size_type __n1, const _CharT* __s,
667  size_type __n2) const {
669  return _M_non_dbg_impl.compare(__pos1, __n1, __s, __n2);
670  }
671 
672  // Helper functions for compare.
673  static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
674  const _CharT* __f2, const _CharT* __l2)
675  { return _Base::_M_compare(__f1, __l1, __f2, __l2); }
677  const _CharT* __f2, const _CharT* __l2)
678  { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2, __l2); }
679  static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,
680  const_iterator __f2, const_iterator __l2)
681  { return _Base::_M_compare(__f1, __l1, __f2._M_iterator, __l2._M_iterator); }
683  const_iterator __f2, const_iterator __l2)
684  { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2._M_iterator, __l2._M_iterator); }
685 
686  const _CharT* c_str() const { return _M_non_dbg_impl.c_str(); }
687  const _CharT* data() const { return _M_non_dbg_impl.data(); }
688 
689  size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
690  { return _M_non_dbg_impl.copy(__s, __n, __pos); }
691 
692  // find.
693  size_type find(const _Self& __s, size_type __pos = 0) const
694  { return _M_non_dbg_impl.find(__s._M_non_dbg_impl, __pos); }
695  size_type find(const _CharT* __s, size_type __pos = 0) const {
697  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
698  return _M_non_dbg_impl.find(__s, __pos);
699  }
700  size_type find(const _CharT* __s, size_type __pos, size_type __n) const {
702  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
703  return _M_non_dbg_impl.find(__s, __pos, __n);
704  }
705  // WIE: Versant schema compiler 5.2.2 ICE workaround
706  size_type find(_CharT __c) const { return find(__c, 0); }
707  size_type find(_CharT __c, size_type __pos /* = 0 */) const
708  { return _M_non_dbg_impl.find(__c, __pos); }
709 
710  // rfind.
711  size_type rfind(const _Self& __s, size_type __pos = npos) const
712  { return _M_non_dbg_impl.rfind(__s._M_non_dbg_impl, __pos); }
713  size_type rfind(const _CharT* __s, size_type __pos = npos) const {
715  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
716  return _M_non_dbg_impl.rfind(__s, __pos);
717  }
718  size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const {
720  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
721  return _M_non_dbg_impl.rfind(__s, __pos, __n);
722  }
723  size_type rfind(_CharT __c, size_type __pos = npos) const
724  { return _M_non_dbg_impl.rfind(__c, __pos); }
725 
726  // find_first_of
727  size_type find_first_of(const _Self& __s, size_type __pos = 0) const
728  { return _M_non_dbg_impl.find_first_of(__s._M_non_dbg_impl, __pos); }
729  size_type find_first_of(const _CharT* __s, size_type __pos = 0) const {
731  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
732  return _M_non_dbg_impl.find_first_of(__s, __pos);
733  }
734  size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const {
736  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
737  return _M_non_dbg_impl.find_first_of(__s, __pos, __n);
738  }
739  size_type find_first_of(_CharT __c, size_type __pos = 0) const
740  { return _M_non_dbg_impl.find_first_of(__c, __pos); }
741 
742  // find_last_of
743  size_type find_last_of(const _Self& __s, size_type __pos = npos) const
744  { return _M_non_dbg_impl.find_last_of(__s._M_non_dbg_impl, __pos); }
745  size_type find_last_of(const _CharT* __s, size_type __pos = npos) const {
747  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
748  return _M_non_dbg_impl.find_last_of(__s, __pos);
749  }
750  size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const {
752  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
753  return _M_non_dbg_impl.find_last_of(__s, __pos, __n);
754  }
755  size_type find_last_of(_CharT __c, size_type __pos = npos) const
756  { return _M_non_dbg_impl.rfind(__c, __pos); }
757 
758  // find_first_not_of
759  size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const
760  { return _M_non_dbg_impl.find_first_not_of(__s._M_non_dbg_impl, __pos); }
761  size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const {
763  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
764  return _M_non_dbg_impl.find_first_not_of(__s, __pos);
765  }
766  size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
768  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
769  return _M_non_dbg_impl.find_first_not_of(__s, __pos, __n);
770  }
771  size_type find_first_not_of(_CharT __c, size_type __pos = 0) const
772  { return _M_non_dbg_impl.find_first_not_of(__c, __pos); }
773 
774  // find_last_not_of
775  size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const
776  { return _M_non_dbg_impl.find_last_not_of(__s._M_non_dbg_impl, __pos); }
777  size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const {
779  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
780  return _M_non_dbg_impl.find_last_not_of(__s, __pos);
781  }
782  size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const {
784  _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT)
785  return _M_non_dbg_impl.find_last_not_of(__s, __pos, __n);
786  }
787  size_type find_last_not_of(_CharT __c, size_type __pos = npos) const
788  { return _M_non_dbg_impl.find_last_not_of(__c, __pos); }
789 
790 #if defined (_STLP_USE_TEMPLATE_EXPRESSION)
792 #endif
793 };
794 
795 // This is a hook to instantiate STLport exports in a designated DLL
796 #if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
801 # if defined (_STLP_HAS_WCHAR_T)
806 # endif
807 #endif
808 
809 #undef _STLP_NON_DBG_STRING
810 #undef _STLP_NON_DBG_STRING_NAME
811 
812 #if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96)
813 template <class _CharT, class _Traits, class _Alloc>
815 #endif
816 
817 #if defined (basic_string)
819 #undef basic_string
820 #endif
821 
823 
824 #endif /* _STLP_DBG_STRING */
825 
826 // Local Variables:
827 // mode:C++
828 // End:
size_type rfind(_CharT __c, size_type __pos=npos) const
Definition: _string.h:723
basic_string(size_type __n, _CharT __c, const allocator_type &__a=allocator_type())
Definition: _string.h:116
_Self & replace(iterator __first, iterator __last, const_iterator __f, const_iterator __l)
Definition: _string.h:620
return
Definition: dirsup.c:529
basic_string(const _CharT *__s, const allocator_type &__a=allocator_type())
Definition: _string.h:111
_Self & assign(const _Self &__s, size_type __pos, size_type __n)
Definition: _string.h:330
size_type find_first_not_of(const _CharT *__s, size_type __pos, size_type __n) const
Definition: _string.h:766
const_reverse_iterator rbegin() const
Definition: _string.h:189
void _Compare_Capacity(size_type __old_capacity)
Definition: _string.h:75
return __n
Definition: _algo.h:75
_Self & append(const _CharT *__f, const _CharT *__l)
Definition: _string.h:255
void reserve(size_type __s=0)
Definition: _string.h:208
size_type capacity() const
Definition: _string.h:418
_STLP_NON_DBG_STRING _Base
Definition: _string.h:54
char typename[32]
Definition: main.c:84
#define random_access_iterator_tag
Definition: _abbrevs.h:28
size_type find(const _CharT *__s, size_type __pos=0) const
Definition: _string.h:695
_Self & replace(iterator __f, iterator __l, size_type __n, _CharT __c)
Definition: _string.h:583
size_type find_last_of(const _CharT *__s, size_type __pos=npos) const
Definition: _string.h:745
_Self & append(const _Self &__s, size_type __pos, size_type __n)
Definition: _string.h:280
_Self & assign(size_type __n, _CharT __c)
Definition: _string.h:354
size_type find_first_not_of(_CharT __c, size_type __pos=0) const
Definition: _string.h:771
size_type find_first_of(const _CharT *__s, size_type __pos=0) const
Definition: _string.h:729
size_type find(const _Self &__s, size_type __pos=0) const
Definition: _string.h:693
_Self & append(const_iterator __f, const_iterator __l)
Definition: _string.h:264
void clear()
Definition: _string.h:213
#define reverse_iterator
Definition: _abbrevs.h:34
_Self & replace(iterator __f, iterator __l, const _CharT *__s, size_type __n)
Definition: _string.h:563
static const size_t npos
Definition: _string_npos.h:26
size_type find(_CharT __c) const
Definition: _string.h:706
_Self & append(const _Self &__s)
Definition: _string.h:273
_Self & assign(const_iterator __f, const_iterator __l)
Definition: _string.h:380
bool _Dereferenceable(const _Iterator &__it)
Definition: _iterator.h:93
static int _STLP_CALL _M_compare(const _CharT *__f1, const _CharT *__l1, const _CharT *__f2, const _CharT *__l2)
Definition: _string.h:673
_Self & insert(size_type __pos, const _CharT *__s, size_type __n)
Definition: _string.h:404
iterator begin()
Definition: _string.h:183
_STLP_PRIV __owned_list _M_iter_list
Definition: _string.h:71
const _CharT * data() const
Definition: _string.h:687
_Self & append(size_type __n, _CharT __c)
Definition: _string.h:305
size_t max_size() const
Definition: _string.h:196
size_type rfind(const _CharT *__s, size_type __pos, size_type __n) const
Definition: _string.h:718
int compare(size_type __pos1, size_type __n1, const _Self &__s, size_type __pos2, size_type __n2) const
Definition: _string.h:655
_Self & assign(const _CharT *__f, const _CharT *__l)
Definition: _string.h:373
_Base _M_non_dbg_impl
Definition: _string.h:70
_Self & operator=(const _Self &__s)
Definition: _string.h:165
basic_string(const _Self &__s, size_type __pos, size_type __n=npos, const allocator_type &__a=allocator_type())
Definition: _string.h:101
allocator_type get_allocator() const
Definition: _string.h:88
_Self & append(const _CharT *__s)
Definition: _string.h:296
#define __c
Definition: schilyio.h:209
size_type rfind(const _CharT *__s, size_type __pos=npos) const
Definition: _string.h:713
#define _STLP_MOVE_TO_PRIV_NAMESPACE
Definition: features.h:524
_Self & assign(const _CharT *__s, size_type __n)
Definition: _string.h:338
static int _STLP_CALL _M_compare(const _CharT *__f1, const _CharT *__l1, const_iterator __f2, const_iterator __l2)
Definition: _string.h:679
size_type find_last_of(_CharT __c, size_type __pos=npos) const
Definition: _string.h:755
basic_string(__move_source< _Self > src)
Definition: _string.h:121
_Self & replace(size_type __pos, size_type __n, const _Self &__s)
Definition: _string.h:515
static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1, const _CharT *__f2, const _CharT *__l2)
Definition: _string.h:676
basic_string(_Reserve_t __r, size_t __n, const allocator_type &__a=allocator_type())
Definition: _string.h:93
void _Invalidate_all()
Definition: _string.h:73
iterator erase(iterator __pos)
Definition: _string.h:498
_Self & append(const _CharT *__s, size_type __n)
Definition: _string.h:287
reference operator[](size_type __n)
Definition: _string.h:225
size_type size() const
Definition: _string.h:194
void resize(size_type __n, _CharT __c)
Definition: _string.h:198
_Self & insert(size_type __pos, const _CharT *__s)
Definition: _string.h:413
#define _STLP_DEFAULT_CONSTRUCTED(_TTp)
Definition: _construct.h:265
iterator end()
Definition: _string.h:185
basic_string(const _CharT *__s, size_type __n, const allocator_type &__a=allocator_type())
Definition: _string.h:106
_STLP_PRIVATE iterator const _CharT * __f
Definition: _string.h:889
iterator erase(iterator __f, iterator __l)
Definition: _string.h:504
const _CharT * c_str() const
Definition: _string.h:686
_Self & replace(size_type __pos, size_type __n1, const _CharT *__s, size_type __n2)
Definition: _string.h:530
void _Invalidate_iterator(const iterator &__it)
Definition: _string.h:80
void insert(iterator __p, iterator __f, iterator __l)
Definition: _string.h:478
#define __IMPORT_CONTAINER_TYPEDEFS(_Super)
Definition: features.h:750
const_iterator end() const
Definition: _string.h:186
_Iterator _Non_Dbg_iter(_Iterator __it)
Definition: _iterator.h:362
const_iterator begin() const
Definition: _string.h:184
bool empty() const
Definition: _string.h:218
_STLP_PRIV __construct_checker< _STLP_NON_DBG_STRING > _ConstructCheck
Definition: _string.h:56
_STLP_PRIVATE const _CharT * __first
Definition: _string.h:671
size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const
Definition: _string.h:761
_Self & insert(size_type __pos, size_type __n, _CharT __c)
Definition: _string.h:419
__kernel_size_t size_t
Definition: linux.h:237
#define _STLP_MOVE_TO_STD_NAMESPACE
Definition: features.h:525
void get(int argc, const char *argv[])
Definition: cmds.c:480
basic_string(const allocator_type &__a=allocator_type())
Definition: _string.h:90
size_type find_first_of(const _CharT *__s, size_type __pos, size_type __n) const
Definition: _string.h:734
_Self & replace(iterator __f, iterator __l, const _Self &__s)
Definition: _string.h:555
int compare(size_type __pos, size_type __n, const _Self &__s) const
Definition: _string.h:653
_Self & replace(size_type __pos1, size_type __n1, const _Self &__s, size_type __pos2, size_type __n2)
Definition: _string.h:522
_Self & operator+=(_CharT __c)
Definition: _string.h:240
_STLP_PRIVATE const _CharT const _CharT * __last
Definition: _string.h:671
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
void pop_back()
Definition: _string.h:318
void swap(_Self &__s)
Definition: _string.h:643
#define _STLP_ALLOCATOR_TYPE_DFL
Definition: features.h:691
_Self & replace(iterator __first, iterator __last, const _CharT *__f, const _CharT *__l)
Definition: _string.h:607
reverse_iterator rend()
Definition: _string.h:190
#define _STLP_NON_DBG_STRING
Definition: _string.h:28
void insert(iterator __p, const _CharT *__f, const _CharT *__l)
Definition: _string.h:455
_Self & assign(const _Self &__s)
Definition: _string.h:548
#define _STLP_EXPORT_TEMPLATE_CLASS
Definition: features.h:987
_Self & operator=(_CharT __c)
Definition: _string.h:178
_Self & append(const _CharT *__first, const _CharT *__last)
Definition: _string.h:509
size_type find_first_not_of(const _Self &__s, size_type __pos=0) const
Definition: _string.h:759
_Self & replace(iterator __first, iterator __last, iterator __f, iterator __l)
Definition: _string.h:630
_IsPOD< _CharT >::_Type _Char_Is_POD
Definition: _string.h:57
_STLP_MOVE_TO_PRIV_NAMESPACE const _InputIterator const input_iterator_tag &_InputIterator __it(__first)
int compare(size_type __pos, size_type __n, const _CharT *__s) const
Definition: _string.h:662
size_type find_last_not_of(const _Self &__s, size_type __pos=npos) const
Definition: _string.h:775
void push_back(_CharT __c)
Definition: _string.h:312
_Self & assign(const _CharT *__s)
Definition: _string.h:346
reverse_iterator rbegin()
Definition: _string.h:188
_Self substr(size_type __pos=0, size_type __n=npos) const
Definition: _string.h:511
size_type find_last_not_of(const _CharT *__s, size_type __pos, size_type __n) const
Definition: _string.h:782
size_type rfind(const _Self &__s, size_type __pos=npos) const
Definition: _string.h:711
size_type find(_CharT __c, size_type __pos) const
Definition: _string.h:707
size_type find_last_of(const _CharT *__s, size_type __pos, size_type __n) const
Definition: _string.h:750
#define _STLP_PRIV
Definition: _dm.h:70
static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1, const_iterator __f2, const_iterator __l2)
Definition: _string.h:682
int compare(const _Self &__s) const
Definition: _string.h:651
#define _STLP_DEBUG_CHECK(expr)
Definition: _debug.h:440
GLenum src
Definition: glext.h:6340
basic_string< _CharT, _Traits, _Alloc > _Self
Definition: _string.h:55
_Self & operator=(const _CharT *__s)
Definition: _string.h:172
_Self & replace(iterator __f, iterator __l, const _CharT *__s)
Definition: _string.h:573
size_type find_first_of(const _Self &__s, size_type __pos=0) const
Definition: _string.h:727
_Self & operator+=(const _CharT *__s)
Definition: _string.h:235
size_type find(const _CharT *__s, size_type __pos, size_type __n) const
Definition: _string.h:700
int compare(size_type __pos1, size_type __n1, const _CharT *__s, size_type __n2) const
Definition: _string.h:666
basic_string(const_iterator __f, const_iterator __l, const allocator_type &__a=allocator_type())
Definition: _string.h:138
_Self & insert(size_type __pos, const _Self &__s, size_type __beg, size_type __n)
Definition: _string.h:396
const_reverse_iterator rend() const
Definition: _string.h:191
const_reference operator[](size_type __n) const
Definition: _string.h:220
#define _STLP_END_NAMESPACE
Definition: features.h:503
size_type find_last_not_of(_CharT __c, size_type __pos=npos) const
Definition: _string.h:787
basic_string(const _Self &__s)
Definition: _string.h:97
reference at(size_type __n)
Definition: _string.h:231
iterator insert(iterator __p, _CharT __c)
Definition: _string.h:426
#define _STLP_FIX_LITERAL_BUG(__x)
Definition: features.h:301
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Definition: _string.h:689
basic_string(const _CharT *__f, const _CharT *__l, const allocator_type &__a=allocator_type())
Definition: _string.h:133
const_reference at(size_type __n) const
Definition: _string.h:230
basic_string(const _Base &__x)
Definition: _string.h:161
_Self & operator+=(const _Self &__s)
Definition: _string.h:234
void insert(iterator __p, size_t __n, _CharT __c)
Definition: _string.h:434
void insert(iterator __p, const_iterator __f, const_iterator __l)
Definition: _string.h:468
int compare(const _CharT *__s) const
Definition: _string.h:658
void _Invalidate_iterators(const iterator &__f, const iterator &__l)
Definition: _string.h:82
_STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS
Definition: _string.h:145
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
value_type * iterator
Definition: _string.h:143
size_type find_last_of(const _Self &__s, size_type __pos=npos) const
Definition: _string.h:743
_Self & insert(size_type __pos, const _Self &__s)
Definition: _string.h:389
size_type find_last_not_of(const _CharT *__s, size_type __pos=npos) const
Definition: _string.h:777
size_type find_first_of(_CharT __c, size_type __pos=0) const
Definition: _string.h:739
#define _STLP_CALL
Definition: _bc.h:131
_Self & replace(size_type __pos, size_type __n1, const _CharT *__s)
Definition: _string.h:539
_Self & erase(size_type __pos=0, size_type __n=npos)
Definition: _string.h:491
size_type length() const
Definition: _string.h:195
_Self & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
Definition: _string.h:548
#define _STLP_VERBOSE_ASSERT(expr, diagnostic)
Definition: _debug.h:439
_STLP_PRIVATE iterator const _CharT const _CharT * __l
Definition: _string.h:889
void resize(size_type __n)
Definition: _string.h:205