|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-03-07 22:29:17
Hi All,
Everybody likes naming questions, right?
The thread "[iostreams] Major interface changes planned" discussed having the
get() function return a type (basic_character, character or wcharacter) which
can hold either a character, an EOF indication or an EAGAIN indication. My
question is what I should call the functions which query the state of a
basic_character.
My first idea was to use
bool good(character c) - returns true if c represents a character rather
than EOF or EAGAIN
bool eof(chacrater c) - returns true if c represent EOF
bool fail(character c) - returns true if c represents EAGAIN.
These functions have the same names as member functions of basic_ios. However,
since fail() above doesn't mean exactly the same thing as basic_ios::fail(), I
now think this is a bad idea.
Here are the names I've thought of:
good: good, is_good
eof: eof, is_eof
fail: fail, eagain, is_eagain, would_block, should_retry
I also need names for the two functions called by implementations of get() to
return characters representing EOF and EAGAIN. E.g.,
template<typename Source>
character get(Source& src)
{
...
if ( ... )
return eof();
else
return eagain();
}
(They will actually return instances of types convertible to basic_character.)
What do you think?
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk