int_type underflow() override;
Returns: If the input sequence has a read position available, returns traits::to_int_type(*gptr()). Otherwise, returns traits::eof(). Any character in the underlying buffer which has been initialized is considered to be part of the input sequence.
int_type pbackfail(int_type c = traits::eof()) override;
Effects: Puts back the character designated by c to the input sequence, if possible, in one of three ways:
If traits::eq_int_type(c, traits::eof()) returns false and if the input sequence has a putback position available, and if traits::eq(to_char_type(c), gptr()[-1]) returns true, assigns gptr() - 1 to gptr().
Returns: c.
If traits::eq_int_type(c, traits::eof()) returns false and if the input sequence has a putback position available, and if mode & ios_base::out is nonzero, assigns c to *--gptr().
Returns: c.
If traits::eq_int_type(c, traits::eof()) returns true and if the input sequence has a putback position available, assigns gptr() - 1 to gptr().
Returns: traits::not_eof(c).
int_type overflow(int_type c = traits::eof()) override;
Effects: Appends the character designated by c to the output sequence, if possible, in one of two ways:
If traits::eq_int_type(c, traits::eof()) returns false and if either the output sequence has a write position available or the function makes a write position available (as described below), the function calls sputc(c).
Signals success by returning c.
If traits::eq_int_type(c, traits::eof()) returns true, there is no character to append.
Signals success by returning a value other than traits::eof().
The function can make a write position available only if (mode & ios_base::out) != 0. To make a write position available, the function reallocates (or initially allocates) an array object with a sufficient number of elements to hold the current array object (if any), plus at least one additional write position. If (mode & ios_base::in) != 0, the function alters the read end pointer egptr() to point just past the new write position.
pos_type seekoff(off_type off, ios_base::seekdir way,
ios_base::openmode which
= ios_base::in | ios_base::out) override;
Effects: Alters the stream position within one of the controlled sequences, if possible, as indicated in Table 115.
Conditions | Result |
(which & ios_base::in) == ios_base::in | positions the input sequence |
(which & ios_base::out) == ios_base::out | positions the output sequence |
(which & (ios_base::in | ios_base::out)) == (ios_base::in) | ios_base::out)) and way == either ios_base::beg or ios_base::end | positions both the input and the output sequences |
Otherwise | the positioning operation fails. |
For a sequence to be positioned, if its next pointer (either gptr() or pptr()) is a null pointer and the new offset newoff is nonzero, the positioning operation fails. Otherwise, the function determines newoff as indicated in Table 116.
Condition | newoff Value |
way == ios_base::beg | 0 |
way == ios_base::cur | the next pointer minus the beginning pointer (xnext - xbeg). |
way == ios_base::end | the high mark pointer minus the beginning pointer (high_mark - xbeg). |
If (newoff + off) < 0, or if newoff + off refers to an uninitialized character ([stringbuf.members]), the positioning operation fails. Otherwise, the function assigns xbeg + newoff + off to the next pointer xnext.
Returns: pos_type(newoff), constructed from the resultant offset newoff (of type off_type), that stores the resultant stream position, if possible. If the positioning operation fails, or if the constructed object cannot represent the resultant stream position, the return value is pos_type(off_type(-1)).
pos_type seekpos(pos_type sp,
ios_base::openmode which
= ios_base::in | ios_base::out) override;
basic_streambuf<charT, traits>* setbuf(charT* s, streamsize n);