STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
strstreambuf Class Reference
Inheritance diagram for strstreambuf:
basic_streambuf< _Elem, _Traits >

Public Types

enum  { _Allocated = 1, _Constant = 2, _Dynamic = 4, _Frozen = 8 }
 
typedef strstreambuf _Myt
 
typedef streambuf _Mysb
 
typedef int _Strstate
 
- Public Types inherited from basic_streambuf< _Elem, _Traits >
typedef _Elem char_type
 
typedef _Traits traits_type
 
typedef _Traits::int_type int_type
 
typedef _Traits::pos_type pos_type
 
typedef _Traits::off_type off_type
 

Public Member Functions

__CLR_OR_THIS_CALL strstreambuf (streamsize _Count=0)
 
__CLR_OR_THIS_CALL strstreambuf (void *(__CLRCALL_OR_CDECL *_Allocfunc)(size_t), void(__CLRCALL_OR_CDECL *_Freefunc)(void *))
 
__CLR_OR_THIS_CALL strstreambuf (_In_opt_z_ char *_Getptr, streamsize _Count, _In_opt_z_ char *_Putptr=0)
 
__CLR_OR_THIS_CALL strstreambuf (_In_z_ const char *_Getptr, streamsize _Count)
 
__CLR_OR_THIS_CALL strstreambuf (_In_opt_z_ unsigned char *_Getptr, streamsize _Count, _In_opt_z_ unsigned char *_Putptr=0)
 
__CLR_OR_THIS_CALL strstreambuf (_In_opt_z_ const unsigned char *_Getptr, streamsize _Count)
 
__CLR_OR_THIS_CALL strstreambuf (_Myt &&_Right)
 
_Myt &__CLR_OR_THIS_CALL operator= (_Myt &&_Right)
 
void __CLR_OR_THIS_CALL _Assign_rv (_Myt &&_Right)
 
void __CLR_OR_THIS_CALL swap (_Myt &_Right)
 
virtual __CLR_OR_THIS_CALL ~strstreambuf () _NOEXCEPT
 
void __CLR_OR_THIS_CALL freeze (bool _Freezeit=true)
 
char *__CLR_OR_THIS_CALL str ()
 
streamsize __CLR_OR_THIS_CALL pcount () const
 
__CLR_OR_THIS_CALL strstreambuf (_In_opt_z_ signed char *_Getptr, streamsize _Count, _In_opt_z_ signed char *_Putptr=0)
 
__CLR_OR_THIS_CALL strstreambuf (const signed char *_Getptr, streamsize _Count)
 
void clear ()
 
- Public Member Functions inherited from basic_streambuf< _Elem, _Traits >
virtual __CLR_OR_THIS_CALL ~basic_streambuf () _NOEXCEPT
 
pos_type __CLR_OR_THIS_CALL pubseekoff (off_type _Off, ios_base::seekdir _Way, ios_base::openmode _Mode=ios_base::in|ios_base::out)
 
pos_type __CLR_OR_THIS_CALL pubseekpos (pos_type _Pos, ios_base::openmode _Mode=ios_base::in|ios_base::out)
 
_Myt *__CLR_OR_THIS_CALL pubsetbuf (_Elem *_Buffer, streamsize _Count)
 
locale __CLR_OR_THIS_CALL pubimbue (const locale &_Newlocale)
 
locale __CLR_OR_THIS_CALL getloc () const
 
streamsize __CLR_OR_THIS_CALL in_avail ()
 
int __CLR_OR_THIS_CALL pubsync ()
 
int_type __CLR_OR_THIS_CALL sbumpc ()
 
int_type __CLR_OR_THIS_CALL sgetc ()
 
streamsize __CLR_OR_THIS_CALL sgetn (_Elem *_Ptr, streamsize _Count)
 
int_type __CLR_OR_THIS_CALL snextc ()
 
int_type __CLR_OR_THIS_CALL sputbackc (_Elem _Ch)
 
int_type __CLR_OR_THIS_CALL sungetc ()
 
int_type __CLR_OR_THIS_CALL sputc (_Elem _Ch)
 
streamsize __CLR_OR_THIS_CALL sputn (const _Elem *_Ptr, streamsize _Count)
 
virtual void __CLR_OR_THIS_CALL _Lock ()
 
virtual void __CLR_OR_THIS_CALL _Unlock ()
 

Protected Member Functions

