59 template <
class _CharT,
class _Alloc>
80 size_t __buf_start_pos = __leaf_pos;
81 size_t __leaf_end = __leaf_pos + __leaf->
_M_size;
83 _Alloc>*)__leaf)->_M_fn;
84 if (__buf_start_pos + __len <= __pos)
86 __buf_start_pos = __pos - __len / 4;
87 if (__buf_start_pos + __len > __leaf_end)
88 __buf_start_pos = __leaf_end - __len;
90 if (__buf_start_pos + __len > __leaf_end)
91 __len = __leaf_end - __buf_start_pos;
92 (*__fn)(__buf_start_pos - __leaf_pos, __len, __x.
_M_tmp_buf);
105 template <
class _CharT,
class _Alloc>
113 int __curr_depth = -1;
114 size_t __curr_start_pos = 0;
116 unsigned char __dirns = 0;
118 if (__pos >= __x.
_M_root->_M_size)
138 __path[__curr_depth] = __curr_rope;
139 switch(__curr_rope->
_M_tag)
151 size_t __left_len = __left->
_M_size;
154 if (__pos >= __curr_start_pos + __left_len)
158 __curr_start_pos += __left_len;
161 __curr_rope = __left;
172 if (__j < 0) __j = 0;
173 while (__j <= __curr_depth)
183 template <
class _CharT,
class _Alloc>
191 size_t __len = __current_node->
_M_size;
203 while (--__current_index >= 0)
211 __node_start_pos -= __c->
_M_left->_M_size;
214 if (__current_index < 0)
225 __node_start_pos += __c->
_M_left->_M_size;
227 __x.
_M_path_end[++__current_index] = __current_node;
251 template <
class _CharT,
class _Alloc>
260 if (__chars_left > __n)
262 else if (__chars_left == __n)
272 template <
class _CharT,
class _Alloc>
280 if (__chars_left >= __n)
288 template <
class _CharT,
class _Alloc>
303 template <
class _CharT,
class _Alloc>
310 template <
class _CharT,
class _Alloc>
318 template <
class _CharT,
class _Alloc>
323 const _CharT* __p = __s;
333 template <
class _CharT,
class _Alloc>
347 template <
class _CharT,
class _Alloc>
366 template <
class _CharT,
class _Alloc>
377 __l->_Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf();
385 __c->_Rope_RopeConcatenation<_CharT, _Alloc>::
386 ~_Rope_RopeConcatenation();
394 __f->_Rope_RopeFunction<_CharT, _Alloc>::~_Rope_RopeFunction();
402 __ss->_Rope_RopeSubstring<_CharT, _Alloc>::
403 ~_Rope_RopeSubstring();
411 template <
class _CharT,
class _Alloc>
421 template <
class _CharT,
class _Alloc>
428 _CharT* __new_data = (_CharT*)
442 _RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
451 template <
class _CharT,
class _Alloc>
472 __r->
_M_size = __old_len + __len;
487 template <
class _CharT,
class _Alloc>
496 size_t __depth = __result->
_M_depth;
524 template <
class _CharT,
class _Alloc>
583 template <
class _CharT,
class _Alloc>
594 size_t __orig_size = __r->
_M_size;
618 if (__right == __new_right)
624 __r->
_M_size = __orig_size + __slen;
647 template <
class _CharT,
class _Alloc>
674 __left)->_M_right->_M_tag)
711 template <
class _CharT,
class _Alloc>
719 size_t __len = __base->_M_size;
721 const size_t __lazy_threshold = 128;
723 if (__endp1 >= __len)
727 __base->_M_ref_nonnil();
735 __adj_endp1 = __endp1;
737 switch(__base->_M_tag)
744 size_t __left_len = __left->
_M_size;
747 if (__adj_endp1 <= __left_len)
749 else if (__start >= __left_len)
751 __adj_endp1 - __left_len);
758 __result =
_S_concat(__left_result, __right_result);
766 if (__start >= __adj_endp1)
768 __result_len = __adj_endp1 - __start;
769 if (__result_len > __lazy_threshold)
772 const _CharT* __section = __l->
_M_data + __start;
774 __base->_M_get_allocator());
790 if (__start >= __adj_endp1)
792 __result_len = __adj_endp1 - __start;
793 if (__result_len > __lazy_threshold)
798 __adj_endp1 - __start,
799 __base->_M_get_allocator());
809 if (__start >= __adj_endp1)
811 __result_len = __adj_endp1 - __start;
813 if (__result_len > __lazy_threshold)
815 __section = (_CharT*)
818 { (*(__f->
_M_fn))(__start, __result_len, __section); }
821 _RopeRep::__STL_FREE_STRING(__section, __result_len,
822 __base->_M_get_allocator());
827 __base->_M_get_allocator());
834 __base->_M_get_allocator());
838 template<
class _CharT>
860 template<
class _CharT>
878 for (__i = 0; __i < __n; __i++)
890 template<
class _CharT,
class _Traits>
907 template<
class _CharT,
class _Traits>
914 for (__i = 0; __i < __n; __i++)
915 _M_o.put(__leaf[__i]);
919 template <
class _CharT,
class _Alloc>
934 size_t __left_len = __left->
_M_size;
935 if (__begin < __left_len)
937 size_t __left_end =
std::min(__left_len, __end);
941 if (__end > __left_len)
944 size_t __right_start =
std::max(__left_len, __begin);
946 __right_start - __left_len,
955 return __c(__l->
_M_data + __begin, __end - __begin);
961 size_t __len = __end - __begin;
964 (_CharT*)_Alloc().allocate(__len *
sizeof(_CharT));
967 (*(__f->
_M_fn))(__begin, __len, __buffer);
968 __result = __c(__buffer, __len);
969 _Alloc().deallocate(__buffer, __len *
sizeof(_CharT));
973 _Alloc().deallocate(__buffer, __len *
sizeof(_CharT));
983 template<
class _CharT,
class _Traits>
987 char __f = __o.
fill();
990 for (__i = 0; __i < __n; __i++)
995 template <
class _CharT>
1008 template<
class _CharT,
class _Traits,
class _Alloc>
1011 const rope<_CharT, _Alloc>& __r)
1014 size_t __w = __o.
width();
1017 size_t __rope_len = __r.size();
1018 _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
1021 if (__rope_len < __w)
1022 __pad_len = __w - __rope_len;
1027 __o.
width(__w / __rope_len);
1030 if (__is_simple && !__left && __pad_len > 0)
1032 __r.apply_to_pieces(0, __r.size(), __c);
1033 if (__is_simple && __left && __pad_len > 0)
1047 template <
class _CharT,
class _Alloc>
1055 return(__buffer + __len);
1058 template <
class _CharT,
class _Alloc>
1066#ifndef __STL_OLD_ROPE_SEMANTICS
1067 if (__result_pos ==
size())
1068 __result_pos =
npos;
1070 return __result_pos;
1073 template <
class _CharT,
class _Alloc>
1087 _CharT* __rest =
_S_flatten(__left, __buffer);
1102 return __buffer + __f->
_M_size;
1110 template <
class _CharT,
class _Alloc>
1116 for (
int __i = 0; __i < __indent; __i++)
1130 printf(
"Concatenation %p (depth = %d, len = %ld, %s balanced)\n",
1134 printf(
"Concatenation %p (rc = %ld, depth = %d, "
1135 "len = %ld, %s balanced)\n",
1139 _S_dump(__left, __indent + 2);
1140 _S_dump(__right, __indent + 2);
1153 __kind =
"Function";
1156 __kind =
"Function representing substring";
1159 __kind =
"(corrupted kind field!)";
1162 printf(
"%s %p (depth = %d, len = %ld) ",
1165 printf(
"%s %p (rc = %ld, depth = %d, len = %ld) ",
1170 const int __max_len = 40;
1172 _CharT __buffer[__max_len + 1];
1173 bool __too_big = __r->
_M_size > __prefix->_M_size;
1176 __buffer[__prefix->_M_size] =
_S_eos((_CharT*)0);
1177 printf(
"%s%s\n", (
char*)__buffer,
1178 __too_big?
"...\n" :
"\n");
1185 template <
class _CharT,
class _Alloc>
1189 1, 2, 3, 5, 8, 13, 21,
1190 34, 55, 89, 144, 233, 377,
1191 610, 987, 1597, 2584, 4181,
1192 6765, 10946, 17711, 28657, 46368,
1193 75025, 121393, 196418, 317811,
1194 514229, 832040, 1346269, 2178309,
1195 3524578, 5702887, 9227465, 14930352,
1196 24157817, 39088169, 63245986, 102334155,
1197 165580141, 267914296, 433494437,
1198 701408733, 1134903170, 1836311903,
1202 template <
class _CharT,
class _Alloc>
1208 _RopeRep* __result = 0;
1220 _S_add_to_forest(__r, __forest);
1222 if (0 != __forest[__i])
1225 _Self_destruct_ptr __old(__result);
1227 __result = _S_concat(__forest[__i], __result);
1228 __forest[__i]->_M_unref_nonnil();
1229#if !defined(__GC) && __cpp_exceptions
1239 _S_unref(__forest[__i]);
1248 template <
class _CharT,
class _Alloc>
1268 template <
class _CharT,
class _Alloc>
1278 for (__i = 0; __s >=
_S_min_len[__i+1]; ++__i)
1280 if (0 != __forest[__i])
1301 if (0 != __forest[__i])
1314 __forest[__i] = __insertee;
1321 template <
class _CharT,
class _Alloc>
1340 if (__i >= __left_len)
1358 _CharT __result = _CharT();
1360 (*(__f->
_M_fn))(__i, 1, &__result);
1370 template <
class _CharT,
class _Alloc>
1391 __clrstack[__csptr++] = __c;
1392 if (__i >= __left_len)
1405 __clrstack[__csptr++] = __l;
1409 _RopeRep* __d = __clrstack[__csptr];
1427 template <
class _CharT,
class _Alloc>
1440 __right_len = __right->
_M_size;
1483 template <
class _CharT,
class _Alloc>
1504 _S_destr_concat_char_iter(__left,
1512 _M_root->_M_tree_ptr = __result;
1516 template <
class _CharT,
class _Alloc>
1518 operator _CharT()
const
1526 template <
class _CharT,
class _Alloc>
1532 template <
class _CharT,
class _Alloc>
1537 using std::__uninitialized_fill_n_a;
1543 _CharT* __rest_buffer;
1550 __exponent = __n / __exponentiate_threshold;
1551 __rest = __n % __exponentiate_threshold;
1557 __uninitialized_fill_n_a(__rest_buffer, __rest, __c,
1565 _RopeRep::__STL_FREE_STRING(__rest_buffer, __rest,
1571 if (__exponent != 0)
1573 _CharT* __base_buffer =
1577 __uninitialized_fill_n_a(__base_buffer, __exponentiate_threshold, __c,
1583 __exponentiate_threshold,
1588 _RopeRep::__STL_FREE_STRING(__base_buffer,
1589 __exponentiate_threshold,
1594 if (1 == __exponent)
1595 __result = __base_rope;
1597 __result =
power(__base_rope, __exponent,
1600 if (0 != __remainder)
1601 __result += __remainder_rope;
1604 __result = __remainder_rope;
1610 template<
class _CharT,
class _Alloc>
1614 template<
class _CharT,
class _Alloc>
1632 __result[__s] =
_S_eos((_CharT*)0);
1639 template<
class _CharT,
class _Alloc>
1650 && 0 != __old_c_string)
1651 return(__old_c_string);
1655 __result[__s] =
_S_eos((_CharT*)0);
1664 template<
class _Rope_iterator>
1687#if !defined(__GNUC__)
1705 rotate(_Rope_iterator<
wchar_t, __STL_DEFAULT_ALLOCATOR(
char)> __first,
1706 _Rope_iterator<
wchar_t, __STL_DEFAULT_ALLOCATOR(
char)> __middle,
1707 _Rope_iterator<
wchar_t, __STL_DEFAULT_ALLOCATOR(
char)> __last)
#define __throw_exception_again
#define _GLIBCXX_VISIBILITY(V)
#define _GLIBCXX_END_NAMESPACE_VERSION
#define _GLIBCXX_BEGIN_NAMESPACE_VERSION
int __gthread_mutex_unlock(__gthread_mutex_t *__mutex)
int __gthread_mutex_lock(__gthread_mutex_t *__mutex)
#define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a)
_Tp power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)
std::pair< _InputIterator, _OutputIterator > copy_n(_InputIterator __first, _Size __count, _OutputIterator __result)
Copies the range [first,first+count) into [result,result+count).
std::pair< _InputIter, _ForwardIter > uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result)
Copies the range [first,last) into result.
int lexicographical_compare_3way(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2)
memcmp on steroids.
constexpr const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
constexpr void _Destroy(_ForwardIterator __first, _ForwardIterator __last)
void __throw_length_error(const char *)
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const _Pointer_adapter< _StoreT > &__p)
void _Rope_fill(std::basic_ostream< _CharT, _Traits > &__o, std::size_t __n)
void _S_cond_store_eos(_CharT &)
bool _S_is_one_byte_char_type(_CharT *)
void rotate(_Rope_iterator< char, __STL_DEFAULT_ALLOCATOR(char)> __first, _Rope_iterator< char, __STL_DEFAULT_ALLOCATOR(char)> __middle, _Rope_iterator< char, __STL_DEFAULT_ALLOCATOR(char)> __last)
bool _Rope_is_simple(_CharT *)
bool _S_is_basic_char_type(_CharT *)
void _Rope_rotate(_Rope_iterator __first, _Rope_iterator __middle, _Rope_iterator __last)
GNU extensions for public use.
char_type fill() const
Retrieves the empty character.
__ostream_type & put(char_type __c)
Simple insertion.
Template class basic_ostream.
fmtflags flags() const
Access to format flags.
streamsize width() const
Flags access.
static const fmtflags left
bool operator()(const _CharT *__leaf, std::size_t __n)
_Rope_flatten_char_consumer(_CharT *__buffer)
~_Rope_flatten_char_consumer()
_Rope_find_char_char_consumer(_CharT __p)
~_Rope_find_char_char_consumer()
bool operator()(const _CharT *__leaf, std::size_t __n)
~_Rope_insert_char_consumer()
bool operator()(const _CharT *__leaf, std::size_t __n)
_Rope_insert_char_consumer(_Insert_ostream &__writer)
std::basic_ostream< _CharT, _Traits > _Insert_ostream
static void _S_ref(_RopeRep *__t)
static size_type _S_rounded_up_size(size_type __n)
static _RopeLeaf * _S_new_RopeLeaf(_CharT *__s, size_type __size, allocator_type &__a)
rope substr(size_type __start, size_type __len=1) const
static void _S_dump(_RopeRep *__r, int __indent=0)
static _RopeRep * _S_concat_char_iter(_RopeRep *__r, const _CharT *__iter, size_type __slen, allocator_type &__a)
static bool _S_is0(_CharT __c)
_Base::allocator_type allocator_type
static bool _S_apply_to_pieces(_Rope_char_consumer< _CharT > &__c, const _RopeRep *__r, size_type __begin, size_type __end)
_Rope_const_iterator< _CharT, _Alloc > const_iterator
_Rope_RopeRep< _CharT, _Alloc > _RopeRep
static _RopeRep * _S_destr_concat_char_iter(_RopeRep *__r, const _CharT *__iter, size_type __slen, allocator_type &__a)
static _RopeLeaf * _S_destr_leaf_concat_char_iter(_RopeLeaf *__r, const _CharT *__iter, size_type __slen)
_Rope_self_destruct_ptr< _CharT, _Alloc > _Self_destruct_ptr
static void _S_add_to_forest(_RopeRep *__r, _RopeRep **__forest)
_Rope_RopeConcatenation< _CharT, _Alloc > _RopeConcatenation
static _RopeRep * _S_substring(_RopeRep *__base, size_type __start, size_type __endp1)
rope(_RopeRep *__t, const allocator_type &__a=allocator_type())
static size_type _S_allocated_capacity(size_type __n)
static _RopeLeaf * _S_leaf_concat_char_iter(_RopeLeaf *__r, const _CharT *__iter, size_type __slen)
static _RopeConcatenation * _S_new_RopeConcatenation(_RopeRep *__left, _RopeRep *__right, allocator_type &__a)
_Rope_RopeLeaf< _CharT, _Alloc > _RopeLeaf
size_type find(_CharT __c, size_type __pos=0) const
const _CharT * c_str() const
static _RopeRep * _S_concat_and_set_balanced(_RopeRep *__left, _RopeRep *__right)
static _CharT _S_fetch(_RopeRep *__r, size_type __pos)
static size_type _S_char_ptr_len(const _CharT *__s)
static _CharT * _S_fetch_ptr(_RopeRep *__r, size_type __pos)
static const size_type npos
_Rope_RopeSubstring< _CharT, _Alloc > _RopeSubstring
static _CharT * _S_flatten(_RopeRep *__r, _CharT *__buffer)
static _RopeSubstring * _S_new_RopeSubstring(_Rope_RopeRep< _CharT, _Alloc > *__b, size_type __s, size_type __l, allocator_type &__a)
static _RopeRep * _S_concat(_RopeRep *__left, _RopeRep *__right)
static const unsigned long _S_min_len[__detail::_S_max_rope_depth+1]
static void _S_unref(_RopeRep *__t)
static int _S_compare(const _RopeRep *__x, const _RopeRep *__y)
const _CharT * replace_with_c_str()
static void _S_add_leaf_to_forest(_RopeRep *__r, _RopeRep **__forest)
static _CharT _S_empty_c_str[1]
_Rope_RopeFunction< _CharT, _Alloc > _RopeFunction
static _RopeRep * _S_tree_concat(_RopeRep *__left, _RopeRep *__right)
_Rope_base< _CharT, _Alloc > _Base
static _RopeRep * _S_balance(_RopeRep *__r)
allocator_type & _M_get_allocator()
_Rope_RopeRep< _CharT, _Alloc > * _M_right
_Rope_RopeRep< _CharT, _Alloc > * _M_left
static size_type _S_rounded_up_size(size_type __n)
char_producer< _CharT > * _M_fn
_Rope_RopeRep< _CharT, _Alloc > * _M_base
rope< _CharT, _Alloc > * _M_root_rope
rope< _CharT, _Alloc > & container()
rope< _CharT, _Alloc > _My_rope
_Rope_char_ref_proxy(_My_rope *__r, std::size_t __p)
_Rope_char_ref_proxy & operator=(_CharT __c)
_Rope_self_destruct_ptr< _CharT, _Alloc > _Self_destruct_ptr
_Rope_char_ptr_proxy< _CharT, _Alloc > operator&() const
_Rope_RopeRep< _CharT, _Alloc > _RopeRep
allocator_type & _M_get_allocator()
static void _Data_deallocate(_CharT *__p, size_type __n)
static void _F_deallocate(__F *__p, size_type __n)
static void _L_deallocate(__L *__p, size_type __n)
static void _S_deallocate(__S *__p, size_type __n)
static void _C_deallocate(__C *__p, size_type __n)
_Rope_rep_base< _CharT, _Alloc >::allocator_type allocator_type
static void _S_unref(_Rope_RopeRep *__t)
static void _S_ref(_Rope_RopeRep *__t)
static void _S_free_string(_CharT *, size_type __len, allocator_type &__a)
std::size_t index() const
_CharT _M_tmp_buf[_S_iterator_buf_len]
_Rope_RopeRep< _CharT, _Alloc > _RopeRep
static void _S_setbuf(_Rope_iterator_base &__x)
void _M_decr(std::size_t __n)
unsigned char _M_path_directions
void _M_incr(std::size_t __n)
std::size_t _M_current_pos
const _RopeRep * _M_path_end[_S_path_cache_len]
static void _S_setcache(_Rope_iterator_base &__x)
static void _S_setcache_for_incr(_Rope_iterator_base &__x)
static _CharT * _Data_allocate(std::size_t __n)
static void _C_deallocate(__C *__p, std::size_t __n)