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 38 39 40 41 42 43 44 45 46 47 48 49
|
The hi(ios)tt(std::ios) class is derived directly from ti(ios_base), and it
defines em(de facto) the foundation for all stream classes of the bf(C++) I/O
library.
Although it em(is) possible to construct an tt(ios) object
directly, this is seldom done. The purpose of the class tt(ios) is to
provide the facilities of the class tt(basic_ios), and to add several new
facilites, all related to the tt(streambuf) object which is managed
by objects of the class tt(ios).
All other stream classes are either directly or indirectly derived from
tt(ios). This implies, as explained in chapter ref(INHERITANCE), that all
facilities of the classes tt(ios) and tt(ios_base) are also available
to other stream classes. Before discussing these additional stream classes,
the features offered by the class tt(ios) (and by implication: by
tt(ios_base)) are now introduced.
In some cases it may be required to include ti(ios) explicitly. An example
is the situations where the formatting flags themselves (cf. section
ref(FORMATFLAGS)) are referred to in source code.
The class tt(ios) offers several member functions, most of which are related
to i(formatting). Other frequently used member functions are:
itemization(
ithtq(rdbuf)
(std::streambuf *ios::rdbuf())
(A pointer to the tt(streambuf) object forming the interface between
the tt(ios) object and the device with which the tt(ios) object communicates
is returned. See sections ref(STREAMBUF) and ref(STRBUF) for more information
about the tt(class streambuf).)
itt(std::streambuf *ios::rdbuf(std::streambuf *new)):
quote(The current tt(ios) object is associated with another
tt(streambuf) object. A pointer to the tt(ios) object's original tt(streambuf)
object is returned. The object to which this pointer points is not destroyed
when the tt(stream) object goes out of scope, but is owned by the caller of
tt(rdbuf).)
ithtq(tie)
(std::ostream *ios::tie())
(A pointer to the ti(ostream) object that is currently tied to the
tt(ios) object is returned (see the next member). The return value 0
indicates that currently no tt(ostream) object is tied to the tt(ios)
object. See section ref(COUPLING) for details.)
itt(std::ostream *ios::tie(std::ostream *outs)):
quote(The ostream object is tied to current tt(ios) object. This means
that the tt(ostream) object is em(flushed) every time before an input or
output action is performed by the current tt(ios) object. A pointer to the
tt(ios) object's original tt(ostream) object is returned. To break the tie,
pass the argument 0. See section ref(COUPLING) for an example.)
)
|