1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
Several protected members are related to buffer management and positioning:
itemization(
ithtq(setbuf)
(virtual streambuf *setbuf(char *buffer, streamsize n))
(This member function may be overridden by derived classes to install a
buffer. The default implementation performs no actions. It is called
by tt(pubsetbuf).)
ithtq(seekoff)(virtual ios::pos_type seekoff(ios::off_type offset,
ios::seekdir way, ios::openmode mode = ios::in | ios::out))
(This member function may be overridden by derived classes to
reset the next pointer for input or output to a new relative
position (using
hi(cur)hi(beg)tt(ios::beg, ios::cur) or hi(end)tt(ios::end)). The
default implementation indicates failure by returning -1. This
function is called when tt(tellg) or tt(tellp) are called. When
derived class supports seeking, then it should also define this
function to handle repositioning requests. It is called by
ti(pubseekoff). The new position or (by default) an invalid position
(i.e., -1) is returned (see also section ref(IOSTREAMBUF)).)
ithtq(seekpos)(virtual ios::pos_type seekpos(ios::pos_type offset,
ios::openmode mode = ios::in | ios::out))
(This member function may be overridden by derived classes to reset the
next pointer for input or output to a new absolute position (i.e,
relative to tt(ios::beg)). This function is called when tt(seekg) or
tt(seekp) are called. The new position or (by default) an invalid
position (i.e., -1) is returned.)
ithtq(sync)
(virtual int sync())
(This member function may be overridden by derived classes to flush the
output buffer to the output device or to reset the input device just
beyond the position of the character that was returned last. It
returns 0 on success, -1 on failure. The default implementation (not
using a buffer) is to return 0, indicating successful syncing. This
member is used to ensure that any characters that are still buffered
are written to the device or to put unconsumed characters back to the
device when the tt(streambuf) object ceases to exist.)
)
|