Class Template device

Description
Headers
Reference

Description

The class template device, its subcass wdevice and their specializations source, sink, wsource and wsink are provided by the Iostreams library to ease the definitions of new models of the various Device Concepts. These templates and typedefs are inteded to be used as base classes for user-defined Devices. They supply the member types char_type and category used by the Iostreams library.

The supplied category member is convertible to closable_tag and to localizable_tag. This allows users to define models of the concepts Closable and Localizable simply by providing definitions of member functions close and imbue.

Headers

<boost/iostreams/concepts.hpp>

Reference

Synopsis

namespace boost{ namespace iostreams {

template<typename Mode, typename Ch = char>
struct device;

template<typename Mode, typename Ch = wchar_t>
struct wdevice : device<Mode, Ch> { };

typedef device<input>    source;
typedef device<output>   sink;
typedef wdevice<input>   wsource;
typedef wdevice<output>  wsink;

template<typename Mode, typename Ch = char>
struct device {
    typedef Ch         char_type;
    typedef see below  category;
    void close();
    void close(std::ios_base::openmode);
    void imbue(const std::locale&);
};

} } // End namespace boost::io

Template parameters

Mode- A mode tag.
Ch- The character type

device::category

    typedef see below category;

A category tag convertible to Mode, device_tag, closable_tag and localizable_tag.

device::close

    void close();
    void close(std::ios_base::openmode);

Both overloads are implemented as no-ops. The second is available only if Mode is convertible to bidirectional. The first is available only if Mode is not convertible to bidirectional.

Required by Closable.

device::imbue

    void imbue(const std::locale&);

Implemented as a no-op. Required by Localizable.