ReactOS 0.4.15-dev-5667-ged97270
_String_base< _Tp, _Alloc > Class Template Reference

#include <_string_base.h>

Collaboration diagram for _String_base< _Tp, _Alloc >:

Public Types

enum  { _DEFAULT_SIZE = 4 * sizeof( void * ) }
 
typedef _Alloc allocator_type
 
typedef _STLP_alloc_proxy< _Tp *, _Tp, allocator_type_AllocProxy
 
typedef size_t size_type
 

Protected Member Functions

_Tp const_M_Start () const
 
_Tp * _M_Start ()
 
_Tp const_M_End () const
 
_Tp * _M_End ()
 
size_type _M_capacity () const
 
size_type _M_rest () const
 
_Tp const_M_Finish () const
 
_Tp * _M_Finish ()
 
void _M_allocate_block (size_t __n=_DEFAULT_SIZE)
 
void _M_deallocate_block ()
 
size_t max_size () const
 
 _String_base (const allocator_type &__a)
 
 _String_base (const allocator_type &__a, size_t __n)
 
 _String_base (__move_source< _Self > src)
 
 ~_String_base ()
 
void _M_reset (_Tp *__start, _Tp *__finish, _Tp *__end_of_storage)
 
void _M_swap (_Self &__s)
 
void _STLP_FUNCTION_THROWS _M_throw_length_error () const
 
void _STLP_FUNCTION_THROWS _M_throw_out_of_range () const
 

Protected Attributes

_Tp * _M_finish
 
_AllocProxy _M_start_of_storage
 

Private Types

typedef _String_base< _Tp, _Alloc_Self
 

Private Attributes

_Tp * _M_end_of_storage
 

Detailed Description

template<class _Tp, class _Alloc>
class _String_base< _Tp, _Alloc >

Definition at line 41 of file _string_base.h.

Member Typedef Documentation

◆ _AllocProxy

template<class _Tp , class _Alloc >
typedef _STLP_alloc_proxy<_Tp*, _Tp, allocator_type> _String_base< _Tp, _Alloc >::_AllocProxy

Definition at line 50 of file _string_base.h.

◆ _Self

template<class _Tp , class _Alloc >
typedef _String_base<_Tp, _Alloc> _String_base< _Tp, _Alloc >::_Self
private

Definition at line 42 of file _string_base.h.

◆ allocator_type

template<class _Tp , class _Alloc >
typedef _Alloc _String_base< _Tp, _Alloc >::allocator_type

Definition at line 49 of file _string_base.h.

◆ size_type

template<class _Tp , class _Alloc >
typedef size_t _String_base< _Tp, _Alloc >::size_type

Definition at line 51 of file _string_base.h.

Member Enumeration Documentation

◆ anonymous enum

template<class _Tp , class _Alloc >
anonymous enum
Enumerator
_DEFAULT_SIZE 

Definition at line 47 of file _string_base.h.

47{_DEFAULT_SIZE = 4 * sizeof( void * )};

Constructor & Destructor Documentation

◆ _String_base() [1/3]

template<class _Tp , class _Alloc >
_String_base< _Tp, _Alloc >::_String_base ( const allocator_type __a)
inlineprotected

Definition at line 110 of file _string_base.h.

112 : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf)
113#else
114 : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0)
115#endif
116 {}
_AllocProxy _M_start_of_storage
Definition: _string_base.h:87
_Tp * _M_end_of_storage
Definition: _string_base.h:59
_Tp * _M_finish
Definition: _string_base.h:86

◆ _String_base() [2/3]

template<class _Tp , class _Alloc >
_String_base< _Tp, _Alloc >::_String_base ( const allocator_type __a,
size_t  __n 
)
inlineprotected

Definition at line 118 of file _string_base.h.

120 : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf) {
121#else
122 : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0) {
123#endif
125 }
return __n
Definition: _algo.h:75
void _M_allocate_block(size_t __n=_DEFAULT_SIZE)
Definition: _string.c:607

◆ _String_base() [3/3]

template<class _Tp , class _Alloc >
_String_base< _Tp, _Alloc >::_String_base ( __move_source< _Self src)
inlineprotected

Definition at line 144 of file _string_base.h.

