protected virtual member function
<streambuf>
Get character in the case of underflow
For the purpose of the
streambuf class,
underflows happen when a new character is to be read at the
get pointer gptr, but this has reached the
end pointer egptr, indicating that apparently no more characters are available in the
internal input array.
This function is expected to modify the
eback,
gptr and
egptr pointers that define the
internal input array in such a way that if there are more characters available in the controlled input sequence after the location represented by
streambuf::egptr, at least some of them are made available through this
internal input array and the new character available at the
get pointer's position itself is returned. Otherwise, if there are no more characters available in the controlled input sequence after the one represented by
egptr, the function returns
EOF (or
traits::eof() for other traits).
This is a virtual member function that can be overriden for a specific behavior in derived classes. Its default behavior in
streambuf is to do nothing and return EOF (or
traits::eof() for other traits), but both standard derived classes,
filebuf and
stringbuf, override this function (see
filebuf::underflow and
stringbuf::underflow).
This protected member function is automatically called by
sgetc member function when an underflow happens.
The definition of the member function
uflow in
streambuf relies on this member function. The behavior of
uflow is the same as the one of
underflow, except that it also advances the
get pointer.
Parameters
none
Return Value
The new character available at the
get pointer position, if any. Otherwise, EOF (or
traits::eof() for other traits) is returned.
Basic template member declaration
( basic_streambuf<charT,traits> )
1 2
|
typedef traits::int_type int_type;
int_type underflow ( );
|
See also.
- streambuf::sgetc
- Get current character (public member function)
- streambuf::uflow
- Get character in the case of underflow and advance get pointer (protected virtual member function)