24 #ifndef _STLP_STRING_C 25 #define _STLP_STRING_C 27 #ifndef _STLP_INTERNAL_STRING_H 31 #ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H 35 #ifndef _STLP_INTERNAL_FUNCTION_H 39 #if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) 40 # define basic_string _STLP_NO_MEM_T_NAME(str) 41 #elif defined (_STLP_DEBUG) 42 # define basic_string _STLP_NON_DBG_NAME(str) 45 #if defined (_STLP_NESTED_TYPE_PARAM_BUG) 46 # define __size_type__ size_t 47 # define size_type size_t 48 # define iterator _CharT* 50 # define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_string<_CharT,_Traits,_Alloc>::size_type 58 template <
class _Traits>
60 typedef typename _Traits::char_type
_CharT;
73 template <
class _InputIter,
class _CharT,
class _Traits>
75 const _CharT* __first2,
const _CharT* __last2,
79 template <
class _InputIter,
class _CharT,
class _Traits>
81 const _CharT* __first2,
const _CharT* __last2,
85 template <
class _InputIter,
class _CharT,
class _Traits>
87 const _CharT* __first2,
const _CharT* __last2,
89 #if !defined (__BORLANDC__) 98 template <
class _InputIter,
class _CharT,
class _Traits>
100 const _CharT* __first2,
const _CharT* __last2,
101 _Traits* ,
const __true_type& __useStrcspnLikeAlgo)
104 template <
class _InputIter,
class _CharT,
class _Traits>
106 const _CharT* __first2,
const _CharT* __last2,
110 template <
class _InputIter,
class _CharT,
class _Tp,
class _Traits>
112 const _CharT* __first2,
const _CharT* __last2,
113 _Tp* __pt, _Traits* __traits) {
120 template <
class _InputIter,
class _CharT,
class _Traits>
122 const _CharT* __first2,
const _CharT* __last2,
127 template <
class _InputIter,
class _CharT,
class _Traits>
129 const _CharT* __first2,
const _CharT* __last2,
133 template <
class _InputIter,
class _CharT,
class _Traits>
135 const _CharT* __first2,
const _CharT* __last2,
137 #if !defined (__BORLANDC__) 149 #if !defined (basic_string) 157 template <
class _CharT,
class _Traits,
class _Alloc>
160 this->_M_throw_length_error();
163 if (__n < this->_M_capacity())
169 template <
class _CharT,
class _Traits,
class _Alloc>
171 pointer __new_start = this->_M_start_of_storage.allocate(
__n,
__n);
173 _M_construct_null(__new_finish);
174 this->_M_deallocate_block();
175 this->_M_reset(__new_start, __new_finish, __new_start +
__n);
178 template <
class _CharT,
class _Traits,
class _Alloc>
183 this->_M_throw_length_error();
184 if (
__n >= this->_M_rest())
185 _M_reserve(_M_compute_next_size(
__n));
187 _M_construct_null(this->_M_finish +
__n);
188 _Traits::assign(*
end(),
__c);
189 this->_M_finish +=
__n;
194 template <
class _CharT,
class _Traits,
class _Alloc>
199 if (
__n >= this->_M_rest()) {
201 pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
204 _M_construct_null(__new_finish);
205 this->_M_deallocate_block();
206 this->_M_reset(__new_start, __new_finish, __new_start + __len);
209 const _CharT* __f1 = __first;
212 _M_construct_null(this->_M_finish +
__n);
213 _Traits::assign(*
end(), *__first);
214 this->_M_finish +=
__n;
220 template <
class _CharT,
class _Traits,
class _Alloc>
224 _Traits::assign(this->_M_Start(),
__n,
__c);
228 if (
__n < capacity()) {
229 _Traits::assign(this->_M_Start(),
size(),
__c);
240 template <
class _CharT,
class _Traits,
class _Alloc>
250 _M_append(__f +
size(), __l);
255 template <
class _CharT,
class _Traits,
class _Alloc>
259 if (this->_M_rest() > 1 ) {
260 _M_construct_null(this->_M_finish + 1);
261 _Traits::move(__p + 1, __p, this->_M_finish - __p);
262 _Traits::assign(*__p,
__c);
266 size_type __len = _M_compute_next_size(1);
267 pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
269 _Traits::assign(*__new_pos,
__c);
270 pointer __new_finish = __new_pos + 1;
272 _M_construct_null(__new_finish);
273 this->_M_deallocate_block();
274 this->_M_reset(__new_start, __new_finish, __new_start + __len);
279 template <
class _CharT,
class _Traits,
class _Alloc>
283 if (this->_M_rest() >
__n) {
284 const size_type __elems_after = this->_M_finish - __pos;
285 pointer __old_finish = this->_M_finish;
286 if (__elems_after >=
__n) {
288 this->_M_finish +=
__n;
289 _Traits::move(__pos +
__n, __pos, (__elems_after -
__n) + 1);
290 _Traits::assign(__pos,
__n,
__c);
294 this->_M_finish +=
__n - __elems_after;
296 this->_M_finish += __elems_after;
297 _Traits::assign(__pos, __elems_after + 1,
__c);
302 pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
306 _M_construct_null(__new_finish);
307 this->_M_deallocate_block();
308 this->_M_reset(__new_start, __new_finish, __new_start + __len);
313 template <
class _CharT,
class _Traits,
class _Alloc>
315 const _CharT* __first,
const _CharT*
__last,
320 if (this->_M_rest() >
__n) {
321 const size_t __elems_after = this->_M_finish - __pos;
322 pointer __old_finish = this->_M_finish;
323 if (__elems_after >=
__n) {
325 this->_M_finish +=
__n;
326 _Traits::move(__pos +
__n, __pos, (__elems_after -
__n) + 1);
327 if (!__self_ref ||
__last < __pos) {
328 _M_copy(__first,
__last, __pos);
332 if (__first >= __pos) {
336 _M_copy(__first,
__last, __pos);
340 _M_move(__first,
__last, __pos);
345 const_iterator __mid = __first;
346 __mid += __elems_after + 1;
348 this->_M_finish +=
__n - __elems_after;
350 this->_M_finish += __elems_after;
352 _M_copy(__first, __mid, __pos);
354 _M_move(__first, __mid, __pos);
358 size_type __len = _M_compute_next_size(
__n);
359 pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
363 _M_construct_null(__new_finish);
364 this->_M_deallocate_block();
365 this->_M_reset(__new_start, __new_finish, __new_start + __len);
370 template <
class _CharT,
class _Traits,
class _Alloc>
377 _Traits::assign(__first,
__n,
__c);
381 _Traits::assign(__first, __len,
__c);
387 template <
class _CharT,
class _Traits,
class _Alloc>
390 const _CharT* __f,
const _CharT* __l,
393 const difference_type __len =
__last - __first;
395 if (!__self_ref || __l < __first || __f >=
__last)
396 _M_copy(__f, __l, __first);
398 _M_move(__f, __l, __first);
400 }
else if (!__self_ref || (__f >=
__last) || (__l <= __first)) {
401 const_iterator __m = __f + __len;
402 _M_copy(__f, __m, __first);
403 _M_insert(
__last, __m, __l, __self_ref );
404 }
else if (__f < __first) {
405 const_iterator __m = __f + __len;
407 const difference_type __off_dest = __first - this->
begin();
408 const difference_type __off_src = __f - this->
begin();
409 _M_insert(
__last, __m, __l,
true);
410 _Traits::move(
begin() + __off_dest,
begin() + __off_src, __len);
412 const_iterator __m = __f + __len;
413 _Traits::move(__first, __f, __len);
414 _M_insert(
__last, __m, __l,
true);
419 template <
class _CharT,
class _Traits,
class _Alloc>
423 const size_t __len =
size();
424 if (__pos >= __len || __pos +
__n > __len) {
425 if (
__n == 0 && __pos <= __len ) {
434 return __result != this->_M_Finish() ? __result - this->_M_Start() :
npos;
437 template <
class _CharT,
class _Traits,
class _Alloc>
440 if (__pos >=
size()) {
447 return __result != this->_M_Finish() ? __result - this->_M_Start() :
npos;
450 template <
class _CharT,
class _Traits,
class _Alloc>
460 return __last - this->_M_Start();
464 return __result !=
__last ? __result - this->_M_Start() :
npos;
467 template <
class _CharT,
class _Traits,
class _Alloc>
475 const_reverse_iterator __rresult =
478 return __rresult != rend() ? (__rresult.base() - 1) -
begin() :
npos;
481 template <
class _CharT,
class _Traits,
class _Alloc>
__size_type__ 494 template <
class _CharT,
class _Traits,
class _Alloc>
504 const const_reverse_iterator __rresult =
508 return __rresult != rend() ? (__rresult.base() - 1) -
begin() :
npos;
512 template <
class _CharT,
class _Traits,
class _Alloc>
__size_type__ 515 typedef typename _Traits::char_type _CharType;
523 return __result != this->_M_finish ? __result - this->_M_Start() :
npos;
527 template <
class _CharT,
class _Traits,
class _Alloc>
__size_type__ 534 return __result != this->_M_finish ? __result - this->_M_Start() :
npos;
538 template <
class _CharT,
class _Traits,
class _Alloc>
542 typedef typename _Traits::char_type _CharType;
548 const_reverse_iterator __rlast = const_reverse_iterator(
__last);
549 const_reverse_iterator __rresult =
554 return __rresult != rend() ? (__rresult.base() - 1) -
begin() :
npos;
557 template <
class _CharT,
class _Traits,
class _Alloc>
566 const_reverse_iterator __rlast = const_reverse_iterator(
__last);
567 const_reverse_iterator __rresult =
570 return __rresult != rend() ? (__rresult.base() - 1) -
begin() :
npos;
573 #if !defined (basic_string) 577 template <
class _CharT,
class _Traits,
class _Alloc>
579 _CharT* __buf,
size_t __n) {
583 __buf[
__n] = _CharT();
598 template <
class _Tp,
class _Alloc>
602 template <
class _Tp,
class _Alloc>
606 template <
class _Tp,
class _Alloc>
609 #if defined (_STLP_USE_SHORT_STRING_OPTIM) 610 if (
__n > _DEFAULT_SIZE) {
611 this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(
__n,
__n);
612 this->_M_finish = this->_M_start_of_storage._M_data;
613 this->_M_buffers._M_end_of_storage = this->_M_start_of_storage._M_data +
__n;
616 this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(
__n,
__n);
617 this->_M_finish = this->_M_start_of_storage._M_data;
618 this->_M_end_of_storage = this->_M_start_of_storage._M_data +
__n;
621 this->_M_throw_length_error();
625 #if !defined (basic_string) 629 #if defined (_STLP_DONT_SUP_DFLT_PARAM) 630 template <
class _CharT,
class _Traits,
class _Alloc>
638 template <
class _CharT,
class _Traits,
class _Alloc>
646 template <
class _CharT,
class _Traits,
class _Alloc>
651 #if defined (basic_string) 656 #if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION) 657 template <
class _CharT,
class _Traits,
class _Alloc>
664 #if defined (_STLP_NESTED_TYPE_PARAM_BUG) static short search(int val, const short *table, int size)
const value_type * const_pointer
void _M_reserve(size_type)
_InputIter __str_find_first_of(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *__traits)
void _M_allocate_block(size_t __n=_DEFAULT_SIZE)
_InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *, const __true_type &)
GLsizei const GLvoid * pointer
#define __STATIC_CAST(__x, __y)
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)
void _STLP_FUNCTION_THROWS _M_throw_length_error() const
_InputIter __str_find_first_not_of_aux2(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Tp *__pt, _Traits *__traits)
_Not_within_traits(const _CharT *__f, const _CharT *__l)
static void append(struct dump_context *dc, const void *data, unsigned size)
_Self & _M_assign(const _CharT *__f, const _CharT *__l)
_InputIter __find_first_of(_InputIter __first1, _InputIter __last1, _ForwardIter __first2, _ForwardIter __last2)
_Self & _M_append(const _CharT *__first, const _CharT *__last)
_STLP_MOVE_TO_STD_NAMESPACE _InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred)
_InputIter __str_find_first_not_of(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *__traits)
#define _STLP_MOVE_TO_PRIV_NAMESPACE
_Self & replace(size_type __pos, size_type __n, const _Self &__s)
GLenum GLuint GLenum GLsizei length
void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const
_STLP_INLINE_LOOP _InputIter __last
_Base::size_type size_type
#define _STLP_MOVE_TO_STD_NAMESPACE
basic_string(const allocator_type &__a=allocator_type())
_ForwardIter1 find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2, _ForwardIter2 __last2)
_Self & assign(const _Self &__s)
_Self & append(const _CharT *__first, const _CharT *__last)
size_type find_first_not_of(const _Self &__s, size_type __pos=0) const
unary_negate< _Predicate > not1(const _Predicate &__pred)
size_type find_last_not_of(const _Self &__s, size_type __pos=npos) const
_InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *, const __true_type &__useStrcspnLikeAlgo)
_Self & _M_replace(iterator __first, iterator __last, const _CharT *__f, const _CharT *__l, bool __self_ref)
#define _STLP_VALUE_TYPE(_It, _Tp)
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_length_error(const char *__msg)
size_type rfind(const _Self &__s, size_type __pos=npos) const
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE _OutputIter __ucopy(_InputIter __first, _InputIter __last, _OutputIter __result, _Distance *)
_InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *__traits, const __true_type &)
size_type find_first_of(const _Self &__s, size_type __pos=0) const
_Traits::char_type _CharT
_InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1, _ForwardIter __first2, _ForwardIter __last2, _Tp2 *, _Predicate __pred, const __true_type &)
_STLP_MOVE_TO_PRIV_NAMESPACE void _STLP_CALL _S_string_copy(const basic_string< _CharT, _Traits, _Alloc > &__s, _CharT *__buf, size_t __n)
#define _STLP_END_NAMESPACE
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
__kernel_ptrdiff_t ptrdiff_t
bool operator()(const _CharT &__x) const
pointer _M_insert_aux(pointer, _CharT)
_Base::allocator_type allocator_type
#define _STLP_FIX_LITERAL_BUG(__x)
#define _STLP_BEGIN_NAMESPACE
_ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp &__x)
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_out_of_range(const char *__msg)
size_type find_last_of(const _Self &__s, size_type __pos=npos) const
void reserve(size_type=0)
_Self & insert(size_type __pos, const _Self &__s)
void _M_range_initialize(_InputIter __f, _InputIter __l, const input_iterator_tag &__tag)
const value_type * const_iterator