cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : IOstream Library : ios_base
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
IOstream Library
manipulators
classes:
· filebuf
· fstream
· ifstream
· ios
· iostream
· ios_base
· istream
· istringstream
· ofstream
· ostream
· ostringstream
· streambuf
· stringbuf
· stringstream
objects:
· cerr
· cin
· clog
· cout
types:
· fpos
· streamoff
· streampos
· streamsize
ios_base
· ios_base::ios_base
· ios_base::~ios_base
member classes:
· ios_base::failure
· ios_base::Init
member functions:
· ios_base::flags
· ios_base::getloc
· ios_base::imbue
· ios_base::iword
· ios_base::precision
· ios_base::pword
· ios_base::register_call...
· ios_base::setf
· ios_base::sync_with_stdio
· ios_base::unsetf
· ios_base::width
· ios_base::xalloc
member types:
· ios_base::event
· ios_base::event_callback
· ios_base::fmtflags
· ios_base::iostate
· ios_base::openmode
· ios_base::seekdir

-

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 are.

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

(constructor) Construct object (constructor member)
(destructor) Destruct object (destructor member)

Formatting:

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)

Locales:

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)

Others:

register_callback Register event callback function (public member function)
sync_with_stdio Activate/deactivate synchronization of iostream and cstdio streams [static] (public static member function)

Member types

event Type to indicate event type (public member types)
event_callback Event callback function type (public member type)
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)

Member classes:

failure Base class for stream exceptions (public member class)
Init Initialize standard stream objects (public member class)

© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us