typedef
sThe fundamental building blocks of the Iostreams library are the concepts of a Source, which provides read access to a sequence of characters, a Sink, which provides write access to a sequence of characters, an InputFilter, which Filters input read from a Source, and an OutputFilter, which Filters output written to a Sink. Sources, Sinks and their refinements are called Devices. InputFilters, OutputFilter and their refinements are called Filters.
Standard streams and stream buffers are Devices; for example, input streams are Sources and output streams are Sinks.[1]
In general, a Filter or Device may provide access to an input sequence, for reading, an output sequence, for writing, or both. The relationship between the two sequences, as well as the operations that may be performed on them, depends on the Filter or Device type. The various possible relationships between input and output are referred to as modes.[2] The Iostreams library provides one Device concept and one Filter concept for each of eight modes. Source, Sink, InputFilter and OutputFilter correspond to the the modes input and output and are by far the most important of the Filter and Device concepts.
The most common Device and Filter concepts are documented individually. Readers new to the Iostreams library should familiarize themselves with the four central concepts Source, Sink, InputFilter and OutputFilter. The full sets of requirements for the Filter and Device concepts are summarized in the definitions of the concepts Device and Filter which form the roots of the concept hierarchies.
To ease the task of defining new Filter and Device types, the Iostreams library provides a number of convenience templates and typedef
s.
The most important Device concepts are these:
The most important Filter concepts are these:
Boost.Iostreams prvides several concepts corresponding to optional behavior that a Filter or Device might implement:
locale
of a stream or stream buffer is set using basic_ios::imbue
or basic_streambuf::pubimbue
.
typedef
sThe Iostreams library provides several templates intended for derivation by user-defined Filter and Device types. They ease the task of defining Filters and Devices by providing member types and default implementations of several member functions.
The template device
and its specializations source
and sink
help users define new Device types; the template filter
and its specializations input_filter
and output_filter
help users define new Filter types; the template multichar_filter
and its specializations multichar_input_filter
and multichar_output_filter
help users define new multichar Filter types. There are also wide-character versions of these templates, wdevice
, wfilter
and multichar_wfilter
, as well as corresponding wide-character typedef
s.
[1]For complete details, see mode_of
.
[2]A more precise definition is given in Modes.
© Copyright 2008 CodeRage, LLC
© Copyright 2004-2007 Jonathan Turkanis
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)