ios_base


class
<ios>

Base class with type-independent members for the standard stream classes

ios_base


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.
Other
  • 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.


Member Functions



Formatting:


Locales:


Internal extensible array:


Others:


Member types



Member classes: