Base class with type-independent members for the standard stream classes
The ios_base class is designed to be a base class for all of the hierarchy of stream classes, describing the most basic part of a stream, which is common to all stream objects. Therefore, it is not designed to be directly instantiated into objects.
Both the ios_base class and its derived class ios define the members of every stream that are independent of whether the stream object is an input or an output stream. Among these, ios_base describes the members that are independent of the template parameters (i.e. the character type and traits), while ios describes the members that depend on them.
More specifically, the ios_base class is in charge of maintaining internally the following information of a stream:
- Formatting information
- format flags: a set of internal indicators describing how certain input/output operations shall be interpreted or generated. The state of these indicators can be obtained or modified by calling the members flags, setf and unsetf.
- field width: describes the width of the next element to be output. This value can be obtained/modified by calling the member function width.
- display precision: describes the decimal precision to be used to output floating-point values. This value can be obtained/modified by calling member precision.
- locale object: describes the localization properties to be considered when formatting i/o operations. The locale object used can be obtained calling member getloc and modified using imbue.
- State information
- error state: internal indicator reflecting the integrity and current error state of the stream. The current object may be obtained by calling ios::rdstate and can be modified by calling ios::clear and ios::setstate. Individual values may be obtained by calling ios::good, ios::eof, ios::fail and ios::bad.
- exception mask: internal exception status indicator. Its value can be retrieved/modified by calling member ios::exceptions.
- event function stack: stack of pointers to callback functions that are called when certain events occur. Additional callback functions may be registered to be called when an event occurs, using member function register_callback.
- internal extensible arrays: two internal arrays to store long objects and void pointers. These arrays can be extended by calling member function xalloc, and references to these objects can be retrieved with iword or pword.
|flags|| Get/set format flags (public member function)|
|setf|| Set specific format flags (public member function)|
|unsetf|| Clear specific format flags (public member function)|
|precision|| Get/Set floating-point decimal precision (public member function)|
|width|| Get/set field width (public member function)|
|imbue|| Imbue locale (public member function)|
|getloc|| Get current locale (public member function)|
Internal extensible array:
|xalloc|| Return a new index for the internal extensible array [static] (public static member function)|
|iword|| Get reference to integer element of the internal extensible array (public member function)|
|pword|| Get reference to pointer of the internal extensible array (public member function)|
|sync_with_stdio|| Activate/deactivate synchronization of iostream and cstdio streams [static] (public static member function)|
|event|| Type to indicate event type (public member types)|
|fmtflags|| Type for stream format flags (public member type)|
|iostate|| Type for stream state flags (public member type)|
|openmode|| Type for stream opening mode flags (public member type)|
|seekdir|| Type for stream seeking direction flag (public member type)|
|failure|| Base class for stream exceptions (public member class)|
|Init|| Initialize standard stream objects (public member class)|