19 #ifndef _STLP_INTERNAL_STRING_H 20 #define _STLP_INTERNAL_STRING_H 22 #ifndef _STLP_INTERNAL_ALLOC_H 26 #ifndef _STLP_STRING_FWD_H 30 #ifndef _STLP_INTERNAL_FUNCTION_BASE_H 34 #ifndef _STLP_INTERNAL_ALGOBASE_H 38 #ifndef _STLP_INTERNAL_ITERATOR_H 42 #ifndef _STLP_INTERNAL_UNINITIALIZED_H 46 #if defined (_STLP_USE_TEMPLATE_EXPRESSION) 50 #if defined (__MWERKS__) && ! defined (_STLP_USE_OWN_NAMESPACE) 55 # if !defined( __MSL_CPP__ ) || __MSL_CPP__ < 0x4105 102 #if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 103 # define basic_string _STLP_NO_MEM_T_NAME(str) 104 #elif defined (_STLP_DEBUG) 105 # define basic_string _STLP_NON_DBG_NAME(str) 108 #if defined (basic_string) 112 #if defined (__DMC__) 113 # define _STLP_PRIVATE public 114 #elif defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 115 # define _STLP_PRIVATE protected 117 # define _STLP_PRIVATE private 120 template <
class _CharT,
class _Traits,
class _Alloc>
122 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string) 157 #if !defined (_STLP_DONT_SUP_DFLT_PARAM) 168 #if !defined (_STLP_DONT_SUP_DFLT_PARAM) 182 #if !defined (_STLP_DONT_SUP_DFLT_PARAM) 188 if (__pos > __s.
size())
189 this->_M_throw_out_of_range();
195 if (__pos > __s.size())
196 this->_M_throw_out_of_range();
199 __s._M_Start() + __pos + (
min) (
__n, __s.size() - __pos));
205 if (__pos > __s.size())
206 this->_M_throw_out_of_range();
209 __s._M_Start() + __pos + (
min) (
__n, __s.size() - __pos));
212 #if !defined (_STLP_DONT_SUP_DFLT_PARAM) 228 #if !defined (_STLP_DONT_SUP_DFLT_PARAM) 236 #if !defined (_STLP_DONT_SUP_DFLT_PARAM) 252 #if !defined (_STLP_NO_MOVE_SEMANTIC) 259 #if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 260 template <
class _InputIterator>
267 # if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) 268 template <
class _InputIterator>
276 # if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 283 # if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) 291 # if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 305 this->_M_throw_length_error();
312 template <
class _InputIter>
315 this->_M_allocate_block();
316 _M_construct_null(this->_M_Finish());
320 template <
class _ForwardIter>
324 this->_M_allocate_block(
__n + 1);
329 template <
class _InputIter>
334 template <
class _Integer>
336 this->_M_allocate_block(
__n + 1);
341 template <
class _InputIter>
349 _M_assign(__s._M_Start(), __s._M_Finish());
367 void _M_construct_null(_CharT* __p)
const 370 { _M_construct_null(this->_M_Finish()); }
373 return (__s >= this->_M_Start()) && (__s < this->_M_Finish());
379 this->_M_allocate_block(
__n + 1);
395 {
return const_reverse_iterator(this->_M_Finish()); }
396 const_reverse_iterator
rend()
const 397 {
return const_reverse_iterator(this->_M_Start()); }
419 {
return this->_M_capacity() - 1; }
423 _Traits::assign(*(this->_M_Start()),
_M_null());
424 this->_M_finish = this->_M_Start();
428 bool empty()
const {
return this->_M_Start() == this->_M_Finish(); }
433 {
return *(this->_M_Start() +
__n); }
435 {
return *(this->_M_Start() +
__n); }
439 this->_M_throw_out_of_range();
440 return *(this->_M_Start() +
__n);
445 this->_M_throw_out_of_range();
446 return *(this->_M_Start() +
__n);
458 #if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 459 template <
class _InputIter>
467 template <
class _ForwardIter>
472 if (
__n >= this->_M_rest()) {
477 _M_construct_null(__new_finish);
478 this->_M_deallocate_block();
479 this->_M_reset(__new_start, __new_finish, __new_start +
__len);
482 _Traits::assign(*this->_M_finish, *
__first++);
484 _M_construct_null(this->_M_Finish() +
__n);
485 this->_M_finish +=
__n;
491 template <
class _Integer>
495 template <
class _InputIter>
502 template <
class _InputIter>
517 {
return _M_append(__s._M_Start(), __s._M_Finish()); }
521 if (__pos > __s.
size())
522 this->_M_throw_out_of_range();
524 __s._M_Start() + __pos + (
min) (
__n, __s.
size() - __pos));
535 if (this->_M_rest() == 1 )
537 _M_construct_null(this->_M_Finish() + 1);
538 _Traits::assign(*(this->_M_Finish()),
__c);
543 _Traits::assign(*(this->_M_Finish() - 1),
_M_null());
549 {
return _M_assign(__s._M_Start(), __s._M_Finish()); }
553 if (__pos > __s.
size())
554 this->_M_throw_out_of_range();
556 __s._M_Start() + __pos + (
min) (
__n, __s.
size() - __pos));
570 #if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 572 template <
class _Integer>
576 template <
class _InputIter>
578 pointer __cur = this->_M_Start();
579 while (
__f !=
__l && __cur != this->_M_Finish()) {
580 _Traits::assign(*__cur, *
__f);
594 template <
class _InputIter>
610 this->_M_throw_out_of_range();
612 this->_M_throw_length_error();
613 _M_insert(
begin() + __pos, __s._M_Start(), __s._M_Finish(), &__s ==
this);
619 if (__pos >
size() || __beg > __s.
size())
620 this->_M_throw_out_of_range();
623 this->_M_throw_length_error();
625 __s._M_Start() + __beg, __s._M_Start() + __beg +
__len, &__s ==
this);
631 this->_M_throw_out_of_range();
633 this->_M_throw_length_error();
641 this->_M_throw_out_of_range();
644 this->_M_throw_length_error();
651 this->_M_throw_out_of_range();
653 this->_M_throw_length_error();
662 return this->_M_Finish() - 1;
686 #if defined (_STLP_MEMBER_TEMPLATES) 687 # if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 688 template <
class _ForwardIter>
696 _M_construct_null(__new_finish);
697 this->_M_deallocate_block();
698 this->_M_reset(__new_start, __new_finish, __new_start +
__len);
701 template <
class _InputIter>
710 template <
class _ForwardIter>
715 if (__n < this->_M_rest()) {
716 const size_type __elems_after = this->_M_finish - __pos;
717 if (__elems_after >=
__n) {
719 this->_M_finish +=
__n;
720 _Traits::move(__pos +
__n, __pos, (__elems_after -
__n) + 1);
724 pointer __old_finish = this->_M_Finish();
728 this->_M_finish +=
__n - __elems_after;
730 this->_M_finish += __elems_after;
740 template <
class _Integer>
745 template <
class _InputIter>
754 template <
class _InputIterator>
758 _Traits::assign(*__result, *
__first);
761 # if !defined (_STLP_NO_METHOD_SPECIALIZATION) 762 void _M_copyT(
const _CharT*
__f,
const _CharT*
__l, _CharT* __res) {
771 template <
class _InputIter>
779 #if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) 790 this->_M_throw_out_of_range();
797 _Traits::move(__pos, __pos + 1, this->_M_Finish() - __pos);
816 this->_M_throw_out_of_range();
819 this->_M_throw_length_error();
821 __s._M_Start(), __s._M_Finish(), &__s ==
this);
828 if (__pos1 > __size1 || __pos2 > __size2)
829 this->_M_throw_out_of_range();
830 const size_type __len1 = (
min) (__n1, __size1 - __pos1);
831 const size_type __len2 = (
min) (__n2, __size2 - __pos2);
832 if (__len2 >
max_size() - (__size1 - __len1))
833 this->_M_throw_length_error();
835 __s._M_Start() + __pos2, __s._M_Start() + __pos2 + __len2, &__s ==
this);
843 this->_M_throw_out_of_range();
846 this->_M_throw_length_error();
860 this->_M_throw_out_of_range();
863 this->_M_throw_length_error();
892 #if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 893 template <
class _Integer>
900 template <
class _InputIter>
912 template <
class _InputIter>
914 _InputIter
__f, _InputIter
__l) {
921 #if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) 924 const _CharT*
__f,
const _CharT*
__l) {
936 this->_M_throw_out_of_range();
943 #if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) 944 void _M_swap_workaround(
_Self& __x) {
swap(__x); }
949 const _CharT*
c_str()
const {
return this->_M_Start(); }
950 const _CharT*
data()
const {
return this->_M_Start(); }
954 {
return find(__s._M_Start(), __pos, __s.
size()); }
967 {
return rfind(__s._M_Start(), __pos, __s.
size()); }
1027 {
return _M_compare(this->_M_Start(), this->_M_Finish(), __s._M_Start(), __s._M_Finish()); }
1030 if (__pos1 >
size())
1031 this->_M_throw_out_of_range();
1033 this->_M_Start() + __pos1 + (
min) (__n1,
size() - __pos1),
1034 __s._M_Start(), __s._M_Finish());
1039 if (__pos1 >
size() || __pos2 > __s.
size())
1040 this->_M_throw_out_of_range();
1042 this->_M_Start() + __pos1 + (
min) (__n1,
size() - __pos1),
1043 __s._M_Start() + __pos2,
1044 __s._M_Start() + __pos2 + (
min) (__n2, __s.
size() - __pos2));
1054 if (__pos1 >
size())
1055 this->_M_throw_out_of_range();
1057 this->_M_Start() + __pos1 + (
min) (__n1,
size() - __pos1),
1063 if (__pos1 >
size())
1064 this->_M_throw_out_of_range();
1066 this->_M_Start() + __pos1 + (
min) (__n1,
size() - __pos1),
1072 const _CharT* __f2,
const _CharT* __l2) {
1076 return cmp != 0 ?
cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0));
1078 #if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 1079 # define _STLP_STRING_SUM_BASE(__reserve, __size, __alloc) _STLP_PRIV _String_base<_CharT,_Alloc>(__alloc, __size + 1) 1081 # undef _STLP_STRING_SUM_BASE 1085 #undef _STLP_PRIVATE 1087 #if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96) 1088 template <
class _CharT,
class _Traits,
class _Alloc>
1092 #if defined (_STLP_USE_TEMPLATE_EXPORT) 1094 # if defined (_STLP_HAS_WCHAR_T) 1099 #if defined (basic_string) 1101 # undef basic_string 1106 #if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 1110 #if defined (_STLP_DEBUG) 1119 #if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) 1120 template <
class _CharT,
class _Traits,
class _Alloc>
1128 # if defined (_STLP_HAS_WCHAR_T) 1134 #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) 1135 template <
class _CharT,
class _Traits,
class _Alloc>
1152 template <
class _CharT,
class _Traits,
class _Alloc>
1154 _CharT* __buf,
size_t __n);
1156 #if defined(_STLP_USE_WIDE_INTERFACE) 1158 wstring __ASCIIToWide(
const char *ascii);
1159 string __WideToASCII(
const wchar_t *wide);
1171 #if defined(_STLP_USE_NO_IOSTREAMS) || \ 1172 (defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)) #define _STLP_CONVERT_ALLOCATOR(__a, _Tp)
void _M_terminate_string()
basic_string(size_type __n, _CharT __c, const allocator_type &__a=allocator_type())
_Self & replace(iterator __first, iterator __last, const _Self &__s)
_Self & assign(const _Self &__s, size_type __pos, size_type __n)
_STLP_PRIVATE _Alloc _Base
const value_type * const_pointer
bool _M_inside(const _CharT *__s) const
void _M_reserve(size_type)
const_reverse_iterator rbegin() const
iterator erase(iterator __first, iterator __last)
_Self & _M_replace_dispatch(iterator __first, iterator __last, _Integer __n, _Integer __x, const __true_type &)
_STLP_NO_MEM_T_STRING_BASE _Base
size_type capacity() const
GLsizei const GLvoid * pointer
_STLP_PRIVATE const _CharT const _CharT bool __self_ref
size_type find(const _CharT *__s, size_type __pos=0) const
size_type find_last_of(const _CharT *__s, size_type __pos=npos) const
_Self & append(const _Self &__s, size_type __pos, size_type __n)
void _M_range_initializeT(_InputIter __f, _InputIter __l)
#define __STATIC_CAST(__x, __y)
size_type find_first_of(const _CharT *__s, size_type __pos=0) const
size_type find(const _Self &__s, size_type __pos=0) const
void _M_insert(iterator __p, const _CharT *__f, const _CharT *__l, bool __self_ref)
size_type find(_CharT __c) const
_Self & append(const _Self &__s)
void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last, size_type __n)
basic_string(_Reserve_t, size_t __n, const allocator_type &__a=allocator_type())
static int _STLP_CALL _M_compare(const _CharT *__f1, const _CharT *__l1, const _CharT *__f2, const _CharT *__l2)
_Self & insert(size_type __pos, const _CharT *__s, size_type __n)
const _CharT * data() const
void _M_range_initialize(_ForwardIter __f, _ForwardIter __l, const forward_iterator_tag &)
int compare(size_type __pos1, size_type __n1, const _Self &__s, size_type __pos2, size_type __n2) const
#define cmp(status, error)
_Self & _M_assign(const _CharT *__f, const _CharT *__l)
_Self & assign(const _CharT *__f, const _CharT *__l)
_Self & _M_append(const _CharT *__first, const _CharT *__last)
_Self & operator=(const _Self &__s)
basic_string(const _Self &__s, size_type __pos, size_type __n=npos, const allocator_type &__a=allocator_type())
allocator_type get_allocator() const
_Self & append(const _CharT *__s)
#define _STLP_ITERATOR_CATEGORY(_It, _Tp)
const char *_STLP_CALL __get_c_string(const string &__str)
GLsizei GLsizei GLfloat distance
size_type rfind(const _CharT *__s, size_type __pos=npos) const
#define _STLP_MOVE_TO_PRIV_NAMESPACE
_Self & assign(const _CharT *__s, size_type __n)
size_type find_last_of(_CharT __c, size_type __pos=npos) const
basic_string(__move_source< _Self > src)
_Self & replace(size_type __pos, size_type __n, const _Self &__s)
static _CharT _STLP_CALL _M_null()
iterator erase(iterator __pos)
_Self & append(const _CharT *__s, size_type __n)
reference operator[](size_type __n)
void resize(size_type __n, _CharT __c)
GLenum GLuint GLenum GLsizei length
_Self & insert(size_type __pos, const _CharT *__s)
#define _STLP_DEFAULT_CONSTRUCTED(_TTp)
basic_string(const _CharT *__s, size_type __n, const allocator_type &__a=allocator_type())
_STLP_PRIVATE iterator const _CharT * __f
const _CharT * c_str() const
_Self & replace(size_type __pos, size_type __n1, const _CharT *__s, size_type __n2)
__type_traits< _Tp >::has_trivial_destructor complete
_STLP_END_NAMESPACE _STLP_BEGIN_NAMESPACE void _STLP_CALL swap(string &__x, string &__y)
_STLP_MOVE_TO_STD_NAMESPACE _ForwardIter uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result)
const_iterator end() const
void _M_range_initialize(const _CharT *__f, const _CharT *__l)
const_iterator begin() const
ptrdiff_t difference_type
random_access_iterator_tag _Iterator_category
_Base::size_type size_type
_STLP_PRIVATE const _CharT * __first
size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const
_Self & insert(size_type __pos, size_type __n, _CharT __c)
basic_string(const _CharT *__f, const _CharT *__l, const allocator_type &__a _STLP_ALLOCATOR_TYPE_DFL)
#define _STLP_MOVE_TO_STD_NAMESPACE
void get(int argc, const char *argv[])
int compare(size_type __pos1, size_type __n1, const _CharT *__s) const
basic_string(const allocator_type &__a=allocator_type())
_STLP_MOVE_TO_PRIV_NAMESPACE void _STLP_CALL _S_string_copy(const basic_string< _CharT, _Traits, _Alloc > &__s, _CharT *__buf, size_t __n)
_Self & replace(size_type __pos1, size_type __n1, const _Self &__s, size_type __pos2, size_type __n2)
_Self & operator+=(_CharT __c)
_STLP_PRIVATE const _CharT const _CharT * __last
#define _STLP_ALLOCATOR_TYPE_DFL
_Self & replace(iterator __first, iterator __last, const _CharT *__f, const _CharT *__l)
void insert(iterator __p, const _CharT *__f, const _CharT *__l)
_Self & assign(const _Self &__s)
#define _STLP_EXPORT_TEMPLATE_CLASS
_Self & operator=(_CharT __c)
_Self & append(const _CharT *__first, const _CharT *__last)
size_type find_first_not_of(const _Self &__s, size_type __pos=0) const
void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type &)
size_type find_last_not_of(const _Self &__s, size_type __pos=npos) const
_Self & _M_replace(iterator __first, iterator __last, const _CharT *__f, const _CharT *__l, bool __self_ref)
void push_back(_CharT __c)
_Self & assign(const _CharT *__s)
reverse_iterator rbegin()
_Self substr(size_type __pos=0, size_type __n=npos) const
void _M_copy(const _CharT *__f, const _CharT *__l, _CharT *__res)
size_type rfind(const _Self &__s, size_type __pos=npos) const
int compare(const _Self &__s) const
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
basic_string< _CharT, _Traits, _Alloc > _Self
_Self & operator=(const _CharT *__s)
void _Construct(_T1 *__p)
size_type find_first_of(const _Self &__s, size_type __pos=0) const
_Self & operator+=(const _CharT *__s)
int compare(size_type __pos1, size_type __n1, const _CharT *__s, size_type __n2) const
_Self & _M_append_dispatch(_Integer __n, _Integer __x, const __true_type &)
_Self & insert(size_type __pos, const _Self &__s, size_type __beg, size_type __n)
const_reverse_iterator rend() const
const_reference operator[](size_type __n) const
_Base::_CalledFromWorkaround_t _CalledFromWorkaround_t
#define _STLP_END_NAMESPACE
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
reference at(size_type __n)
__kernel_ptrdiff_t ptrdiff_t
iterator insert(iterator __p, _CharT __c)
void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result)
void _M_insertT(iterator __p, _InputIter __first, _InputIter __last, const input_iterator_tag &)
_Self & _M_appendT(_InputIter __first, _InputIter __last, const input_iterator_tag &)
pointer _M_insert_aux(pointer, _CharT)
_Base::allocator_type allocator_type
#define _STLP_FIX_LITERAL_BUG(__x)
int compare(size_type __pos1, size_type __n1, const _Self &__s) const
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
const_reference at(size_type __n) const
_Self & replace(iterator __first, iterator __last, const _CharT *__s)
_Self & operator+=(const _Self &__s)
int compare(const _CharT *__s) const
_STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS
#define _STLP_BEGIN_NAMESPACE
_ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp &__x)
void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type &)
size_type find_last_of(const _Self &__s, size_type __pos=npos) const
void _M_move(const _CharT *__f, const _CharT *__l, _CharT *__res)
void reserve(size_type=0)
_Self & insert(size_type __pos, const _Self &__s)
_Self & replace(iterator __first, iterator __last, const _CharT *__s, size_type __n)
size_type find_last_not_of(const _CharT *__s, size_type __pos=npos) const
void _M_range_initialize(_InputIter __f, _InputIter __l, const input_iterator_tag &__tag)
size_type find_first_of(_CharT __c, size_type __pos=0) const
_Self & replace(size_type __pos, size_type __n1, const _CharT *__s)
_Self & erase(size_type __pos=0, size_type __n=npos)
size_type max_size() const
_Self & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
const value_type * const_iterator
void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x, const __true_type &)
_STLP_PRIVATE iterator const _CharT const _CharT * __l
const value_type & const_reference
_STLP_PRIV _String_reserve_t _Reserve_t
void resize(size_type __n)
_Self & _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type &)