virtual int __CLR_OR_THIS_CALL overflow (int _Meta=EOF)
 
virtual int __CLR_OR_THIS_CALL pbackfail (int _Meta=EOF)
 
virtual int __CLR_OR_THIS_CALL underflow ()
 
virtual streampos __CLR_OR_THIS_CALL seekoff (streamoff _Off_arg, ios_base::seekdir _Way, ios_base::openmode _Which=ios_base::in|ios_base::out)
 
virtual streampos __CLR_OR_THIS_CALL seekpos (streampos _Sp, ios_base::openmode _Which=ios_base::in|ios_base::out)
 
void __CLR_OR_THIS_CALL _Init (streamsize _Count=0, char *_Gp=0, char *_Pp=0, _Strstate _Mode=(_Strstate) 0)
 
void __CLR_OR_THIS_CALL _Tidy ()
 
- Protected Member Functions inherited from basic_streambuf< _Elem, _Traits >
__CLR_OR_THIS_CALL basic_streambuf ()
 
__CLR_OR_THIS_CALL basic_streambuf (_Uninitialized)
 
__CLR_OR_THIS_CALL basic_streambuf (const _Myt &_Right)
 
_Myt &__CLR_OR_THIS_CALL operator= (const _Myt &_Right)
 
void __CLR_OR_THIS_CALL swap (_Myt &_Right)
 
_Elem *__CLR_OR_THIS_CALL eback () const
 
_Elem *__CLR_OR_THIS_CALL gptr () const
 
_Elem *__CLR_OR_THIS_CALL pbase () const
 
_Elem *__CLR_OR_THIS_CALL pptr () const
 
_Elem *__CLR_OR_THIS_CALL egptr () const
 
void __CLR_OR_THIS_CALL gbump (int _Off)
 
void __CLR_OR_THIS_CALL setg (_Elem *_First, _Elem *_Next, _Elem *_Last)
 
_Elem *__CLR_OR_THIS_CALL epptr () const
 
_Elem *__CLR_OR_THIS_CALL _Gndec ()
 
_Elem *__CLR_OR_THIS_CALL _Gninc ()
 
_Elem *__CLR_OR_THIS_CALL _Gnpreinc ()
 
streamsize __CLR_OR_THIS_CALL _Gnavail () const
 
void __CLR_OR_THIS_CALL pbump (int _Off)
 
void __CLR_OR_THIS_CALL setp (_Elem *_First, _Elem *_Last)
 
void __CLR_OR_THIS_CALL setp (_Elem *_First, _Elem *_Next, _Elem *_Last)
 
_Elem *__CLR_OR_THIS_CALL _Pninc ()
 
streamsize __CLR_OR_THIS_CALL _Pnavail () const
 
void __CLR_OR_THIS_CALL _Init ()
 
void __CLR_OR_THIS_CALL _Init (_Elem **_Gf, _Elem **_Gn, int *_Gc, _Elem **_Pf, _Elem **_Pn, int *_Pc)
 
virtual int_type __CLR_OR_THIS_CALL overflow (int_type=_Traits::eof())
 
virtual int_type __CLR_OR_THIS_CALL pbackfail (int_type=_Traits::eof())
 
virtual streamsize __CLR_OR_THIS_CALL showmanyc ()
 
virtual int_type __CLR_OR_THIS_CALL uflow ()
 
virtual streamsize __CLR_OR_THIS_CALL xsgetn (_Elem *_Ptr, streamsize _Count)
 
virtual streamsize __CLR_OR_THIS_CALL xsputn (const _Elem *_Ptr, streamsize _Count)
 
virtual pos_type __CLR_OR_THIS_CALL seekoff (off_type, ios_base::seekdir, ios_base::openmode=ios_base::in|ios_base::out)
 
virtual pos_type __CLR_OR_THIS_CALL seekpos (pos_type, ios_base::openmode=ios_base::in|ios_base::out)
 
virtual _Myt *__CLR_OR_THIS_CALL setbuf (_Elem *, streamsize)
 
virtual int __CLR_OR_THIS_CALL sync ()
 
virtual void __CLR_OR_THIS_CALL imbue (const locale &)
 

Private Types

enum  { _MINSIZE = 32 }
 

Private Member Functions

void *__CLRCALL_OR_CDECL_Palloc (size_t)
 
 void (__CLRCALL_OR_CDECL *_Pfree)(void *)
 

Private Attributes

int _Minsize
 
