ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

_string_workaround.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004
00003  * Francois Dumont
00004  *
00005  * This material is provided "as is", with absolutely no warranty expressed
00006  * or implied. Any use is at your own risk.
00007  *
00008  * Permission to use or copy this software for any purpose is hereby granted
00009  * without fee, provided the above notices are retained on all copies.
00010  * Permission to modify the code and to distribute modified code is granted,
00011  * provided the above notices are retained, and a notice that the code was
00012  * modified is included with the above copyright notice.
00013  *
00014  */
00015 
00016 //Included from _string.h, no need for macro guarding.
00017 
00018 _STLP_BEGIN_NAMESPACE
00019 
00020 #if defined (_STLP_DEBUG)
00021 #  define basic_string _STLP_NON_DBG_NAME(str)
00022 _STLP_MOVE_TO_PRIV_NAMESPACE
00023 #endif
00024 
00025 #define _STLP_NO_MEM_T_STRING_BASE _STLP_PRIV _STLP_NO_MEM_T_NAME(str)<_CharT, _Traits, _Alloc>
00026 
00027 template <class _CharT, class _Traits, class _Alloc>
00028 class basic_string : public _STLP_NO_MEM_T_STRING_BASE
00029 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string)
00030                    , public __stlport_class<basic_string<_CharT, _Traits, _Alloc> >
00031 #endif
00032 {
00033 private:                        // Protected members inherited from base.
00034   typedef basic_string<_CharT, _Traits, _Alloc> _Self;
00035   typedef _STLP_NO_MEM_T_STRING_BASE _Base;
00036   typedef typename _Base::_CalledFromWorkaround_t _CalledFromWorkaround_t;
00037 public:
00038 
00039   __IMPORT_WITH_REVERSE_ITERATORS(_Base)
00040 
00041   typedef typename _Base::_Iterator_category _Iterator_category;
00042   typedef typename _Base::traits_type traits_type;
00043   typedef typename _Base::_Reserve_t _Reserve_t;
00044 
00045 #include <stl/_string_npos.h>
00046 
00047 public:                         // Constructor, destructor, assignment.
00048   explicit basic_string(const allocator_type& __a = allocator_type())
00049     : _STLP_NO_MEM_T_STRING_BASE(__a) {}
00050 
00051   basic_string(_Reserve_t __r, size_t __n,
00052                const allocator_type& __a = allocator_type())
00053     : _STLP_NO_MEM_T_STRING_BASE(__r, __n, __a) {}
00054 
00055   basic_string(const _Self& __s)
00056     : _STLP_NO_MEM_T_STRING_BASE(__s) {}
00057 
00058   basic_string(const _Self& __s, size_type __pos, size_type __n = npos,
00059                const allocator_type& __a = allocator_type())
00060     : _STLP_NO_MEM_T_STRING_BASE(__s, __pos, __n, __a) {}
00061 
00062   basic_string(const _CharT* __s, size_type __n,
00063                const allocator_type& __a = allocator_type())
00064     : _STLP_NO_MEM_T_STRING_BASE(__s, __n, __a) {}
00065 
00066   basic_string(const _CharT* __s,
00067                const allocator_type& __a = allocator_type())
00068     : _STLP_NO_MEM_T_STRING_BASE(__s, __a) {}
00069 
00070   basic_string(size_type __n, _CharT __c,
00071                const allocator_type& __a = allocator_type())
00072     : _STLP_NO_MEM_T_STRING_BASE(__n, __c, __a) {}
00073 
00074 #if !defined (_STLP_NO_MOVE_SEMANTIC)
00075   basic_string(__move_source<_Self> src)
00076     : _STLP_NO_MEM_T_STRING_BASE(__move_source<_Base>(src.get())) {}
00077 #endif
00078 
00079   // Check to see if _InputIterator is an integer type.  If so, then
00080   // it can't be an iterator.
00081   template <class _InputIterator>
00082   basic_string(_InputIterator __f, _InputIterator __l,
00083                const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL)
00084     : _STLP_NO_MEM_T_STRING_BASE(_CalledFromWorkaround_t(), __a) {
00085     typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
00086     _M_initialize_dispatch(__f, __l, _Integral());
00087   }
00088 #  if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
00089   template <class _InputIterator>
00090   basic_string(_InputIterator __f, _InputIterator __l)
00091     : _STLP_NO_MEM_T_STRING_BASE(_CalledFromWorkaround_t(), allocator_type()) {
00092     typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
00093     _M_initialize_dispatch(__f, __l, _Integral());
00094   }
00095 #  endif
00096 
00097   _Self& operator=(const _Self& __s) {
00098     _Base::operator=(__s);
00099     return *this;
00100   }
00101 
00102   _Self& operator=(const _CharT* __s) {
00103     _Base::operator=(__s);
00104     return *this;
00105   }
00106 
00107   _Self& operator=(_CharT __c) {
00108     _Base::operator=(__c);
00109     return *this;
00110   }
00111 
00112 private:
00113   template <class _InputIter>
00114   void _M_range_initialize(_InputIter __f, _InputIter __l,
00115                            const input_iterator_tag &__tag) {
00116     this->_M_allocate_block();
00117     this->_M_construct_null(this->_M_Finish());
00118     _M_appendT(__f, __l, __tag);
00119   }
00120 
00121   template <class _ForwardIter>
00122   void _M_range_initialize(_ForwardIter __f, _ForwardIter __l,
00123                            const forward_iterator_tag &) {
00124     difference_type __n = _STLP_STD::distance(__f, __l);
00125     this->_M_allocate_block(__n + 1);
00126     this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start());
00127     this->_M_terminate_string();
00128   }
00129 
00130   template <class _InputIter>
00131   void _M_range_initializeT(_InputIter __f, _InputIter __l) {
00132     _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
00133   }
00134 
00135   template <class _Integer>
00136   void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) {
00137     this->_M_allocate_block(__n + 1);
00138     this->_M_finish = uninitialized_fill_n(this->_M_Start(), __n, __x);
00139     this->_M_terminate_string();
00140   }
00141 
00142   template <class _InputIter>
00143   void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) {
00144     _M_range_initializeT(__f, __l);
00145   }
00146 
00147 public:                         // Append, operator+=, push_back.
00148   _Self& operator+=(const _Self& __s) {
00149     _Base::operator+=(__s);
00150     return *this;
00151   }
00152   _Self& operator+=(const _CharT* __s) {
00153     _STLP_FIX_LITERAL_BUG(__s)
00154     _Base::operator+=(__s);
00155     return *this;
00156   }
00157   _Self& operator+=(_CharT __c) {
00158     _Base::operator+=(__c);
00159     return *this;
00160   }
00161 
00162   _Self& append(const _Self& __s) {
00163     _Base::append(__s);
00164     return *this;
00165   }
00166 
00167   _Self& append(const _Self& __s,
00168                 size_type __pos, size_type __n) {
00169     _Base::append(__s, __pos, __n);
00170     return *this;
00171   }
00172 
00173   _Self& append(const _CharT* __s, size_type __n) {
00174     _STLP_FIX_LITERAL_BUG(__s)
00175     _Base::append(__s, __n);
00176     return *this;
00177   }
00178   _Self& append(const _CharT* __s) {
00179     _STLP_FIX_LITERAL_BUG(__s)
00180     _Base::append(__s);
00181     return *this;
00182   }
00183   _Self& append(size_type __n, _CharT __c) {
00184     _Base::append(__n, __c);
00185     return *this;
00186   }
00187 
00188   // Check to see if _InputIterator is an integer type.  If so, then
00189   // it can't be an iterator.
00190   template <class _InputIter>
00191   _Self& append(_InputIter __first, _InputIter __last) {
00192     typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
00193     return _M_append_dispatch(__first, __last, _Integral());
00194   }
00195 
00196 #if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
00197   //See equivalent assign method remark.
00198   _Self& append(const _CharT* __f, const _CharT* __l) {
00199     _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
00200     _Base::append(__f, __l);
00201     return *this;
00202   }
00203 #endif
00204 
00205 private:                        // Helper functions for append.
00206 
00207   template <class _InputIter>
00208   _Self& _M_appendT(_InputIter __first, _InputIter __last,
00209                    const input_iterator_tag &) {
00210     for ( ; __first != __last ; ++__first)
00211       _Base::push_back(*__first);
00212     return *this;
00213   }
00214 
00215   template <class _ForwardIter>
00216   _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last,
00217                     const forward_iterator_tag &)  {
00218     if (__first != __last) {
00219       const size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last));
00220       if (__n >= this->_M_rest()) {
00221         size_type __len = this->_M_compute_next_size(__n);
00222         pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
00223         pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start);
00224         __new_finish = uninitialized_copy(__first, __last, __new_finish);
00225         this->_M_construct_null(__new_finish);
00226         this->_M_deallocate_block();
00227         this->_M_reset(__new_start, __new_finish, __new_start + __len);
00228       }
00229       else {
00230         _Traits::assign(*this->_M_finish, *__first++);
00231         uninitialized_copy(__first, __last, this->_M_Finish() + 1);
00232         this->_M_construct_null(this->_M_Finish() + __n);
00233         this->_M_finish += __n;
00234       }
00235     }
00236     return *this;
00237   }
00238 
00239   template <class _Integer>
00240   _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/)
00241   { return append((size_type) __n, (_CharT) __x); }
00242 
00243   template <class _InputIter>
00244   _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/)
00245   { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); }
00246 
00247 public:                         // Assign
00248   _Self& assign(const _Self& __s) {
00249     _Base::assign(__s);
00250     return *this;
00251   }
00252 
00253   _Self& assign(const _Self& __s,
00254                 size_type __pos, size_type __n) {
00255     _Base::assign(__s, __pos, __n);
00256     return *this;
00257   }
00258 
00259   _Self& assign(const _CharT* __s, size_type __n) {
00260     _STLP_FIX_LITERAL_BUG(__s)
00261     _Base::assign(__s, __n);
00262     return *this;
00263   }
00264 
00265   _Self& assign(const _CharT* __s) {
00266     _STLP_FIX_LITERAL_BUG(__s)
00267     _Base::assign(__s);
00268     return *this;
00269   }
00270 
00271   _Self& assign(size_type __n, _CharT __c) {
00272     _Base::assign(__n, __c);
00273     return *this;
00274   }
00275 
00276 private:                        // Helper functions for assign.
00277 
00278   template <class _Integer>
00279   _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/)
00280   { return assign((size_type) __n, (_CharT) __x); }
00281 
00282   template <class _InputIter>
00283   _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/)  {
00284     pointer __cur = this->_M_Start();
00285     while (__f != __l && __cur != this->_M_Finish()) {
00286       _Traits::assign(*__cur, *__f);
00287       ++__f;
00288       ++__cur;
00289     }
00290     if (__f == __l)
00291       _Base::erase(__cur, this->_M_Finish());
00292     else
00293       _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter));
00294     return *this;
00295   }
00296 
00297 public:
00298   // Check to see if _InputIterator is an integer type.  If so, then
00299   // it can't be an iterator.
00300   template <class _InputIter>
00301   _Self& assign(_InputIter __first, _InputIter __last) {
00302     typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
00303     return _M_assign_dispatch(__first, __last, _Integral());
00304   }
00305 
00306 #if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS)
00307   /* This method is not part of the standard and is a specialization of the
00308    * template method assign. It is only granted for convenience to call assign
00309    * with mixed parameters iterator and const_iterator.
00310    */
00311   _Self& assign(const _CharT* __f, const _CharT* __l) {
00312     _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
00313     _Base::assign(__f, __l);
00314     return *this;
00315   }
00316 #endif
00317 
00318 public:                         // Insert
00319   _Self& insert(size_type __pos, const _Self& __s) {
00320     _Base::insert(__pos, __s);
00321     return *this;
00322   }
00323 
00324   _Self& insert(size_type __pos, const _Self& __s,
00325                 size_type __beg, size_type __n) {
00326     _Base::insert(__pos, __s, __beg, __n);
00327     return *this;
00328   }
00329   _Self& insert(size_type __pos, const _CharT* __s, size_type __n) {
00330     _STLP_FIX_LITERAL_BUG(__s)
00331     _Base::insert(__pos, __s, __n);
00332     return *this;
00333   }
00334 
00335   _Self& insert(size_type __pos, const _CharT* __s) {
00336     _STLP_FIX_LITERAL_BUG(__s)
00337     _Base::insert(__pos, __s);
00338     return *this;
00339   }
00340 
00341   _Self& insert(size_type __pos, size_type __n, _CharT __c) {
00342     _Base::insert(__pos, __n, __c);
00343     return *this;
00344   }
00345 
00346   iterator insert(iterator __p, _CharT __c)
00347   { return _Base::insert(__p, __c); }
00348 
00349   void insert(iterator __p, size_t __n, _CharT __c)
00350   { _Base::insert(__p, __n, __c); }
00351 
00352   // Check to see if _InputIterator is an integer type.  If so, then
00353   // it can't be an iterator.
00354   template <class _InputIter>
00355   void insert(iterator __p, _InputIter __first, _InputIter __last) {
00356     typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
00357     _M_insert_dispatch(__p, __first, __last, _Integral());
00358   }
00359 
00360 #if !defined (_STLP_NO_METHOD_SPECIALIZATION)
00361 public:
00362   void insert(iterator __p, const _CharT* __f, const _CharT* __l) {
00363     _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
00364     _M_insert(__p, __f, __l, this->_M_inside(__f));
00365   }
00366 #endif
00367 
00368 private:  // Helper functions for insert.
00369   void _M_insert(iterator __p, const _CharT* __f, const _CharT* __l, bool __self_ref) {
00370     _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l)
00371     _Base::_M_insert(__p, __f, __l, __self_ref);
00372   }
00373 
00374   template <class _ForwardIter>
00375   void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last,
00376                           size_type __n) {
00377     size_type __len = this->_M_compute_next_size(__n);
00378     pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
00379     pointer __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start);
00380     __new_finish = uninitialized_copy(__first, __last, __new_finish);
00381     __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish);
00382     this->_M_construct_null(__new_finish);
00383     this->_M_deallocate_block();
00384     this->_M_reset(__new_start, __new_finish, __new_start + __len);
00385   }
00386 
00387   template <class _InputIter>
00388   void _M_insertT(iterator __p, _InputIter __first, _InputIter __last,
00389                   const input_iterator_tag &) {
00390     for ( ; __first != __last; ++__first) {
00391       __p = insert(__p, *__first);
00392       ++__p;
00393     }
00394   }
00395 
00396   template <class _ForwardIter>
00397   void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last,
00398                   const forward_iterator_tag &) {
00399     if (__first != __last) {
00400       size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last));
00401       if (__n < this->_M_rest()) {
00402         const size_type __elems_after = this->_M_finish - __pos;
00403         if (__elems_after >= __n) {
00404           uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1);
00405           this->_M_finish += __n;
00406           _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
00407           _M_copyT(__first, __last, __pos);
00408         }
00409         else {
00410           pointer __old_finish = this->_M_Finish();
00411           _ForwardIter __mid = __first;
00412           _STLP_STD::advance(__mid, __elems_after + 1);
00413           _STLP_STD::uninitialized_copy(__mid, __last, this->_M_Finish() + 1);
00414           this->_M_finish += __n - __elems_after;
00415           uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish());
00416           this->_M_finish += __elems_after;
00417           _M_copyT(__first, __mid, __pos);
00418         }
00419       }
00420       else {
00421         _M_insert_overflow(__pos, __first, __last, __n);
00422       }
00423     }
00424   }
00425 
00426   template <class _Integer>
00427   void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x,
00428                           const __true_type& /*Integral*/)
00429   { insert(__p, (size_type) __n, (_CharT) __x); }
00430 
00431   template <class _InputIter>
00432   void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last,
00433                           const __false_type& /*Integral*/) {
00434     _STLP_FIX_LITERAL_BUG(__p)
00435     /* We are forced to do a temporary string to avoid the self referencing issue. */
00436     const _Self __self(__first, __last, this->get_allocator());
00437     _M_insertT(__p, __self.begin(), __self.end(), _STLP_ITERATOR_CATEGORY(__first, _InputIter));
00438   }
00439 
00440   template <class _InputIterator>
00441   void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) {
00442     _STLP_FIX_LITERAL_BUG(__p)
00443     for ( ; __first != __last; ++__first, ++__result)
00444       _Traits::assign(*__result, *__first);
00445   }
00446 
00447 #if !defined (_STLP_NO_METHOD_SPECIALIZATION)
00448   void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) {
00449     _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) _STLP_FIX_LITERAL_BUG(__res)
00450     _Base::_M_copy(__f, __l, __res);
00451   }
00452 #endif
00453 
00454 public:                         // Erase.
00455   _Self& erase(size_type __pos = 0, size_type __n = npos) {
00456     _Base::erase(__pos, __n);
00457     return *this;
00458   }
00459 
00460   iterator erase(iterator __pos) {
00461     _STLP_FIX_LITERAL_BUG(__pos)
00462     return _Base::erase(__pos);
00463   }
00464 
00465   iterator erase(iterator __first, iterator __last) {
00466     _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
00467     return _Base::erase(__first, __last);
00468   }
00469 
00470 public:                         // Replace.  (Conceptually equivalent
00471                                 // to erase followed by insert.)
00472   _Self& replace(size_type __pos, size_type __n, const _Self& __s) {
00473     _Base::replace(__pos, __n, __s);
00474     return *this;
00475   }
00476 
00477   _Self& replace(size_type __pos1, size_type __n1, const _Self& __s,
00478                  size_type __pos2, size_type __n2) {
00479     _Base::replace(__pos1, __n1, __s, __pos2, __n2);
00480     return *this;
00481   }
00482 
00483   _Self& replace(size_type __pos, size_type __n1,
00484                  const _CharT* __s, size_type __n2) {
00485     _STLP_FIX_LITERAL_BUG(__s)
00486     _Base::replace(__pos, __n1, __s, __n2);
00487     return *this;
00488   }
00489 
00490   _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) {
00491     _STLP_FIX_LITERAL_BUG(__s)
00492     _Base::replace(__pos, __n1, __s);
00493     return *this;
00494   }
00495 
00496   _Self& replace(size_type __pos, size_type __n1,
00497                  size_type __n2, _CharT __c) {
00498     _Base::replace(__pos, __n1, __n2, __c);
00499     return *this;
00500   }
00501 
00502   _Self& replace(iterator __first, iterator __last, const _Self& __s) {
00503     _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
00504     _Base::replace(__first, __last, __s);
00505     return *this;
00506   }
00507 
00508   _Self& replace(iterator __first, iterator __last,
00509                  const _CharT* __s, size_type __n) {
00510     _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
00511     _STLP_FIX_LITERAL_BUG(__s)
00512     _Base::replace(__first, __last, __s, __n);
00513     return *this;
00514   }
00515 
00516   _Self& replace(iterator __first, iterator __last,
00517                  const _CharT* __s) {
00518     _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
00519     _STLP_FIX_LITERAL_BUG(__s)
00520     _Base::replace(__first, __last, __s);
00521     return *this;
00522   }
00523 
00524   _Self& replace(iterator __first, iterator __last,
00525                  size_type __n, _CharT __c) {
00526     _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
00527     _Base::replace(__first, __last, __n, __c);
00528     return *this;
00529   }
00530 
00531   // Check to see if _InputIter is an integer type.  If so, then
00532   // it can't be an iterator.
00533   template <class _InputIter>
00534   _Self& replace(iterator __first, iterator __last,
00535                  _InputIter __f, _InputIter __l) {
00536     _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last)
00537     typedef typename _IsIntegral<_InputIter>::_Ret _Integral;
00538     return _M_replace_dispatch(__first, __last, __f, __l, _Integral());
00539   }
00540 
00541 #if !defined (_STLP_NO_METHOD_SPECIALIZATION)
00542   _Self& replace(iterator __first, iterator __last,
00543                  const _CharT* __f, const _CharT* __l) {
00544     _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
00545     _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
00546     return _M_replace(__first, __last, __f, __l, this->_M_inside(__f));
00547   }
00548 #endif
00549 
00550 private:                        // Helper functions for replace.
00551   _Self& _M_replace(iterator __first, iterator __last,
00552                     const _CharT* __f, const _CharT* __l, bool __self_ref) {
00553     _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
00554     _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l)
00555     _Base::_M_replace(__first, __last, __f, __l, __self_ref);
00556     return *this;
00557   }
00558 
00559   template <class _Integer>
00560   _Self& _M_replace_dispatch(iterator __first, iterator __last,
00561                              _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) {
00562     _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
00563     return replace(__first, __last, (size_type) __n, (_CharT) __x);
00564   }
00565 
00566   template <class _InputIter>
00567   _Self& _M_replace_dispatch(iterator __first, iterator __last,
00568                              _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) {
00569     _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last)
00570     /* We are forced to do a temporary string to avoid the self referencing issue. */
00571     const _Self __self(__f, __l, this->get_allocator());
00572     return _M_replace(__first, __last, __self._M_Start(), __self._M_Finish(), false);
00573   }
00574 
00575 public:                         // Other modifier member functions.
00576   void swap(_Self& __s) { _Base::swap(__s); }
00577 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
00578   void _M_swap_workaround(_Self& __x) { swap(__x); }
00579 #endif
00580 
00581 public:                         // Substring.
00582   _Self substr(size_type __pos = 0, size_type __n = npos) const
00583   { return _Self(*this, __pos, __n, this->get_allocator()); }
00584 
00585 #if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG)
00586 #  define _STLP_STRING_SUM_BASE _STLP_NO_MEM_T_STRING_BASE
00587 #  include <stl/_string_sum_methods.h>
00588 #  undef _STLP_STRING_SUM_BASE
00589 #endif
00590 };
00591 
00592 #undef _STLP_NO_MEM_T_STRING_BASE
00593 
00594 #if defined (basic_string)
00595 _STLP_MOVE_TO_STD_NAMESPACE
00596 #  undef basic_string
00597 #endif
00598 
00599 _STLP_END_NAMESPACE

Generated on Sun May 27 2012 04:29:38 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.