.\" ident @(#)basic_ios.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH basic_ios 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2basic_ios\fP, \f2ios\fP, \f2wios\fP \ - A base class that includes the common functions required by all streams. .SH SYNOPSIS .br #include .br template > .br class basic_ios : public ios_base .SH DESCRIPTION The class basic_ios is a base class that includes the common functions required by all streams. It maintains state information that reflects the integrity of the stream and stream buffer. It also maintains the link between the stream classes and the stream buffer classes via the \f2rdbuf\fP member functions. Classes derived from basic_ios specialize operations for input and output. .SH INTERFACE .br template > .br class basic_ios : public ios_base { .br .RE .RS 2 public: .RE .RS 0 .RE .RS 3 typedef basic_ios ios_type; .br typedef basic_streambuf streambuf_type; .br typedef basic_ostream ostream_type; .RE .RS 0 .RE .RS 3 typedef typename traits::char_type char_type; .br typedef traits traits_type; .RE .RS 0 .RE .RS 3 typedef typename traits::int_type int_type; .br typedef typename traits::off_type off_type; .br typedef typename traits::pos_type pos_type; .RE .RS 4 .RE .RS 3 operator void*() const; .br bool operator!() const; .RE .RS 0 .RE .RS 3 iostate rdstate() const; .br void clear(iostate state = goodbit); .br void setstate(iostate state); .br bool good() const; .br bool eof() const; .br bool fail() const; .br bool bad() const; .RE .RS 0 .RE .RS 3 void exceptions(iostate except); .br iostate exceptions() const; .RE .RS 0 .br .RE .RS 3 explicit basic_ios(basic_streambuf .RE .RS 22 *sb_arg); .RE .RS 3 virtual ~basic_ios(); .RE .RS 0 .RE .RS 3 ostream_type *tie() const; .br ostream_type *tie(ostream_type *tie_arg); .RE .RS 0 .RE .RS 3 streambuf_type *rdbuf() const; .br streambuf_type *rdbuf( streambuf_type *sb); .RE .RS 0 .RE .RS 3 ios_type& copyfmt(const ios_type& rhs); .RE .RS 0 .RE .RS 3 char_type fill() const; .br char_type fill(char_type ch); .RE .RS 9 .RE .RS 3 locale imbue(const locale& loc); .RE .RS 0 .RE .RS 3 char narrow(charT, char) const; .br charT widen(char) const; .RE .RS 0 .RE .RS 2 protected: .RE .RS 0 .RE .RS 3 basic_ios(); .br void init(basic_streambuf *sb); .RE .RS 0 }; .SH TYPES .br char_type .RE .RS 3 The type \f2char_type\fP is a synonym of type \f2traits::char_type\fP. .RE .br ios .RE .RS 3 The type \f2ios\fP is an instantiation of \f2basic_ios\fP on \f2char\fP: \f2typedef basic_ios ios;\fP .RE .br int_type .RE .RS 3 The type\f2 int_type\fP is a synonym of type \f2traits::in_type\fP. .RE .br ios_type .RE .RS 3 The type \f2ios_type\fP is a synonym for \f2basic_ios\fP . .RE .br off_type .RE .RS 3 The type \f2off_type\fP is a synonym of type \f2traits::off_type\fP. .RE .br ostream_type .RE .RS 3 The type \f2ostream_type\fP is a synonym for \f2basic_ostream\fP . .RE .br pos_type .RE .RS 3 The type \f2pos_type\fP is a synonym of type \f2traits::pos_type\fP. .RE .br streambuf_type .RE .RS 3 The type \f2streambuf_type\fP is a synonym for \f2basic_streambuf\fP . .RE .br traits_type .RE .RS 3 The type \f2traits_type\fP is a synonym for the template parameter \f2traits\fP. .RE .br wios .RE .RS 3 The type \f2wios\fP is an instantiation of \f2basic_ios\fP on \f2wchar_t\fP: \f2typedef basic_ios wios;\fP .RE .SH PUBLIC CONSTRUCTORS .br explicit basic_ios(basic_streambuf* sb); .RE .RS 3 Constructs an object of class \f2basic_ios\fP, assigning initial values to its member objects by calling \f2init(sb)\fP. If \f2sb\fP is a null pointer, the stream is positioned in error state by triggering its \f2badbit\fP. .RE .br basic_ios(); .RE .RS 3 Constructs an object of class \f2basic_ios\fP, leaving its member objects uninitialized. The object must be initialized by calling the \f2init\fP member function before using it. .RE .SH PUBLIC DESTRUCTORS .br virtual ~basic_ios(); .RE .RS 3 Destroys an object of class \f2basic_ios\fP. .RE .SH PUBLIC MEMBER FUNCTIONS .br bool .br bad() const; .RE .RS 3 Returns \f2true\fP if badbit is set in \f2rdstate().\fP .RE .br void .br clear(iostate state = goodbit); .RE .RS 3 If \f2(state & exception()) == 0\fP, returns. Otherwise, the function throws an object of class \f2ios_base::failure\fP. After the call returns \f2state == rdstate() if rdbuf() !=0 otherwise state == state|ios_base::badbit. \fP .RE .br basic_ios& .br copyfmt(const basic_ios& rhs); .RE .RS 3 Assigns to the member objects of \f2*this\fP the corresponding member objects of \f2rhs\fP, except the following: .RS .5i .HP .5i - \f2rdstate()\fP and \f2rdbuf()\fP are left unchanged .HP .5i - Calls \f2ios_base::copyfmt\fP .HP .5i - \f2exceptions()\fP is altered last by calling exceptions(\f2rhs.exceptions()\fP).RE .RE .br bool .br eof() const; .RE .RS 3 Returns \f2true\fP if \f2eofbit\fP is set in \f2rdstate().\fP .RE .br iostate .br exceptions() const; .RE .RS 3 Returns a mask that determines what elements set in \f2rdstate() \fPcause exceptions to be thrown. .RE .br void .br exceptions(iostate except); .RE .RS 3 Sets the exception mask to \f2except\fP, then calls \f2clear(rdstate())\fP. .RE .br bool .br fail() const; .RE .RS 3 Returns \f2true\fP if failbit or badbit is set in \f2rdstate().\fP .RE .br char_type .br fill() const; .RE .RS 3 Returns the character used to pad (fill) an output conversion to the specified field width. .RE .br char_type .br fill(char_type fillch); .RE .RS 3 Saves the field width value, then replaces it by \f2fillch\fP and returns the previously saved value. .RE .br bool .br good() const; .RE .RS 3 Returns \f2rdstate() == 0.\fP .RE .br locale .br imbue(const locale& loc); .RE .RS 3 Saves the value returned by \f2getloc()\fP, then assigns \f2loc\fP to a private variable. If \f2rdbuf() != 0\fP calls \f2rdbuf()->pubimbue(loc)\fP and returns the previously saved value. .RE .br void .br init(basic_streambuf* sb); .RE .RS 3 Performs the following initialization: .br rdbuf() sb .br tie() 0 .br rdstate() goodbit if sb is not null otherwise badbit .br exceptions() goodbit .br flags() skipws | dec .br width() 0 .br precision() 6 .br fill() the space character .br getloc() a copy of the locale returned by locale::locale() .RE .br char .br narrow(charT c, char dfault) const; .RE .RS 3 Uses the stream's locale to convert the wide character \f2c\fP to a tiny character, and then returns it. If no conversion exists, it returns the character \f2dfault\fP. .RE .br bool .br operator!() const; .RE .RS 3 Returns \f2fail() ? 1 : 0;\fP .RE .br streambuf_type* .br rdbuf() const; .RE .RS 3 Returns a pointer to the stream buffer associated with the stream. .RE .br streambuf_type* .br rdbuf(streambuf_type* sb); .RE .RS 3 Associates a stream buffer with the stream. All the input and output is directed to this stream buffer. If \f2sb\fP is a null pointer, the stream is positioned in error state, by triggering its \f2badbit\fP. .RE .br iostate .br rdstate() const; .RE .RS 3 Returns the control state of the stream. .RE .br void .br setstate(iostate state); .RE .RS 3 Calls \f2clear(rdstate() | state)\fP. .RE .br ostream_type* .br tie() const; .RE .RS 3 Returns an output sequence that is tied to (synchronized with) the sequence controlled by the stream buffer. .RE .br ostream_type* .br tie(ostream_type* tiestr); .RE .RS 3 Saves the \f2tie()\fP value, then replaces it by \f2tiestr\fP and returns the value previously saved. .RE .br operator .br \f2void*\fP() const; .RE .RS 3 Returns \f2fail() ? 0 : 1;\fP .RE .br charT .br widen(char c) const; .RE .RS 3 Uses the stream's locale to convert the tiny character \f2c\fP to a wide character, then returns it. .RE .SH SEE ALSO ios_base(3C++), basic_istream(3C++), basic_ostream(3C++), basic_streambuf(3C++), char_traits(3C++) Working Paper for Draft Proposed International Standard for Information Systems--Programming Language C++, section 27.4.5. .SH STANDARDS CONFORMANCE ANSI X3J16/ISO WG21 Joint C++ Committee