ReactOS 0.4.15-dev-7942-gd23573b
_rope.c File Reference
#include <stl/_rope.h>
#include <stl/_cstdio.h>
#include <stl/_ostream.h>
#include <stl/_istream.h>
#include <stl/_range_errors.h>
Include dependency graph for _rope.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  _Rope_flatten_char_consumer< _CharT >
 
class  _Rope_find_char_char_consumer< _CharT >
 
class  _Rope_insert_char_consumer< _CharT, _Traits >
 

Macros

#define _STLP_ROPEIMPL_H
 
#define __allocator__   allocator_type
 
#define __RopeLeaf__   _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeLeaf
 
#define __RopeRep__   _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeRep
 
#define __ROPE_TABLE_BODY
 

Functions

template<class _CharT , class _Alloc >
void _Terminate_RopeLeaf (_Rope_RopeLeaf< _CharT, _Alloc > *__r, size_t __size, const __true_type &)
 
template<class _CharT , class _Alloc >
void _Terminate_RopeLeaf (_Rope_RopeLeaf< _CharT, _Alloc > *__r, size_t, const __false_type &)
 
template<class _CharT , class _Alloc , class _CharConsumer >
bool _S_apply_to_pieces (_CharConsumer &__c, _Rope_RopeRep< _CharT, _Alloc > *__r, size_t __begin, size_t __end)
 
template<class _CharT , class _Traits >
void _Rope_fill (basic_ostream< _CharT, _Traits > &__o, streamsize __n)
 
template<class _CharT , class _Traits , class _Alloc >
basic_ostream< _CharT, _Traits > & _S_io_get (basic_ostream< _CharT, _Traits > &__o, const rope< _CharT, _Alloc > &__r, const __true_type &)
 
template<class _CharT , class _Traits , class _Alloc >
basic_ostream< _CharT, _Traits > & _S_io_get (basic_ostream< _CharT, _Traits > &__o, const rope< _CharT, _Alloc > &__r, const __false_type &)
 
template<class _CharT , class _Traits , class _Alloc >
basic_ostream< _CharT, _Traits > & operator<< (basic_ostream< _CharT, _Traits > &__o, const rope< _CharT, _Alloc > &__r)
 
template<class _CharT , class _Alloc >
void _Rope_rotate (_Rope_iterator< _CharT, _Alloc > __first, _Rope_iterator< _CharT, _Alloc > __middle, _Rope_iterator< _CharT, _Alloc > __last)
 

Variables

template<class _CharT , class _Alloc >
const unsigned long rope< _CharT, _Alloc >::_S_min_len[__ROPE_DEPTH_SIZE__ROPE_TABLE_BODY
 

Macro Definition Documentation

◆ __allocator__

#define __allocator__   allocator_type

Definition at line 55 of file _rope.c.

◆ __ROPE_TABLE_BODY

#define __ROPE_TABLE_BODY
Value:
= { \
/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, \
/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, \
/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, \
/* 18 */6765ul, /* 19 */10946ul, /* 20 */17711ul, /* 21 */28657ul, /* 22 */46368ul, \
/* 23 */75025ul, /* 24 */121393ul, /* 25 */196418ul, /* 26 */317811ul, \
/* 27 */514229ul, /* 28 */832040ul, /* 29 */1346269ul, /* 30 */2178309ul, \
/* 31 */3524578ul, /* 32 */5702887ul, /* 33 */9227465ul, /* 34 */14930352ul, \
/* 35 */24157817ul, /* 36 */39088169ul, /* 37 */63245986ul, /* 38 */102334155ul, \
/* 39 */165580141ul, /* 40 */267914296ul, /* 41 */433494437ul, \
/* 42 */701408733ul, /* 43 */1134903170ul, /* 44 */1836311903ul, \
/* 45 */2971215073ul }

Definition at line 1003 of file _rope.c.

◆ __RopeLeaf__

#define __RopeLeaf__   _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeLeaf

Definition at line 364 of file _rope.c.

◆ __RopeRep__

#define __RopeRep__   _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeRep

Definition at line 365 of file _rope.c.

◆ _STLP_ROPEIMPL_H

#define _STLP_ROPEIMPL_H

Definition at line 28 of file _rope.c.

Function Documentation

◆ _Rope_fill()

template<class _CharT , class _Traits >
void _Rope_fill ( basic_ostream< _CharT, _Traits > &  __o,
streamsize  __n 
)
inline

Definition at line 845 of file _rope.c.

845 {
846 char __f = __o.fill();
847 for (streamsize __i = 0; __i < __n; ++__i) __o.put(__f);
848}
return __n
Definition: _algo.h:75
ptrdiff_t streamsize
Definition: char_traits.h:81
char_type fill() const
Definition: _ios.h:81
_Self & put(char_type __c)
Definition: _ostream.c:408

Referenced by _S_io_get().

◆ _Rope_rotate()

template<class _CharT , class _Alloc >
void _Rope_rotate ( _Rope_iterator< _CharT, _Alloc __first,
_Rope_iterator< _CharT, _Alloc __middle,
_Rope_iterator< _CharT, _Alloc __last 
)

Definition at line 1358 of file _rope.c.

1360 {
1361 _STLP_ASSERT(__first.container() == __middle.container() &&
1362 __middle.container() == __last.container())
1363 rope<_CharT,_Alloc>& __r(__first.container());
1364 rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index());
1365 rope<_CharT,_Alloc> __suffix =
1366 __r.substr(__last.index(), __r.size() - __last.index());
1367 rope<_CharT,_Alloc> __part1 =
1368 __r.substr(__middle.index(), __last.index() - __middle.index());
1369 rope<_CharT,_Alloc> __part2 =
1370 __r.substr(__first.index(), __middle.index() - __first.index());
1371 __r = __prefix;
1372 __r += __part1;
1373 __r += __part2;
1374 __r += __suffix;
1375}
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
#define _Alloc
Definition: _bvector.h:330
#define _STLP_ASSERT(expr)
Definition: _debug.h:165
rope< _CharT, _Alloc > & container()
Definition: _rope.h:994
Definition: _rope.h:1087
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
static substr_t substr(const WCHAR *str, size_t len)
Definition: internet.h:203