char_Pendsave
 
char_Seekhigh
 
_Strstate _Strmode
 

Additional Inherited Members

- Protected Attributes inherited from basic_streambuf< _Elem, _Traits >
locale_Plocale
 

Member Typedef Documentation

Member Enumeration Documentation

anonymous enum
Enumerator
_Allocated 
_Constant 
_Dynamic 
_Frozen 
23  { // constants for bits in stream state
24  _Allocated = 1, // set if character array storage has been allocated
25  _Constant = 2, // set if character array nonmutable
26  _Dynamic = 4, // set if character array length grows on demand
27  _Frozen = 8}; // set if character array ownership given away
Definition: strstream:25
Definition: strstream:26
Definition: strstream:27
Definition: strstream:24
anonymous enum
private
Enumerator
_MINSIZE 
379  { // constant for default minimum buffer size
380  _MINSIZE = 32};
Definition: strstream:380

Constructor & Destructor Documentation

__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( streamsize  _Count = 0)
inlineexplicit
31  { // construct with empty character array, suggested initial size
32  _Init(_Count);
33  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( void __CLRCALL_OR_CDECL *_Allocfunc)(size_t,
void(__CLRCALL_OR_CDECL *_Freefunc)(void *)   
)
inline
37  { // construct with empty character array, allocation functions
38  _Init();
39  _Palloc = _Allocfunc;
40  _Pfree = _Freefunc;
41  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _In_opt_z_ char _Getptr,
streamsize  _Count,
_In_opt_z_ char _Putptr = 0 
)
inline
46  { // construct with [_Getptr, _Getptr + _Count), possibly mutable
47  _Init(_Count, _Getptr, _Putptr);
48  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _In_z_ const char _Getptr,
streamsize  _Count 
)
inline
52  { // construct with [_Getptr, _Getptr + _Count), nonmutable
53  _Init(_Count, (char *)_Getptr, 0, _Constant);
54  }
Definition: strstream:25
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _In_opt_z_ unsigned char _Getptr,
streamsize  _Count,
_In_opt_z_ unsigned char _Putptr = 0 
)
inline
59  { // construct with [_Getptr, _Getptr + _Count), possibly mutable
60  _Init(_Count, (char *)_Getptr, (char *)_Putptr);
61  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _In_opt_z_ const unsigned char _Getptr,
streamsize  _Count 
)
inline
65  { // construct with [_Getptr, _Getptr + _Count), nonmutable
66  _Init(_Count, (char *)_Getptr, 0, _Constant);
67  }
Definition: strstream:25
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _Myt &&  _Right)
inline
70  { // construct by moving _Right
71  _Init();
73  }
void __CLR_OR_THIS_CALL _Assign_rv(_Myt &&_Right)
Definition: strstream:81
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
constexpr const _Ty &() _Right
Definition: algorithm:3723
virtual __CLR_OR_THIS_CALL strstreambuf::~strstreambuf ( )
inlinevirtual
105  { // destroy a strstreambuf
106  _Tidy();
107  }
void __CLR_OR_THIS_CALL _Tidy()
Definition: strstream:364
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _In_opt_z_ signed char _Getptr,
streamsize  _Count,
_In_opt_z_ signed char _Putptr = 0 
)
inline
138  { // construct with [_Getptr, _Getptr + _Count), possibly mutable
139  _Init(_Count, (char *)_Getptr, (char *)_Putptr);
140  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( const signed char _Getptr,
streamsize  _Count 
)
inline
144  { // construct with [_Getptr, _Getptr + _Count), nonmutable
145  _Init(_Count, (char *)_Getptr, 0, _Constant);
146  }
Definition: strstream:25
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
_Diff _Count
Definition: algorithm:1941

Member Function Documentation

void __CLR_OR_THIS_CALL strstreambuf::_Assign_rv ( _Myt &&  _Right)
inline
82  { // assign by moving _Right
83  if (this != _STD addressof(_Right))
84  { // different, worth moving
85  _Tidy();
86  this->swap(_Right);
87  }
88  }
void __CLR_OR_THIS_CALL _Tidy()
Definition: strstream:364
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
void __CLR_OR_THIS_CALL swap(_Myt &_Right)
Definition: strstream:90
constexpr const _Ty &() _Right
Definition: algorithm:3723
void __CLR_OR_THIS_CALL strstreambuf::_Init ( streamsize  _Count = 0,
char _Gp = 0,
char _Pp = 0,
_Strstate  _Mode = (_Strstate)0 
)
inlineprotected
328  { // initialize with possibly static buffer
330  _Minsize = _MINSIZE;
331  _Pendsave = 0;
332  _Seekhigh = 0;
333  _Palloc = 0;
334  _Pfree = 0;
335  _Strmode = _Mode;
336 
337  if (_Gp == 0)
338  { // make dynamic
339  _Strmode |= _Dynamic;
340  if (_Minsize < _Count)
341  _Minsize = (int)_Count;
342  }
343  else
344  { // make static
345  size_t _Size = _Count < 0 ? INT_MAX
346  : _Count == 0 ? _CSTD strlen(_Gp)
347  : (size_t)_Count;
348  _Seekhigh = _Gp + _Size;
349 
350  if (_Pp == 0)
351  setg(_Gp, _Gp, _Gp + _Size); // set read pointers only
352  else
353  { // make writable too
354  if (_Pp < _Gp)
355  _Pp = _Gp;
356  else if (_Gp + _Size < _Pp)
357  _Pp = _Gp + _Size;
358  setp(_Pp, _Gp + _Size);
359  setg(_Gp, _Gp, _Pp);
360  }
361  }
362  }
void __CLR_OR_THIS_CALL setg(_Elem *_First, _Elem *_Next, _Elem *_Last)
Definition: streambuf:250
unsigned int size_t
Definition: sourceannotations.h:19
int _Minsize
Definition: strstream:382
_Strstate _Strmode
Definition: strstream:385
char * _Pendsave
Definition: strstream:383
_Check_return_ size_t __cdecl strlen(_In_z_ char const *_Str)
_CRT_BEGIN_C_HEADER _Check_return_ _Ret_maybenull_ _In_ size_t _Size
Definition: corecrt_malloc.h:58
Definition: strstream:26
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:291
char * _Seekhigh
Definition: strstream:384
_Check_return_ _In_z_ wchar_t const * _Mode
Definition: corecrt_wstdio.h:133
char int *typedef int(__CRTDECL *_CRT_REPORT_HOOKW)(int
Definition: crtdbg.h:45
Definition: strstream:380
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:316
_Diff _Count
Definition: algorithm:1941
#define _CSTD
Definition: yvals.h:570
#define INT_MAX
Definition: limits.h:35
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
void* __CLRCALL_OR_CDECL* strstreambuf::_Palloc ( size_t  )
private
void __CLR_OR_THIS_CALL strstreambuf::_Tidy ( )
inlineprotected
365  { // free any allocated storage
366  if ((_Strmode & (_Allocated | _Frozen)) != _Allocated)
367  ; // no buffer to free
368  else if (_Pfree != 0)
369  (*_Pfree)(eback()); // free with function call
370  else
371  _CSTD free(eback()); // free by deleting array
372 
373  _Seekhigh = 0;
374  _Strmode &= ~(_Allocated | _Frozen);
375  }
_ACRTIMP void __cdecl free(_Pre_maybenull_ _Post_invalid_ void *_Block)
_Strstate _Strmode
Definition: strstream:385
char * _Seekhigh
Definition: strstream:384
#define _CSTD
Definition: yvals.h:570
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:219
Definition: strstream:27
Definition: strstream:24
void strstreambuf::clear ( )
inline
149  { // free any allocated storage
150  _Tidy();
151  }
void __CLR_OR_THIS_CALL _Tidy()
Definition: strstream:364
void __CLR_OR_THIS_CALL strstreambuf::freeze ( bool  _Freezeit = true)
inline
110  { // freeze or unfreeze writing
111  if (_Freezeit && !(_Strmode & _Frozen))
112  { // disable writing
113  _Strmode |= _Frozen;
114  _Pendsave = epptr();
115  setp(pbase(), pptr(), eback());
116  }
117  else if (!_Freezeit && _Strmode & _Frozen)
118  { // re-enable writing
119  _Strmode &= ~_Frozen;
120  setp(pbase(), pptr(), _Pendsave);
121  }
122  }
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:257
_Strstate _Strmode
Definition: strstream:385
char * _Pendsave
Definition: strstream:383
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:234
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:291
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:229
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:219
Definition: strstream:27
_Myt& __CLR_OR_THIS_CALL strstreambuf::operator= ( _Myt &&  _Right)
inline
76  { // assign by moving _Right
78  return (*this);
79  }
void __CLR_OR_THIS_CALL _Assign_rv(_Myt &&_Right)
Definition: strstream:81
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
constexpr const _Ty &() _Right
Definition: algorithm:3723
virtual int __CLR_OR_THIS_CALL strstreambuf::overflow ( int  _Meta = EOF)
inlineprotectedvirtual
155  { // try to extend write area
156  if (_Meta == EOF)
157  return (0); // nothing to write
158  else if (pptr() != 0 && pptr() < epptr())
159  return ((unsigned char)(*_Pninc() = (char)_Meta));
160  else if (!(_Strmode & _Dynamic)
161  || _Strmode & (_Constant | _Frozen))
162  return (EOF); // can't extend
163  else
164  { // okay to extend
165  int _Oldsize = gptr() == 0 ? 0 : (int)(epptr() - eback());
166  int _Newsize = _Oldsize;
167  int _Inc = _Newsize / 2 < _Minsize
168  ? _Minsize : _Newsize / 2; // grow by 50 per cent if possible
169  _Minsize = _MINSIZE; // back to default for future growth
170  char *_Ptr = 0;
171 
172  while (0 < _Inc && INT_MAX - _Inc < _Newsize)
173  _Inc /= 2; // reduce growth increment if too big
174  if (0 < _Inc)
175  { // room to grow, increase size
176  _Newsize += _Inc;
177 
178  _Ptr = _Palloc != 0 ? (char *)(*_Palloc)(_Newsize)
179  : (char *)_malloc_dbg(_Newsize, _CRT_BLOCK,
180  __FILE__, __LINE__);
181  }
182  if (_Ptr == 0)
183  return (EOF); // couldn't grow, return failure
184 
185  if (0 < _Oldsize)
186  _CSTD memcpy(_Ptr, eback(), _Oldsize); // copy existing
187  if (!(_Strmode & _Allocated))
188  ; // no buffer to free
189  else if (_Pfree != 0)
190  (*_Pfree)(eback()); // free with function call
191  else
192  _CSTD free(eback()); // free by deleting array
193  _Strmode |= _Allocated;
194  if (_Oldsize == 0)
195  { // set up new buffer
196  _Seekhigh = _Ptr;
197  setp(_Ptr, _Ptr + _Newsize);
198  setg(_Ptr, _Ptr, _Ptr);
199  }
200  else
201  { // revise old pointers
202  _Seekhigh = _Seekhigh - eback() + _Ptr;
203  setp(pbase() - eback() + _Ptr, pptr() - eback() + _Ptr,
204  _Ptr + _Newsize);
205  setg(_Ptr, gptr() - eback() + _Ptr, pptr() + 1);
206  }
207 
208  return ((unsigned char)(*_Pninc() = (char)_Meta));
209  }
210  }
void __CLR_OR_THIS_CALL setg(_Elem *_First, _Elem *_Next, _Elem *_Last)
Definition: streambuf:250
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:224
_ACRTIMP void __cdecl free(_Pre_maybenull_ _Post_invalid_ void *_Block)
int _Minsize
Definition: strstream:382
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:257
_Strstate _Strmode
Definition: strstream:385
Definition: strstream:25
#define EOF
Definition: stdio.h:36
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:234
Definition: strstream:26
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:291
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:229
char * _Seekhigh
Definition: strstream:384
char int *typedef int(__CRTDECL *_CRT_REPORT_HOOKW)(int
Definition: crtdbg.h:45
#define _CRT_BLOCK
Definition: crtdbg.h:95
memcpy(_Destination, _Source, _SourceSize)
Definition: strstream:380
_Elem *__CLR_OR_THIS_CALL _Pninc()
Definition: streambuf:305
#define _CSTD
Definition: yvals.h:570
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:219
#define _malloc_dbg(s, t, f, l)
Definition: crtdbg.h:247
#define INT_MAX
Definition: limits.h:35
Definition: strstream:27
Definition: strstream:24
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
virtual int __CLR_OR_THIS_CALL strstreambuf::pbackfail ( int  _Meta = EOF)
inlineprotectedvirtual
213  { // try to putback a character
214  if (gptr() == 0 || gptr() <= eback() || (_Meta != EOF
215  && (unsigned char)_Meta != (unsigned char)gptr()[-1]
216  && _Strmode & _Constant))
217  return (EOF); // can't put it back
218  else
219  { // safe to back up
220  gbump(-1);
221  if (_Meta != EOF && *gptr() != (char)_Meta)
222  *gptr() = (char)_Meta;
223  return (_Meta == EOF ? 0 : (unsigned char)_Meta);
224  }
225  }
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:224
_Strstate _Strmode
Definition: strstream:385
Definition: strstream:25
#define EOF
Definition: stdio.h:36
unsigned char
Definition: mbstring.h:107
void __CLR_OR_THIS_CALL gbump(int _Off)
Definition: streambuf:244
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:219
streamsize __CLR_OR_THIS_CALL strstreambuf::pcount ( ) const
inline
131  { // return size of writable character array
132  return (pptr() == 0 ? 0 : (streamsize)(pptr() - pbase()));
133  }
long long streamsize
Definition: iosfwd:23
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:234
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:229
virtual streampos __CLR_OR_THIS_CALL strstreambuf::seekoff ( streamoff  _Off_arg,
ios_base::seekdir  _Way,
ios_base::openmode  _Which = ios_base::in | ios_base::out 
)
inlineprotectedvirtual
248  { // seek by specified offset
249  int _Off = (int)_Off_arg;
250 
251  if (pptr() != 0 && (int)(_Seekhigh - pptr()) < 0) // sic
252  _Seekhigh = pptr(); // update high water mark
253 
254  if (_Which & ios_base::in && gptr() != 0)
255  { // set input (and maybe output) pointer
256  if (_Way == ios_base::end)
257  _Off += (int)(_Seekhigh - eback()); // seek from end
258  else if (_Way == ios_base::cur
259  && !(_Which & ios_base::out))
260  _Off += (int)(gptr() - eback()); // seek from current
261  else if (_Way != ios_base::beg || _Off == (int)_BADOFF)
262  _Off = (int)_BADOFF; // invalid seek
263  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
264  { // seek from beginning, set one or two pointers
265  gbump(_Off - (int)(gptr() - eback()));
266  if (_Which & ios_base::out && pptr() != 0)
267  setp(pbase(), gptr(), epptr());
268  }
269  else
270  _Off = (int)_BADOFF; // invalid seek from beginning
271  }
272  else if (_Which & ios_base::out && pptr() != 0)
273  { // set only output pointer
274  if (_Way == ios_base::end)
275  _Off += (int)(_Seekhigh - eback()); // seek from end
276  else if (_Way == ios_base::cur)
277  _Off += (int)(pptr() - eback()); // seek from current
278  else if (_Way != ios_base::beg || _Off == (int)_BADOFF)
279  _Off = (int)_BADOFF; // invalid seek
280  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
281  pbump(_Off - (int)(pptr() - eback())); // seek from beginning
282  else
283  _Off = (int)_BADOFF; // invalid seek from beginning
284  }
285  else
286  _Off = (int)_BADOFF; // nothing to set
287  return (streampos((streamoff)_Off));
288  }
static constexpr _Seekdir cur
Definition: xiosbase:112
static constexpr _Openmode out
Definition: xiosbase:96
_STD_BEGIN typedef long long streamoff
Definition: iosfwd:22
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:224
void __CLR_OR_THIS_CALL pbump(int _Off)
Definition: streambuf:285
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:257
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:234
static constexpr _Seekdir beg
Definition: xiosbase:111
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:291
static constexpr _Seekdir end
Definition: xiosbase:113
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:229
fpos< _Mbstatet > streampos
Definition: iosfwd:124
char * _Seekhigh
Definition: strstream:384
char int *typedef int(__CRTDECL *_CRT_REPORT_HOOKW)(int
Definition: crtdbg.h:45
void __CLR_OR_THIS_CALL gbump(int _Off)
Definition: streambuf:244
_CRTDATA2 _PGLOBAL const streamoff _BADOFF
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:219
static constexpr _Openmode in
Definition: xiosbase:95
virtual streampos __CLR_OR_THIS_CALL strstreambuf::seekpos ( streampos  _Sp,
ios_base::openmode  _Which = ios_base::in | ios_base::out 
)
inlineprotectedvirtual
293  { // seek to memorized position
294  int _Off = (int)(streamoff)_Sp;
295 
296  if (pptr() != 0 && (int)(_Seekhigh - pptr()) < 0) // sic
297  _Seekhigh = pptr(); // update high water mark
298 
299  if (_Off == (int)_BADOFF)
300  ; // invalid seek
301  else if (_Which & ios_base::in && gptr() != 0)
302  { // set input (and maybe output) pointer
303  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
304  { // set valid offset
305  gbump(_Off - (int)(gptr() - eback()));
306  if (_Which & ios_base::out && pptr() != 0)
307  setp(pbase(), gptr(), epptr());
308  }
309  else
310  _Off = (int)_BADOFF; // offset invalid, don't seek
311  }
312  else if (_Which & ios_base::out && pptr() != 0)
313  { // set output pointer
314  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
315  pbump(_Off - (int)(pptr() - eback())); // seek from beginning
316  else
317  _Off = (int)_BADOFF; // offset invalid, don't seek
318  }
319  else
320  _Off = (int)_BADOFF; // nothing to set
321  return (streampos((streamoff)_Off));
322  }
static constexpr _Openmode out
Definition: xiosbase:96
_STD_BEGIN typedef long long streamoff
Definition: iosfwd:22
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:224
void __CLR_OR_THIS_CALL pbump(int _Off)
Definition: streambuf:285
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:257
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:234
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:291
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:229
fpos< _Mbstatet > streampos
Definition: iosfwd:124
char * _Seekhigh
Definition: strstream:384
char int *typedef int(__CRTDECL *_CRT_REPORT_HOOKW)(int
Definition: crtdbg.h:45
void __CLR_OR_THIS_CALL gbump(int _Off)
Definition: streambuf:244
_CRTDATA2 _PGLOBAL const streamoff _BADOFF
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:219
static constexpr _Openmode in
Definition: xiosbase:95
char* __CLR_OR_THIS_CALL strstreambuf::str ( )
inline
125  { // freeze and return pointer to character array
126  freeze();
127  return (gptr());
128  }
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:224
void __CLR_OR_THIS_CALL freeze(bool _Freezeit=true)
Definition: strstream:109
void __CLR_OR_THIS_CALL strstreambuf::swap ( _Myt _Right)
inline
91  { // swap with _Right
92  if (this != _STD addressof(_Right))
93  { // different, worth swapping
95  _STD swap(_Minsize, _Right._Minsize);
96  _STD swap(_Pendsave, _Right._Pendsave);
97  _STD swap(_Seekhigh, _Right._Seekhigh);
98  _STD swap(_Strmode, _Right._Strmode);
99  _STD swap(_Palloc, _Right._Palloc);
100  _STD swap(_Pfree, _Right._Pfree);
101  }
102  }
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
void __CLR_OR_THIS_CALL swap(_Myt &_Right)
Definition: streambuf:52
int _Minsize
Definition: strstream:382
_Strstate _Strmode
Definition: strstream:385
char * _Pendsave
Definition: strstream:383
void __CLR_OR_THIS_CALL swap(_Myt &_Right)
Definition: strstream:90
char * _Seekhigh
Definition: strstream:384
constexpr const _Ty &() _Right
Definition: algorithm:3723
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
virtual int __CLR_OR_THIS_CALL strstreambuf::underflow ( )
inlineprotectedvirtual

Reimplemented from basic_streambuf< _Elem, _Traits >.

228  { // read if read position available
229  if (gptr() == 0)
230  return (EOF); // no read buffer
231  else if (gptr() < egptr())
232  return ((unsigned char)*gptr()); // char in buffer, read it
233  else if (pptr() == 0 || (pptr() <= gptr() && _Seekhigh <= gptr()))
234  return (EOF); // no write buffer to read
235  else
236  { // update _Seekhigh and expand read region
237  if (_Seekhigh < pptr())
238  _Seekhigh = pptr();
239  setg(eback(), gptr(), _Seekhigh);
240  return ((unsigned char)*gptr());
241  }
242  }
_Elem *__CLR_OR_THIS_CALL egptr() const
Definition: streambuf:239
void __CLR_OR_THIS_CALL setg(_Elem *_First, _Elem *_Next, _Elem *_Last)
Definition: streambuf:250
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:224
#define EOF
Definition: stdio.h:36
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:234
char * _Seekhigh
Definition: strstream:384
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:219
strstreambuf::void ( __CLRCALL_OR_CDECL _Pfree)
private

Member Data Documentation

int strstreambuf::_Minsize
private
char* strstreambuf::_Pendsave
private
char* strstreambuf::_Seekhigh
private
_Strstate strstreambuf::_Strmode
private

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