146 : _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) {
147 _M_move_src(src.get());
148# else
149 : _M_end_of_storage(src.get()._M_end_of_storage), _M_finish(src.get()._M_finish),
150 _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) {
151 src.get()._M_start_of_storage._M_data = 0;
152# endif
153 }
_Value _M_data
Definition: _alloc.h:478
GLenum src
Definition: glext.h:6340

◆ ~_String_base()

template<class _Tp , class _Alloc >
_String_base< _Tp, _Alloc >::~_String_base ( )
inlineprotected

Definition at line 156 of file _string_base.h.

void _M_deallocate_block()
Definition: _string_base.h:94

Member Function Documentation

◆ _M_allocate_block()

template<class _Tp , class _Alloc >
void _String_base< _Tp, _Alloc >::_M_allocate_block ( size_t  __n = _DEFAULT_SIZE)
protected

Definition at line 607 of file _string.c.

607 {
608 if ((__n <= (max_size() + 1)) && (__n > 0)) {
609#if defined (_STLP_USE_SHORT_STRING_OPTIM)
610 if (__n > _DEFAULT_SIZE) {
613 this->_M_buffers._M_end_of_storage = this->_M_start_of_storage._M_data + __n;
614 }
615#else
619#endif
620 } else {
621 this->_M_throw_length_error();
622 }
623}
_Tp * allocate(size_type __n, size_type &__allocated_n)
Definition: _alloc.h:525
size_t max_size() const
Definition: _string_base.h:104
void _STLP_FUNCTION_THROWS _M_throw_length_error() const
Definition: _string.c:599

Referenced by _String_base< _Tp, _Alloc >::_String_base().

◆ _M_capacity()

template<class _Tp , class _Alloc >
size_type _String_base< _Tp, _Alloc >::_M_capacity ( ) const
inlineprotected

Definition at line 80 of file _string_base.h.

◆ _M_deallocate_block()

template<class _Tp , class _Alloc >
void _String_base< _Tp, _Alloc >::_M_deallocate_block ( )
inlineprotected

Definition at line 94 of file _string_base.h.

94 {
95#if defined (_STLP_USE_SHORT_STRING_OPTIM)
96 if (!_M_using_static_buf() && (_M_start_of_storage._M_data != 0))
97 _M_start_of_storage.deallocate(_M_start_of_storage._M_data, _M_buffers._M_end_of_storage - _M_start_of_storage._M_data);
98#else
101#endif /* _STLP_USE_SHORT_STRING_OPTIM */
102 }

Referenced by _String_base< _Tp, _Alloc >::~_String_base().

◆ _M_End() [1/2]

template<class _Tp , class _Alloc >
_Tp * _String_base< _Tp, _Alloc >::_M_End ( )
inlineprotected

Definition at line 79 of file _string_base.h.

79{ return _M_end_of_storage; }

◆ _M_End() [2/2]

template<class _Tp , class _Alloc >
_Tp const * _String_base< _Tp, _Alloc >::_M_End ( ) const
inlineprotected

Definition at line 78 of file _string_base.h.

78{ return _M_end_of_storage; }

◆ _M_Finish() [1/2]

template<class _Tp , class _Alloc >
_Tp * _String_base< _Tp, _Alloc >::_M_Finish ( )
inlineprotected

Definition at line 90 of file _string_base.h.

90{return _M_finish;}

◆ _M_Finish() [2/2]

template<class _Tp , class _Alloc >
_Tp const * _String_base< _Tp, _Alloc >::_M_Finish ( ) const
inlineprotected

Definition at line 89 of file _string_base.h.

89{return _M_finish;}

◆ _M_reset()

template<class _Tp , class _Alloc >
void _String_base< _Tp, _Alloc >::_M_reset ( _Tp *  __start,
_Tp *  __finish,
_Tp *  __end_of_storage 
)
inlineprotected

Definition at line 158 of file _string_base.h.

158 {
159#if defined (_STLP_USE_SHORT_STRING_OPTIM)
160 _M_buffers._M_end_of_storage = __end_of_storage;
161#else
162 _M_end_of_storage = __end_of_storage;
163#endif
164 _M_finish = __finish;
166 }

◆ _M_rest()

template<class _Tp , class _Alloc >
size_type _String_base< _Tp, _Alloc >::_M_rest ( ) const
inlineprotected

Definition at line 82 of file _string_base.h.

