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 pubseekoff (off_type _Off, ios_base::seek_dir _Way, ios_base::open_mode _Mode)
 
pos_type __CLR_OR_THIS_CALL pubseekpos (pos_type _Pos, ios_base::openmode _Mode=ios_base::in|ios_base::out)
 
pos_type __CLR_OR_THIS_CALL pubseekpos (pos_type _Pos, ios_base::open_mode _Mode)
 
_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)
 
void __CLR_OR_THIS_CALL stossc ()
 
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 
22  { // constants for bits in stream state
23  _Allocated = 1, // set if character array storage has been allocated
24  _Constant = 2, // set if character array nonmutable
25  _Dynamic = 4, // set if character array length grows on demand
26  _Frozen = 8}; // set if character array ownership given away
Definition: strstream:25
Definition: strstream:26
Definition: strstream:24
Definition: strstream:23
anonymous enum
private
Enumerator
_MINSIZE 
382  { // constant for default minimum buffer size
383  _MINSIZE = 32};
Definition: strstream:383

Constructor & Destructor Documentation

__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( streamsize  _Count = 0)
inlineexplicit
30  { // construct with empty character array, suggested initial size
31  _Init(_Count);
32  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
_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
36  { // construct with empty character array, allocation functions
37  _Init();
38  _Palloc = _Allocfunc;
39  _Pfree = _Freefunc;
40  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
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
45  { // construct with [_Getptr, _Getptr + _Count), possibly mutable
46  _Init(_Count, _Getptr, _Putptr);
47  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _In_z_ const char *  _Getptr,
streamsize  _Count 
)
inline
51  { // construct with [_Getptr, _Getptr + _Count), nonmutable
52  _Init(_Count, (char *)_Getptr, 0, _Constant);
53  }
Definition: strstream:24
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
_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
61  { // construct with [_Getptr, _Getptr + _Count), possibly mutable
62  _Init(_Count, (char *)_Getptr, (char *)_Putptr);
63  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _In_opt_z_ const unsigned char *  _Getptr,
streamsize  _Count 
)
inline
67  { // construct with [_Getptr, _Getptr + _Count), nonmutable
68  _Init(_Count, (char *)_Getptr, 0, _Constant);
69  }
Definition: strstream:24
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _Myt &&  _Right)
inline
74  { // construct by moving _Right
75  _Init();
76  _Assign_rv(_STD forward<_Myt>(_Right));
77  }
void __CLR_OR_THIS_CALL _Assign_rv(_Myt &&_Right)
Definition: strstream:85
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
const _Ty & _Right
Definition: algorithm:4087
virtual __CLR_OR_THIS_CALL strstreambuf::~strstreambuf ( )
inlinevirtual
109  { // destroy a strstreambuf
110  _Tidy();
111  }
void __CLR_OR_THIS_CALL _Tidy()
Definition: strstream:367
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( _In_opt_z_ signed char *  _Getptr,
streamsize  _Count,
_In_opt_z_ signed char *  _Putptr = 0 
)
inline
142  { // construct with [_Getptr, _Getptr + _Count), possibly mutable
143  _Init(_Count, (char *)_Getptr, (char *)_Putptr);
144  }
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
_Diff _Count
Definition: algorithm:1941
__CLR_OR_THIS_CALL strstreambuf::strstreambuf ( const signed char *  _Getptr,
streamsize  _Count 
)
inline
148  { // construct with [_Getptr, _Getptr + _Count), nonmutable
149  _Init(_Count, (char *)_Getptr, 0, _Constant);
150  }
Definition: strstream:24
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
_Diff _Count
Definition: algorithm:1941

Member Function Documentation

void __CLR_OR_THIS_CALL strstreambuf::_Assign_rv ( _Myt &&  _Right)
inline
86  { // assign by moving _Right
87  if (this != &_Right)
88  { // different, worth moving
89  _Tidy();
90  this->swap(_Right);
91  }
92  }
void __CLR_OR_THIS_CALL _Tidy()
Definition: strstream:367
void __CLR_OR_THIS_CALL swap(_Myt &_Right)
Definition: strstream:94
const _Ty & _Right
Definition: algorithm:4087
void __CLR_OR_THIS_CALL strstreambuf::_Init ( streamsize  _Count = 0,
char *  _Gp = 0,
char *  _Pp = 0,
_Strstate  _Mode = (_Strstate)0 
)
inlineprotected
331  { // initialize with possibly static buffer
333  _Minsize = _MINSIZE;
334  _Pendsave = 0;
335  _Seekhigh = 0;
336  _Palloc = 0;
337  _Pfree = 0;
338  _Strmode = _Mode;
339 
340  if (_Gp == 0)
341  { // make dynamic
342  _Strmode |= _Dynamic;
343  if (_Minsize < _Count)
344  _Minsize = (int)_Count;
345  }
346  else
347  { // make static
348  size_t _Size = _Count < 0 ? INT_MAX
349  : _Count == 0 ? _CSTD strlen(_Gp)
350  : (size_t)_Count;
351  _Seekhigh = _Gp + _Size;
352 
353  if (_Pp == 0)
354  setg(_Gp, _Gp, _Gp + _Size); // set read pointers only
355  else
356  { // make writable too
357  if (_Pp < _Gp)
358  _Pp = _Gp;
359  else if (_Gp + _Size < _Pp)
360  _Pp = _Gp + _Size;
361  setp(_Pp, _Gp + _Size);
362  setg(_Gp, _Gp, _Pp);
363  }
364  }
365  }
void __CLR_OR_THIS_CALL setg(_Elem *_First, _Elem *_Next, _Elem *_Last)
Definition: streambuf:245
_Check_return_ _In_ int _Mode
Definition: io.h:338
Definition: strstream:383
_W64 unsigned int size_t
Definition: crtdefs.h:496
int _Minsize
Definition: strstream:385
_Strstate _Strmode
Definition: strstream:388
char * _Pendsave
Definition: strstream:386
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:286
char * _Seekhigh
Definition: strstream:387
Definition: strstream:25
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:311
_Diff _Count
Definition: algorithm:1941
#define _CSTD
Definition: yvals.h:559
#define INT_MAX
Definition: limits.h:40
_Check_return_ _In_ long _Size
Definition: io.h:325
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
_Check_return_ size_t __cdecl strlen(_In_z_ const char *_Str)
void* __CLRCALL_OR_CDECL* strstreambuf::_Palloc ( size_t  )
private
void __CLR_OR_THIS_CALL strstreambuf::_Tidy ( )
inlineprotected
368  { // free any allocated storage
369  if ((_Strmode & (_Allocated | _Frozen)) != _Allocated)
370  ; // no buffer to free
371  else if (_Pfree != 0)
372  (*_Pfree)(eback()); // free with function call
373  else
374  _DELETE_CRT_VEC(eback()); // free by deleting array
375 
376  _Seekhigh = 0;
377  _Strmode &= ~(_Allocated | _Frozen);
378  }
_Strstate _Strmode
Definition: strstream:388
char * _Seekhigh
Definition: strstream:387
Definition: strstream:26
#define _DELETE_CRT_VEC(ptr)
Definition: xdebug:71
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:214
Definition: strstream:23
void strstreambuf::clear ( )
inline
153  { // free any allocated storage
154  _Tidy();
155  }
void __CLR_OR_THIS_CALL _Tidy()
Definition: strstream:367
void __CLR_OR_THIS_CALL strstreambuf::freeze ( bool  _Freezeit = true)
inline
114  { // freeze or unfreeze writing
115  if (_Freezeit && !(_Strmode & _Frozen))
116  { // disable writing
117  _Strmode |= _Frozen;
118  _Pendsave = epptr();
119  setp(pbase(), pptr(), eback());
120  }
121  else if (!_Freezeit && _Strmode & _Frozen)
122  { // re-enable writing
123  _Strmode &= ~_Frozen;
124  setp(pbase(), pptr(), _Pendsave);
125  }
126  }
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:252
_Strstate _Strmode
Definition: strstream:388
char * _Pendsave
Definition: strstream:386
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:229
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:286
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:224
Definition: strstream:26
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:214
_Myt& __CLR_OR_THIS_CALL strstreambuf::operator= ( _Myt &&  _Right)
inline
80  { // assign by moving _Right
81  _Assign_rv(_STD forward<_Myt>(_Right));
82  return (*this);
83  }
void __CLR_OR_THIS_CALL _Assign_rv(_Myt &&_Right)
Definition: strstream:85
const _Ty & _Right
Definition: algorithm:4087
virtual int __CLR_OR_THIS_CALL strstreambuf::overflow ( int  _Meta = EOF)
inlineprotectedvirtual
159  { // try to extend write area
160  if (_Meta == EOF)
161  return (0); // nothing to write
162  else if (pptr() != 0 && pptr() < epptr())
163  return ((unsigned char)(*_Pninc() = (char)_Meta));
164  else if (!(_Strmode & _Dynamic)
165  || _Strmode & (_Constant | _Frozen))
166  return (EOF); // can't extend
167  else
168  { // okay to extend
169  int _Oldsize = gptr() == 0 ? 0 : (int)(epptr() - eback());
170  int _Newsize = _Oldsize;
171  int _Inc = _Newsize / 2 < _Minsize
172  ? _Minsize : _Newsize / 2; // grow by 50 per cent if possible
173  _Minsize = _MINSIZE; // back to default for future growth
174  char *_Ptr = 0;
175 
176  while (0 < _Inc && INT_MAX - _Inc < _Newsize)
177  _Inc /= 2; // reduce growth increment if too big
178  if (0 < _Inc)
179  { // room to grow, increase size
180  _Newsize += _Inc;
181  _Ptr = _Palloc != 0 ? (char *)(*_Palloc)(_Newsize)
182  : _NEW_CRT char[_Newsize];
183  }
184  if (_Ptr == 0)
185  return (EOF); // couldn't grow, return failure
186 
187  if (0 < _Oldsize)
188  _CSTD memcpy(_Ptr, eback(), _Oldsize); // copy existing
189  if (!(_Strmode & _Allocated))
190  ; // no buffer to free
191  else if (_Pfree != 0)
192  (*_Pfree)(eback()); // free with function call
193  else
194  _DELETE_CRT_VEC(eback()); // free by deleting array
195 
196  _Strmode |= _Allocated;
197  if (_Oldsize == 0)
198  { // set up new buffer
199  _Seekhigh = _Ptr;
200  setp(_Ptr, _Ptr + _Newsize);
201  setg(_Ptr, _Ptr, _Ptr);
202  }
203  else
204  { // revise old pointers
205  _Seekhigh = _Seekhigh - eback() + _Ptr;
206  setp(pbase() - eback() + _Ptr, pptr() - eback() + _Ptr,
207  _Ptr + _Newsize);
208  setg(_Ptr, gptr() - eback() + _Ptr, pptr() + 1);
209  }
210 
211  return ((unsigned char)(*_Pninc() = (char)_Meta));
212  }
213  }
void __CLR_OR_THIS_CALL setg(_Elem *_First, _Elem *_Next, _Elem *_Last)
Definition: streambuf:245
#define _NEW_CRT
Definition: xdebug:69
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:219
Definition: strstream:383
int _Minsize
Definition: strstream:385
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:252
_Strstate _Strmode
Definition: strstream:388
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
#define EOF
Definition: stdio.h:59
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:229
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:286
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:224
char * _Seekhigh
Definition: strstream:387
Definition: strstream:25
Definition: strstream:26
Definition: strstream:24
#define _DELETE_CRT_VEC(ptr)
Definition: xdebug:71
_Elem *__CLR_OR_THIS_CALL _Pninc()
Definition: streambuf:300
#define _CSTD
Definition: yvals.h:559
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:214
#define INT_MAX
Definition: limits.h:40
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
Definition: strstream:23
virtual int __CLR_OR_THIS_CALL strstreambuf::pbackfail ( int  _Meta = EOF)
inlineprotectedvirtual
216  { // try to putback a character
217  if (gptr() == 0 || gptr() <= eback() || (_Meta != EOF
218  && (unsigned char)_Meta != (unsigned char)gptr()[-1]
219  && _Strmode & _Constant))
220  return (EOF); // can't put it back
221  else
222  { // safe to back up
223  gbump(-1);
224  if (_Meta != EOF && *gptr() != (char)_Meta)
225  *gptr() = (char)_Meta;
226  return (_Meta == EOF ? 0 : (unsigned char)_Meta);
227  }
228  }
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:219
_Strstate _Strmode
Definition: strstream:388
#define EOF
Definition: stdio.h:59
void __CLR_OR_THIS_CALL gbump(int _Off)
Definition: streambuf:239
Definition: strstream:24
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:214
streamsize __CLR_OR_THIS_CALL strstreambuf::pcount ( ) const
inline
135  { // return size of writable character array
136  return (pptr() == 0 ? 0 : (streamsize)(pptr() - pbase()));
137  }
_Longlong streamsize
Definition: iosfwd:22
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:229
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:224
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
251  { // seek by specified offset
252  int _Off = (int)_Off_arg;
253 
254  if (pptr() != 0 && (int)(_Seekhigh - pptr()) < 0) // sic
255  _Seekhigh = pptr(); // update high water mark
256 
257  if (_Which & ios_base::in && gptr() != 0)
258  { // set input (and maybe output) pointer
259  if (_Way == ios_base::end)
260  _Off += (int)(_Seekhigh - eback()); // seek from end
261  else if (_Way == ios_base::cur
262  && !(_Which & ios_base::out))
263  _Off += (int)(gptr() - eback()); // seek from current
264  else if (_Way != ios_base::beg || _Off == (int)_BADOFF)
265  _Off = (int)_BADOFF; // invalid seek
266  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
267  { // seek from beginning, set one or two pointers
268  gbump(_Off - (int)(gptr() - eback()));
269  if (_Which & ios_base::out && pptr() != 0)
270  setp(pbase(), gptr(), epptr());
271  }
272  else
273  _Off = (int)_BADOFF; // invalid seek from beginning
274  }
275  else if (_Which & ios_base::out && pptr() != 0)
276  { // set only output pointer
277  if (_Way == ios_base::end)
278  _Off += (int)(_Seekhigh - eback()); // seek from end
279  else if (_Way == ios_base::cur)
280  _Off += (int)(pptr() - eback()); // seek from current
281  else if (_Way != ios_base::beg || _Off == (int)_BADOFF)
282  _Off = (int)_BADOFF; // invalid seek
283  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
284  pbump(_Off - (int)(pptr() - eback())); // seek from beginning
285  else
286  _Off = (int)_BADOFF; // invalid seek from beginning
287  }
288  else
289  _Off = (int)_BADOFF; // nothing to set
290  return (streampos((streamoff)_Off));
291  }
static const _Seekdir cur
Definition: xiosbase:111
static const _Openmode out
Definition: xiosbase:98
_STD_BEGIN typedef _Longlong streamoff
Definition: iosfwd:21
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:219
void __CLR_OR_THIS_CALL pbump(int _Off)
Definition: streambuf:280
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:252
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:229
static const _Seekdir beg
Definition: xiosbase:110
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:286
static const _Seekdir end
Definition: xiosbase:112
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:224
fpos< _Mbstatet > streampos
Definition: iosfwd:126
char * _Seekhigh
Definition: strstream:387
void __CLR_OR_THIS_CALL gbump(int _Off)
Definition: streambuf:239
_CRTDATA2 _PGLOBAL const streamoff _BADOFF
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:214
static const _Openmode in
Definition: xiosbase:97
virtual streampos __CLR_OR_THIS_CALL strstreambuf::seekpos ( streampos  _Sp,
ios_base::openmode  _Which = ios_base::in | ios_base::out 
)
inlineprotectedvirtual
296  { // seek to memorized position
297  int _Off = (int)(streamoff)_Sp;
298 
299  if (pptr() != 0 && (int)(_Seekhigh - pptr()) < 0) // sic
300  _Seekhigh = pptr(); // update high water mark
301 
302  if (_Off == (int)_BADOFF)
303  ; // invalid seek
304  else if (_Which & ios_base::in && gptr() != 0)
305  { // set input (and maybe output) pointer
306  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
307  { // set valid offset
308  gbump(_Off - (int)(gptr() - eback()));
309  if (_Which & ios_base::out && pptr() != 0)
310  setp(pbase(), gptr(), epptr());
311  }
312  else
313  _Off = (int)_BADOFF; // offset invalid, don't seek
314  }
315  else if (_Which & ios_base::out && pptr() != 0)
316  { // set output pointer
317  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
318  pbump(_Off - (int)(pptr() - eback())); // seek from beginning
319  else
320  _Off = (int)_BADOFF; // offset invalid, don't seek
321  }
322  else
323  _Off = (int)_BADOFF; // nothing to set
324  return (streampos((streamoff)_Off));
325  }
static const _Openmode out
Definition: xiosbase:98
_STD_BEGIN typedef _Longlong streamoff
Definition: iosfwd:21
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:219
void __CLR_OR_THIS_CALL pbump(int _Off)
Definition: streambuf:280
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:252
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:229
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:286
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:224
fpos< _Mbstatet > streampos
Definition: iosfwd:126
char * _Seekhigh
Definition: strstream:387
void __CLR_OR_THIS_CALL gbump(int _Off)
Definition: streambuf:239
_CRTDATA2 _PGLOBAL const streamoff _BADOFF
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:214
static const _Openmode in
Definition: xiosbase:97
char* __CLR_OR_THIS_CALL strstreambuf::str ( )
inline
129  { // freeze and return pointer to character array
130  freeze();
131  return (gptr());
132  }
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:219
void __CLR_OR_THIS_CALL freeze(bool _Freezeit=true)
Definition: strstream:113
void __CLR_OR_THIS_CALL strstreambuf::swap ( _Myt _Right)
inline
95  { // swap with _Right
96  if (this != &_Right)
97  { // different, worth swapping
99  _STD swap(_Minsize, _Right._Minsize);
100  _STD swap(_Pendsave, _Right._Pendsave);
101  _STD swap(_Seekhigh, _Right._Seekhigh);
102  _STD swap(_Strmode, _Right._Strmode);
103  _STD swap(_Palloc, _Right._Palloc);
104  _STD swap(_Pfree, _Right._Pfree);
105  }
106  }
void __CLR_OR_THIS_CALL swap(_Myt &_Right)
Definition: streambuf:53
int _Minsize
Definition: strstream:385
_Strstate _Strmode
Definition: strstream:388
char * _Pendsave
Definition: strstream:386
void __CLR_OR_THIS_CALL swap(_Myt &_Right)
Definition: strstream:94
char * _Seekhigh
Definition: strstream:387
const _Ty & _Right
Definition: algorithm:4087
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
virtual int __CLR_OR_THIS_CALL strstreambuf::underflow ( )
inlineprotectedvirtual

Reimplemented from basic_streambuf< _Elem, _Traits >.

231  { // read if read position available
232  if (gptr() == 0)
233  return (EOF); // no read buffer
234  else if (gptr() < egptr())
235  return ((unsigned char)*gptr()); // char in buffer, read it
236  else if (pptr() == 0 || (pptr() <= gptr() && _Seekhigh <= gptr()))
237  return (EOF); // no write buffer to read
238  else
239  { // update _Seekhigh and expand read region
240  if (_Seekhigh < pptr())
241  _Seekhigh = pptr();
242  setg(eback(), gptr(), _Seekhigh);
243  return ((unsigned char)*gptr());
244  }
245  }
_Elem *__CLR_OR_THIS_CALL egptr() const
Definition: streambuf:234
void __CLR_OR_THIS_CALL setg(_Elem *_First, _Elem *_Next, _Elem *_Last)
Definition: streambuf:245
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:219
#define EOF
Definition: stdio.h:59
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:229
char * _Seekhigh
Definition: strstream:387
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:214
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: