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 
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:24
Definition: strstream:26
Definition: strstream:25
Definition: strstream:23
anonymous enum
private
Enumerator
_MINSIZE 
383  { // constant for default minimum buffer size
384  _MINSIZE = 32};
Definition: strstream:384

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  }
unsigned int _Count
Definition: xcomplex:668
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:317
__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:317
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  }
unsigned int _Count
Definition: xcomplex:668
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:317
__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  }
unsigned int _Count
Definition: xcomplex:668
Definition: strstream:24
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:317
__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  }
unsigned int _Count
Definition: xcomplex:668
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:317
__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  }
unsigned int _Count
Definition: xcomplex:668
Definition: strstream:24
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:317
__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:317
constexpr const _Ty &() _Right
Definition: algorithm:3591
virtual __CLR_OR_THIS_CALL strstreambuf::~strstreambuf ( )
inlinevirtual
109  { // destroy a strstreambuf
110  _Tidy();
111  }
void __CLR_OR_THIS_CALL _Tidy()
Definition: strstream:368
__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  }
unsigned int _Count
Definition: xcomplex:668
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:317
__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  }
unsigned int _Count
Definition: xcomplex:668
Definition: strstream:24
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:317

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:368
void __CLR_OR_THIS_CALL swap(_Myt &_Right)
Definition: strstream:94
constexpr const _Ty &() _Right
Definition: algorithm:3591
void __CLR_OR_THIS_CALL strstreambuf::_Init ( streamsize  _Count = 0,
char *  _Gp = 0,
char *  _Pp = 0,
_Strstate  _Mode = (_Strstate)0 
)
inlineprotected
332  { // initialize with possibly static buffer
334  _Minsize = _MINSIZE;
335  _Pendsave = 0;
336  _Seekhigh = 0;
337  _Palloc = 0;
338  _Pfree = 0;
339  _Strmode = _Mode;
340 
341  if (_Gp == 0)
342  { // make dynamic
343  _Strmode |= _Dynamic;
344  if (_Minsize < _Count)
345  _Minsize = (int)_Count;
346  }
347  else
348  { // make static
349  size_t _Size = _Count < 0 ? INT_MAX
350  : _Count == 0 ? _CSTD strlen(_Gp)
351  : (size_t)_Count;
352  _Seekhigh = _Gp + _Size;
353 
354  if (_Pp == 0)
355  setg(_Gp, _Gp, _Gp + _Size); // set read pointers only
356  else
357  { // make writable too
358  if (_Pp < _Gp)
359  _Pp = _Gp;
360  else if (_Gp + _Size < _Pp)
361  _Pp = _Gp + _Size;
362  setp(_Pp, _Gp + _Size);
363  setg(_Gp, _Gp, _Pp);
364  }
365  }
366  }
void __CLR_OR_THIS_CALL setg(_Elem *_First, _Elem *_Next, _Elem *_Last)
Definition: streambuf:251
unsigned int _Count
Definition: xcomplex:668
int _Minsize
Definition: strstream:386
_Strstate _Strmode
Definition: strstream:389
char * _Pendsave
Definition: strstream:387
unsigned int
Definition: vccorlib.h:2468
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:292
unsigned int size_t
Definition: sourceannotations.h:19
char * _Seekhigh
Definition: strstream:388
Definition: strstream:384
Definition: strstream:25
void __CLR_OR_THIS_CALL _Init()
Definition: streambuf:317
#define _CSTD
Definition: yvals.h:570
#define INT_MAX
Definition: limits.h:35
_Size
Definition: vcruntime_string.h:36
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
void* __CLRCALL_OR_CDECL* strstreambuf::_Palloc ( size_t  )
private
void __CLR_OR_THIS_CALL strstreambuf::_Tidy ( )
inlineprotected
369  { // free any allocated storage
370  if ((_Strmode & (_Allocated | _Frozen)) != _Allocated)
371  ; // no buffer to free
372  else if (_Pfree != 0)
373  (*_Pfree)(eback()); // free with function call
374  else
375  _CSTD free(eback()); // free by deleting array
376 
377  _Seekhigh = 0;
378  _Strmode &= ~(_Allocated | _Frozen);
379  }
_Strstate _Strmode
Definition: strstream:389
Definition: strstream:26
char * _Seekhigh
Definition: strstream:388
#define _CSTD
Definition: yvals.h:570
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:220
Definition: strstream:23
void strstreambuf::clear ( )
inline
153  { // free any allocated storage
154  _Tidy();
155  }
void __CLR_OR_THIS_CALL _Tidy()
Definition: strstream:368
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:258
_Strstate _Strmode
Definition: strstream:389
char * _Pendsave
Definition: strstream:387
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:235
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:292
Definition: strstream:26
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:230
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:220
_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
constexpr const _Ty &() _Right
Definition: algorithm:3591
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 
182  _Ptr = _Palloc != 0 ? (char *)(*_Palloc)(_Newsize)
183  : (char *)_malloc_dbg(_Newsize, _CRT_BLOCK,
184  __FILE__, __LINE__);
185  }
186  if (_Ptr == 0)
187  return (EOF); // couldn't grow, return failure
188 
189  if (0 < _Oldsize)
190  _CSTD memcpy(_Ptr, eback(), _Oldsize); // copy existing
191  if (!(_Strmode & _Allocated))
192  ; // no buffer to free
193  else if (_Pfree != 0)
194  (*_Pfree)(eback()); // free with function call
195  else
196  _CSTD free(eback()); // free by deleting array
197  _Strmode |= _Allocated;
198  if (_Oldsize == 0)
199  { // set up new buffer
200  _Seekhigh = _Ptr;
201  setp(_Ptr, _Ptr + _Newsize);
202  setg(_Ptr, _Ptr, _Ptr);
203  }
204  else
205  { // revise old pointers
206  _Seekhigh = _Seekhigh - eback() + _Ptr;
207  setp(pbase() - eback() + _Ptr, pptr() - eback() + _Ptr,
208  _Ptr + _Newsize);
209  setg(_Ptr, gptr() - eback() + _Ptr, pptr() + 1);
210  }
211 
212  return ((unsigned char)(*_Pninc() = (char)_Meta));
213  }
214  }
void __CLR_OR_THIS_CALL setg(_Elem *_First, _Elem *_Next, _Elem *_Last)
Definition: streambuf:251
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:225
int _Minsize
Definition: strstream:386
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:258
_Strstate _Strmode
Definition: strstream:389
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:235
Definition: strstream:24
unsigned int
Definition: vccorlib.h:2468
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:292
Definition: strstream:26
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:230
char * _Seekhigh
Definition: strstream:388
Definition: strstream:384
Definition: strstream:25
_Elem *__CLR_OR_THIS_CALL _Pninc()
Definition: streambuf:306
#define _CSTD
Definition: yvals.h:570
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:220
#define INT_MAX
Definition: limits.h:35
Definition: strstream:23
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
virtual int __CLR_OR_THIS_CALL strstreambuf::pbackfail ( int  _Meta = EOF)
inlineprotectedvirtual
217  { // try to putback a character
218  if (gptr() == 0 || gptr() <= eback() || (_Meta != EOF
219  && (unsigned char)_Meta != (unsigned char)gptr()[-1]
220  && _Strmode & _Constant))
221  return (EOF); // can't put it back
222  else
223  { // safe to back up
224  gbump(-1);
225  if (_Meta != EOF && *gptr() != (char)_Meta)
226  *gptr() = (char)_Meta;
227  return (_Meta == EOF ? 0 : (unsigned char)_Meta);
228  }
229  }
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:225
_Strstate _Strmode
Definition: strstream:389
Definition: strstream:24
void __CLR_OR_THIS_CALL gbump(int _Off)
Definition: streambuf:245
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:220
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:235
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:230
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
252  { // seek by specified offset
253  int _Off = (int)_Off_arg;
254 
255  if (pptr() != 0 && (int)(_Seekhigh - pptr()) < 0) // sic
256  _Seekhigh = pptr(); // update high water mark
257 
258  if (_Which & ios_base::in && gptr() != 0)
259  { // set input (and maybe output) pointer
260  if (_Way == ios_base::end)
261  _Off += (int)(_Seekhigh - eback()); // seek from end
262  else if (_Way == ios_base::cur
263  && !(_Which & ios_base::out))
264  _Off += (int)(gptr() - eback()); // seek from current
265  else if (_Way != ios_base::beg || _Off == (int)_BADOFF)
266  _Off = (int)_BADOFF; // invalid seek
267  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
268  { // seek from beginning, set one or two pointers
269  gbump(_Off - (int)(gptr() - eback()));
270  if (_Which & ios_base::out && pptr() != 0)
271  setp(pbase(), gptr(), epptr());
272  }
273  else
274  _Off = (int)_BADOFF; // invalid seek from beginning
275  }
276  else if (_Which & ios_base::out && pptr() != 0)
277  { // set only output pointer
278  if (_Way == ios_base::end)
279  _Off += (int)(_Seekhigh - eback()); // seek from end
280  else if (_Way == ios_base::cur)
281  _Off += (int)(pptr() - eback()); // seek from current
282  else if (_Way != ios_base::beg || _Off == (int)_BADOFF)
283  _Off = (int)_BADOFF; // invalid seek
284  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
285  pbump(_Off - (int)(pptr() - eback())); // seek from beginning
286  else
287  _Off = (int)_BADOFF; // invalid seek from beginning
288  }
289  else
290  _Off = (int)_BADOFF; // nothing to set
291  return (streampos((streamoff)_Off));
292  }
static constexpr _Seekdir cur
Definition: xiosbase:113
static constexpr _Openmode out
Definition: xiosbase:97
_STD_BEGIN typedef _Longlong streamoff
Definition: iosfwd:21
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:225
void __CLR_OR_THIS_CALL pbump(int _Off)
Definition: streambuf:286
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:258
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:235
static constexpr _Seekdir beg
Definition: xiosbase:112
unsigned int
Definition: vccorlib.h:2468
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:292
static constexpr _Seekdir end
Definition: xiosbase:114
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:230
fpos< _Mbstatet > streampos
Definition: iosfwd:126
char * _Seekhigh
Definition: strstream:388
void __CLR_OR_THIS_CALL gbump(int _Off)
Definition: streambuf:245
_CRTDATA2 _PGLOBAL const streamoff _BADOFF
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:220
static constexpr _Openmode in
Definition: xiosbase:96
virtual streampos __CLR_OR_THIS_CALL strstreambuf::seekpos ( streampos  _Sp,
ios_base::openmode  _Which = ios_base::in | ios_base::out 
)
inlineprotectedvirtual
297  { // seek to memorized position
298  int _Off = (int)(streamoff)_Sp;
299 
300  if (pptr() != 0 && (int)(_Seekhigh - pptr()) < 0) // sic
301  _Seekhigh = pptr(); // update high water mark
302 
303  if (_Off == (int)_BADOFF)
304  ; // invalid seek
305  else if (_Which & ios_base::in && gptr() != 0)
306  { // set input (and maybe output) pointer
307  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
308  { // set valid offset
309  gbump(_Off - (int)(gptr() - eback()));
310  if (_Which & ios_base::out && pptr() != 0)
311  setp(pbase(), gptr(), epptr());
312  }
313  else
314  _Off = (int)_BADOFF; // offset invalid, don't seek
315  }
316  else if (_Which & ios_base::out && pptr() != 0)
317  { // set output pointer
318  if (0 <= _Off && _Off <= (int)(_Seekhigh - eback()))
319  pbump(_Off - (int)(pptr() - eback())); // seek from beginning
320  else
321  _Off = (int)_BADOFF; // offset invalid, don't seek
322  }
323  else
324  _Off = (int)_BADOFF; // nothing to set
325  return (streampos((streamoff)_Off));
326  }
static constexpr _Openmode out
Definition: xiosbase:97
_STD_BEGIN typedef _Longlong streamoff
Definition: iosfwd:21
_Elem *__CLR_OR_THIS_CALL gptr() const
Definition: streambuf:225
void __CLR_OR_THIS_CALL pbump(int _Off)
Definition: streambuf:286
_Elem *__CLR_OR_THIS_CALL epptr() const
Definition: streambuf:258
_Elem *__CLR_OR_THIS_CALL pptr() const
Definition: streambuf:235
unsigned int
Definition: vccorlib.h:2468
void __CLR_OR_THIS_CALL setp(_Elem *_First, _Elem *_Last)
Definition: streambuf:292
_Elem *__CLR_OR_THIS_CALL pbase() const
Definition: streambuf:230
fpos< _Mbstatet > streampos
Definition: iosfwd:126
char * _Seekhigh
Definition: strstream:388
void __CLR_OR_THIS_CALL gbump(int _Off)
Definition: streambuf:245
_CRTDATA2 _PGLOBAL const streamoff _BADOFF
_Elem *__CLR_OR_THIS_CALL eback() const
Definition: streambuf:220
static constexpr _Openmode in
Definition: xiosbase:96
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:225
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:386
_Strstate _Strmode
Definition: strstream:389
char * _Pendsave
Definition: strstream:387
void __CLR_OR_THIS_CALL swap(_Myt &_Right)
Definition: strstream:94
char * _Seekhigh
Definition: strstream:388
constexpr const _Ty &() _Right
Definition: algorithm:3591
void *__CLRCALL_OR_CDECL * _Palloc(size_t)
virtual int __CLR_OR_THIS_CALL strstreambuf::underflow ( )
inlineprotectedvirtual

Reimplemented from basic_streambuf< _Elem, _Traits >.

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