83 { return _M_end_of_storage - _M_finish; }

◆ _M_Start() [1/2]

template<class _Tp , class _Alloc >
_Tp * _String_base< _Tp, _Alloc >::_M_Start ( )
inlineprotected

Definition at line 77 of file _string_base.h.

◆ _M_Start() [2/2]

template<class _Tp , class _Alloc >
_Tp const * _String_base< _Tp, _Alloc >::_M_Start ( ) const
inlineprotected

Definition at line 76 of file _string_base.h.

◆ _M_swap()

template<class _Tp , class _Alloc >
void _String_base< _Tp, _Alloc >::_M_swap ( _Self __s)
inlineprotected

Definition at line 168 of file _string_base.h.

168 {
169#if defined (_STLP_USE_SHORT_STRING_OPTIM)
170 if (_M_using_static_buf()) {
171 if (__s._M_using_static_buf()) {
172 _STLP_STD::swap(_M_buffers, __s._M_buffers);
173 _Tp *__tmp = _M_finish;
174 _M_finish = _M_start_of_storage._M_data + (__s._M_finish - __s._M_start_of_storage._M_data);
175 __s._M_finish = __s._M_buffers._M_static_buf + (__tmp - _M_start_of_storage._M_data);
176 //We need to swap _M_start_of_storage for allocators with state:
177 _M_start_of_storage.swap(__s._M_start_of_storage);
178 _M_start_of_storage._M_data = _M_buffers._M_static_buf;
179 __s._M_start_of_storage._M_data = __s._M_buffers._M_static_buf;
180 } else {
181 __s._M_swap(*this);
182 return;
183 }
184 }
185 else if (__s._M_using_static_buf()) {
186 _Tp *__tmp = _M_start_of_storage._M_data;
187 _Tp *__tmp_finish = _M_finish;
188 _Tp *__tmp_end_data = _M_buffers._M_end_of_storage;
189 _M_buffers = __s._M_buffers;
190 //We need to swap _M_start_of_storage for allocators with state:
191 _M_start_of_storage.swap(__s._M_start_of_storage);
192 _M_start_of_storage._M_data = _M_buffers._M_static_buf;
193 _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf);
194 __s._M_buffers._M_end_of_storage = __tmp_end_data;
195 __s._M_start_of_storage._M_data = __tmp;
196 __s._M_finish = __tmp_finish;
197 }
198 else {
199 _STLP_STD::swap(_M_buffers._M_end_of_storage, __s._M_buffers._M_end_of_storage);
200 _M_start_of_storage.swap(__s._M_start_of_storage);
201 _STLP_STD::swap(_M_finish, __s._M_finish);
202 }
203#else
204 _STLP_STD::swap(_M_end_of_storage, __s._M_end_of_storage);
205 _M_start_of_storage.swap(__s._M_start_of_storage);
206 _STLP_STD::swap(_M_finish, __s._M_finish);
207#endif
208 }
void swap(_Self &__x)
Definition: _alloc.h:520

Referenced by _String_base< _Tp, _Alloc >::_M_swap().

◆ _M_throw_length_error()

Definition at line 599 of file _string.c.

600{ __stl_throw_length_error("basic_string"); }
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_length_error(const char *__msg)
Definition: _range_errors.c:72

◆ _M_throw_out_of_range()

template<class _Tp , class _Alloc >
void _String_base< _Tp, _Alloc >::_M_throw_out_of_range
protected

Definition at line 603 of file _string.c.

604{ __stl_throw_out_of_range("basic_string"); }
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_out_of_range(const char *__msg)
Definition: _range_errors.c:69

◆ max_size()

template<class _Tp , class _Alloc >
size_t _String_base< _Tp, _Alloc >::max_size ( ) const
inlineprotected

Definition at line 104 of file _string_base.h.

104 {
105 const size_type __string_max_size = size_type(-1) / sizeof(_Tp);
106 typename allocator_type::size_type __alloc_max_size = _M_start_of_storage.max_size();
107 return (min)(__alloc_max_size, __string_max_size) - 1;
108 }
size_t size_type
Definition: _string_base.h:51
#define min(a, b)
Definition: monoChain.cc:55

Member Data Documentation

◆ _M_end_of_storage

◆ _M_finish

◆ _M_start_of_storage


The documentation for this class was generated from the following files: