cppannotations/annotations/yo/iostreams/ostream.yo

29 lines
1.5 KiB
Text

The class ti(ostream) defines basic output facilities. The ti(cout), ti(clog)
and ti(cerr) objects are all tt(ostream) objects. All facilities related to
output as defined by the tt(ios) class are also available in the tt(ostream)
class.
We may define tt(ostream) objects using the following
emi(ostream constructor):
itemization(
itt(std::ostream object(std::streambuf *sb)):
quote(this constructor creates an tt(ostream) object which is a
wrapper around an existing tt(std::streambuf) object. It isn't possible to
define a plain tt(ostream) object (e.g., using tt(std::ostream out;)) that
can thereupon be used for insertions. When tt(cout) or its friends are used,
we are actually using a predefined tt(ostream) object that has already been
defined for us and interfaces to the standard output stream using a
(also predefined) tt(streambuf) object handling the actual interfacing.
It em(is), however, possible to define an tt(ostream) object passing it
hi(ostream: define using 0-pointer) a 0-pointer. Such an object cannot be
used for insertions (i.e., it raises its tt(ios::bad) flag when something
is inserted into it), but it may be given a tt(streambuf) later. Thus it may
be preliminary constructed, suspending its use until an appropriate
tt(streambuf) becomes available (see also section ref(STREAMINIT)).
)
)
To define the tt(ostream) class in bf(C++) sources, the
tthi(ostream) header file must be included. To use the predefined
tt(ostream) objects (tt(std::cin, std::cout) etc.) the tthi(iostream) header
file must be included.