Referenced by rotate().

◆ _S_apply_to_pieces()

template<class _CharT , class _Alloc , class _CharConsumer >
bool _S_apply_to_pieces ( _CharConsumer &  __c,
_Rope_RopeRep< _CharT, _Alloc > *  __r,
size_t  __begin,
size_t  __end 
)

Definition at line 785 of file _rope.c.

787 {
788 typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
789 typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation;
790 typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf;
791 typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction;
792
793 if (0 == __r) return true;
794 switch(__r->_M_tag) {
795 case _RopeRep::_S_concat:
796 {
797 _RopeConcatenation* __conc = __STATIC_CAST(_RopeConcatenation*, __r);
798 _RopeRep* __left = __conc->_M_left;
799 size_t __left_len = __left->_M_size._M_data;
800 if (__begin < __left_len) {
801 size_t __left_end = (min) (__left_len, __end);
802 if (!_S_apply_to_pieces(__c, __left, __begin, __left_end))
803 return false;
804 }
805 if (__end > __left_len) {
806 _RopeRep* __right = __conc->_M_right;
807 size_t __right_start = (max)(__left_len, __begin);
808 if (!_S_apply_to_pieces(__c, __right,
809 __right_start - __left_len,
810 __end - __left_len)) {
811 return false;
812 }
813 }
814 }
815 return true;
816 case _RopeRep::_S_leaf:
817 {
818 _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r);
819 return __c(__l->_M_data + __begin, __end - __begin);
820 }
821 case _RopeRep::_S_function:
822 case _RopeRep::_S_substringfn:
823 {
824 _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r);
825 size_t __len = __end - __begin;
826 bool __result;
827 _CharT* __buffer = __r->get_allocator().allocate(__len);
828 _STLP_TRY {
829 (*(__f->_M_fn))(__begin, __len, __buffer);
830 __result = __c(__buffer, __len);
831 __r->get_allocator().deallocate(__buffer, __len);
832 }
833 _STLP_UNWIND((__r->get_allocator().deallocate(__buffer, __len)))
834 return __result;
835 }
836 default:
837 _STLP_ASSERT(false)
838 /*NOTREACHED*/
840 }
841}
bool _S_apply_to_pieces(_CharConsumer &__c, _Rope_RopeRep< _CharT, _Alloc > *__r, size_t __begin, size_t __end)
Definition: _rope.c:785
return
Definition: dirsup.c:529
#define _STLP_UNWIND(action)
Definition: features.h:824
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
#define _STLP_TRY
Definition: features.h:817
#define min(a, b)
Definition: monoChain.cc:55
#define __c
Definition: schilyio.h:209
#define false
Definition: stdbool.h:37
_Tag _M_tag
Definition: _rope.h:352
allocator_type get_allocator() const
Definition: _rope.h:358
#define max(a, b)
Definition: svc.c:63

Referenced by _S_apply_to_pieces(), rope< _CharT, _Alloc >::_S_flatten(), rope< _CharT, _Alloc >::apply_to_pieces(), and rope< _CharT, _Alloc >::find().

◆ _S_io_get() [1/2]

template<class _CharT , class _Traits , class _Alloc >
basic_ostream< _CharT, _Traits > & _S_io_get ( basic_ostream< _CharT, _Traits > &  __o,
const rope< _CharT, _Alloc > &  __r,
const __false_type  
)

Definition at line 873 of file _rope.c.

874 {
875 streamsize __w = __o.width();
876 size_t __rope_len = __r.size();
878
879 __o.width(__w /__rope_len);
880 _STLP_TRY {
881 __r.apply_to_pieces(0, __rope_len, __c);
882 __o.width(__w);
883 }
884 _STLP_UNWIND(__o.width(__w))
885 return __o;
886}
streamsize width() const
Definition: _ios_base.h:134
void apply_to_pieces(size_t __begin, size_t __end, _CharConsumer &__c) const
Definition: _rope.h:1184
size_type size() const
Definition: _rope.h:1623

◆ _S_io_get() [2/2]

template<class _CharT , class _Traits , class _Alloc >
basic_ostream< _CharT, _Traits > & _S_io_get ( basic_ostream< _CharT, _Traits > &  __o,
const rope< _CharT, _Alloc > &  __r,
const __true_type  
)

Definition at line 851 of file _rope.c.

852 {
853 streamsize __w = __o.width();
854 const bool __left = (__o.flags() & ios::left) != 0;
855 size_t __rope_len = __r.size();
857
858 const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __rope_len) < __w)) ||
859 ((sizeof(streamsize) <= sizeof(size_t)) && (__rope_len < __STATIC_CAST(size_t, __w))));
860 streamsize __pad_len = __need_pad ? __w - __rope_len : 0;
861
862 if (!__left && __pad_len > 0) {
863 _Rope_fill(__o, __pad_len);
864 }
865 __r.apply_to_pieces(0, __rope_len, __c);
866 if (__left && __pad_len > 0) {
867 _Rope_fill(__o, __pad_len);
868 }
869 return __o;
870}
void _Rope_fill(basic_ostream< _CharT, _Traits > &__o, streamsize __n)
Definition: _rope.c:845
fmtflags flags() const
Definition: _ios_base.h:107

◆ _Terminate_RopeLeaf() [1/2]

template<class _CharT , class _Alloc >
void _Terminate_RopeLeaf ( _Rope_RopeLeaf< _CharT, _Alloc > *  __r,
size_t  __size,
const __true_type  
)

Definition at line 395 of file _rope.c.

396 {
397 _S_construct_null(__r->_M_data + __size);
398 _STLP_ASSERT(__r->_M_c_string == __r->_M_data)
399}
void _S_construct_null(_CharT *__p)
Definition: _rope.h:148
_CharT * _M_data
Definition: _rope.h:453
_CharT *_STLP_VOLATILE _M_c_string
Definition: _rope.h:361

Referenced by rope< _CharT, _Alloc >::_S_destr_leaf_concat_char_iter().

◆ _Terminate_RopeLeaf() [2/2]

template<class _CharT , class _Alloc >
void _Terminate_RopeLeaf ( _Rope_RopeLeaf< _CharT, _Alloc > *  __r,
size_t  ,
const __false_type  
)

Definition at line 402 of file _rope.c.

403 {
404 if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) {
405 __r->_M_free_c_string();
406 __r->_M_c_string = 0;
407 }
408}
void _M_free_c_string()
Definition: _rope.c:76

◆ operator<<()

template<class _CharT , class _Traits , class _Alloc >
basic_ostream< _CharT, _Traits > & operator<< ( basic_ostream< _CharT, _Traits > &  __o,
const rope< _CharT, _Alloc > &  __r 
)

Definition at line 873 of file _rope.c.

890 {
891 typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral;
892 return _S_io_get(__o, __r, _Char_Is_Integral());
893}
basic_ostream< _CharT, _Traits > & _S_io_get(basic_ostream< _CharT, _Traits > &__o, const rope< _CharT, _Alloc > &__r, const __true_type &)
Definition: _rope.c:851

Variable Documentation

◆ __ROPE_TABLE_BODY

template<class _CharT , class _Alloc >
const unsigned long rope<_CharT,_Alloc>::_S_min_len [__ROPE_DEPTH_SIZE] __ROPE_TABLE_BODY

Definition at line 1018 of file _rope.c.