|
Boost : |
From: Daryle Walker (darylew_at_[hidden])
Date: 2003-12-30 08:54:41
This is for the file "boost/io/null_stream.hpp" in the Sandbox.
The "basic_nullbuf" class template implements an output-only stream-buffer.
It only has overrides for "xsputn" and "overflow". While working on
something else which required me to add an override for "showmanyc", I
wondered if I should add that override to "basic_nullbuf".
The "showmanyc" method returns how many characters are available for
'immediate' reading. It is called by the public non-virtual "in_avail"
method. That method returns the remaining spaces in the read buffer, if
any, and "this->showmanyc()" otherwise. Your override for "showmanyc"
should return a positive number corresponding to the number of input
characters immediately available, -1 if a read will certainly fail, or 0 if
neither one of these cases can be determined.
Since "basic_nullbuf" doesn't override "showmanyc", it uses the default
return value of 0. This output-only class must have a 100% input failure
rate, so should I override that method to return -1 instead? (My test file
uses "std::basic_istream<>::readsome", the only stream method that could
call "showmanyc", so I would have to change that part of my test too.)
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk