19#ifndef _STLP_SSTREAM_C
20#define _STLP_SSTREAM_C
22#ifndef _STLP_INTERNAL_SSTREAM
26#if defined ( _STLP_NESTED_TYPE_PARAM_BUG )
28# define __BSB_int_type__ int
29# define __BSB_pos_type__ streampos
31# define __BSB_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::int_type
32# define __BSB_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type
43template <
class _CharT,
class _Traits,
class _Alloc>
49template <
class _CharT,
class _Traits,
class _Alloc>
57template <
class _CharT,
class _Traits,
class _Alloc>
62template <
class _CharT,
class _Traits,
class _Alloc>
70template <
class _CharT,
class _Traits,
class _Alloc>
74 _CharT* __data_ptr = _S_start(_M_str);
75 _CharT* __data_end = _S_finish(_M_str);
77 if (_M_mode & ios_base::in) {
78 this->setg(__data_ptr, (_M_mode & ios_base::ate) ? __data_end : __data_ptr, __data_end);
82 if (_M_mode & ios_base::out) {
83 if ( _M_mode & (ios_base::app | ios_base::ate) ) {
84 this->setp( __data_end, __data_end );
86 this->setp( __data_ptr, __data_end );
87 this->pbump((
int)_M_str.size());
94template <
class _CharT,
class _Traits,
class _Alloc>
97 return this->gptr() != this->egptr()
98 ? _Traits::to_int_type(*this->gptr())
103template <
class _CharT,
class _Traits,
class _Alloc>
106 if (this->gptr() != this->egptr()) {
107 int_type __c = _Traits::to_int_type(*this->gptr());
112 return _Traits::eof();
115template <
class _CharT,
class _Traits,
class _Alloc>
118 if (this->gptr() != this->eback()) {
119 if (!_Traits::eq_int_type(
__c, _Traits::eof())) {
120 if (_Traits::eq(_Traits::to_char_type(
__c), this->gptr()[-1])) {
124 else if (_M_mode & ios_base::out) {
126 *this->gptr() = _Traits::to_char_type(
__c);
130 return _Traits::eof();
134 return _Traits::not_eof(
__c);
138 return _Traits::eof();
141template <
class _CharT,
class _Traits,
class _Alloc>
144 if (!_Traits::eq_int_type(
__c, _Traits::eof())) {
145 if (_M_mode & ios_base::out) {
146 if ( this->pptr() < this->epptr() ) {
147 _M_str.push_back( _Traits::to_char_type(
__c) );
149 }
else if ( _M_mode & ios_base::in ) {
150 ptrdiff_t __offset = this->gptr() - this->eback();
151 _M_str.push_back(_Traits::to_char_type(
__c));
152 _CharT* __data_ptr = _S_start(_M_str);
153 this->setg(__data_ptr, __data_ptr + __offset, _S_finish(_M_str));
154 this->setp(__data_ptr, _S_finish(_M_str));
155 this->pbump((
int)_M_str.size());
157 _M_str.push_back( _Traits::to_char_type(
__c) );
158 this->setp(_S_start(_M_str), _S_finish(_M_str));
159 this->pbump((
int)_M_str.size());
163 return _Traits::eof();
165 return _Traits::not_eof(
__c);
168template <
class _CharT,
class _Traits,
class _Alloc>
174 if ((_M_mode & ios_base::out) &&
__n > 0) {
177 if ( !_M_str.empty() && this->pbase() == _S_start(_M_str)) {
178 ptrdiff_t __avail = _S_finish(_M_str) - this->pptr();
181 this->pbump((
int)
__n);
184 _Traits::copy(this->pptr(), __s, __avail);
185 __nwritten += __avail;
193 if (_M_mode & ios_base::in) {
194 ptrdiff_t __get_offset = this->gptr() - this->eback();
196 __data_ptr = _S_start(_M_str);
197 this->setg(__data_ptr, __data_ptr + __get_offset, _S_finish(_M_str));
200 __data_ptr = _S_start(_M_str);
203 this->setp(__data_ptr, _S_finish(_M_str));
204 this->pbump((
int)_M_str.size());
211template <
class _CharT,
class _Traits,
class _Alloc>
217 if ((_M_mode & ios_base::out) &&
__n > 0) {
220 if (this->pbase() == _S_start(_M_str)) {
221 ptrdiff_t __avail = _S_finish(_M_str) - this->pptr();
228 _Traits::assign(this->pptr(), __avail,
__c);
229 __nwritten += __avail;
238 if (this->_M_mode & ios_base::in) {
239 ptrdiff_t __get_offset = this->gptr() - this->eback();
240 _M_str.append(__app_size,
__c);
241 __data_ptr = _S_start(_M_str);
242 this->setg(__data_ptr, __data_ptr + __get_offset, _S_finish(_M_str));
244 _M_str.append(__app_size,
__c);
245 __data_ptr = _S_start(_M_str);
248 this->setp(__data_ptr, _S_finish(_M_str));
249 this->pbump((
int)_M_str.size());
250 __nwritten += __app_size;
260template <
class _CharT,
class _Traits,
class _Alloc>
264 bool __do_get_area =
false;
265 bool __do_put_area =
false;
269 if (this->pbase() == _S_start(_M_str)) {
270 __do_put_area =
true;
271 __offp = this->pptr() - this->pbase();
274 if (this->eback() == _S_start(_M_str)) {
275 __do_get_area =
true;
276 __offg = this->gptr() - this->eback();
282 _CharT* __data_ptr = _S_start(_M_str);
285 this->setg(__data_ptr, __data_ptr + __offg, _S_finish(_M_str));
289 this->setp(__data_ptr, _S_finish(_M_str));
290 this->pbump((
int)__offp);
297template <
class _CharT,
class _Traits,
class _Alloc>
305 bool __imode = (__mode & ios_base::in) != 0;
306 bool __omode = (__mode & ios_base::out) != 0;
308 if ( !(__imode || __omode) )
311 if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
320 __newoff = _M_str.size();
323 __newoff = __imode ? this->gptr() - this->eback() : this->pptr() - this->pbase();
337 if (__off < 0 || __off >
__n)
346 if (__off < 0 || __off >
__n)
348 this->setp(this->pbase(), this->pbase() +
__n);
349 this->pbump((
int)__off);
355template <
class _CharT,
class _Traits,
class _Alloc>
361 bool __imode = (__mode & ios_base::in) != 0;
362 bool __omode = (__mode & ios_base::out) != 0;
364 if ( !(__imode || __omode) )
367 if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) )
373 if (__n < 0 || __n > this->egptr() - this->eback())
379 if (
__n < 0 ||
size_t(
__n) > _M_str.size())
382 this->setp(_S_start(_M_str), _S_finish(_M_str));
383 this->pbump((
int)
__n);
392template <
class _CharT,
class _Traits,
class _Alloc>
400template <
class _CharT,
class _Traits,
class _Alloc>
408template <
class _CharT,
class _Traits,
class _Alloc>
415template <
class _CharT,
class _Traits,
class _Alloc>
423template <
class _CharT,
class _Traits,
class _Alloc>
431template <
class _CharT,
class _Traits,
class _Alloc>
438template <
class _CharT,
class _Traits,
class _Alloc>
445template <
class _CharT,
class _Traits,
class _Alloc>
452template <
class _CharT,
class _Traits,
class _Alloc>
458# undef __BSB_int_type__
459# undef __BSB_pos_type__
basic_stringbuf< _CharT, _Traits, _Alloc > _M_buf
basic_stringbuf< _CharT, _Traits, _Alloc > _M_buf
virtual _Base * setbuf(_CharT *__buf, streamsize __n)
virtual streamsize _M_xsputnc(char_type __c, streamsize __n)
_Traits::pos_type pos_type
virtual int_type underflow()
_Traits::int_type int_type
_Traits::off_type off_type
virtual ~basic_stringbuf()
virtual streamsize xsputn(const char_type *__s, streamsize __n)
basic_stringbuf< _CharT, _Traits, _Alloc > _M_buf
__kernel_ptrdiff_t ptrdiff_t
#define __STATIC_CAST(__x, __y)
#define _STLP_BEGIN_NAMESPACE
#define _STLP_END_NAMESPACE