Oncaphillis::niftyLib

niftyLib::IO::device< CharT, TraitsT > Class Template Reference

#include <io/device.h>

Inheritance diagram for niftyLib::IO::device< CharT, TraitsT >:

Detailed Description

template<class CharT, class TraitsT = std::char_traits<CharT>>
class niftyLib::IO::device< CharT, TraitsT >

Generic Output device from which one might to choose to derive a new device class.

This class holds a couple of typedefs and defines the virtual methods read and write which are expected to exist in order to work together with the device_streambuf template class.

Public Types

typedef CharT char_type
 Definition of the type of character transported by the device.
typedef TraitsT traits_type
 These Traits define the characteristics of the character type transorted by this device.
typedef traits_type::int_type int_type

Public Member Functions

 device ()
 Standard Constructor.
virtual ~device ()
virtual std::streamsize write (const char_type *b, std::streamsize n)
 Write a number of char_type to the associated device.
virtual std::streamsize read (char_type *b, std::streamsize n)
 Read a number of char_type to the underlying device.
virtual bool open ()
virtual bool close ()


Member Typedef Documentation

template<class CharT, class TraitsT = std::char_traits<CharT>>
typedef traits_type::int_type niftyLib::IO::device< CharT, TraitsT >::int_type


Constructor & Destructor Documentation

template<class CharT, class TraitsT = std::char_traits<CharT>>
niftyLib::IO::device< CharT, TraitsT >::device (  )  [inline]

Standard Constructor.

Expects an already open unix-style fd as only argument.

The fd defines the file we're associated with i.e. 0 for stdin or the result of an successfull open call.

Reimplemented in niftyLib::IO::filter< CharT, TraitsT, DeviceT >, niftyLib::IO::filter< CharT, TraitsT >, and niftyLib::IO::filter< char, std::char_traits< char >, niftyLib::IO::device< char, std::char_traits< char > > >.

template<class CharT, class TraitsT = std::char_traits<CharT>>
virtual niftyLib::IO::device< CharT, TraitsT >::~device (  )  [inline, virtual]


Member Function Documentation

template<class CharT, class TraitsT = std::char_traits<CharT>>
virtual std::streamsize niftyLib::IO::device< CharT, TraitsT >::write ( const char_type b,
std::streamsize  n 
) [inline, virtual]

Write a number of char_type to the associated device.

This definition always returns -1.

Returns:
the number of char_type actually transfered to the file or -1 in case of error.

Reimplemented in niftyLib::IO::basic_fd_device< CharT, TraitsT >.

Referenced by niftyLib::IO::basic_log_filter< char >::raw_write(), and niftyLib::IO::filter< char, std::char_traits< char >, niftyLib::IO::device< char, std::char_traits< char > > >::write().

template<class CharT, class TraitsT = std::char_traits<CharT>>
virtual std::streamsize niftyLib::IO::device< CharT, TraitsT >::read ( char_type b,
std::streamsize  n 
) [inline, virtual]

Read a number of char_type to the underlying device.

This implementation just returns -1.

Returns:
the number of char_type actually transfered from the file or -1 in case of error.

Reimplemented in niftyLib::IO::basic_fd_device< CharT, TraitsT >.

Referenced by niftyLib::IO::filter< char, std::char_traits< char >, niftyLib::IO::device< char, std::char_traits< char > > >::read().

template<class CharT, class TraitsT = std::char_traits<CharT>>
virtual bool niftyLib::IO::device< CharT, TraitsT >::open (  )  [inline, virtual]

template<class CharT, class TraitsT = std::char_traits<CharT>>
virtual bool niftyLib::IO::device< CharT, TraitsT >::close (  )  [inline, virtual]


The documentation for this class was generated from the following file:

Generated by  doxygen
© 2008; Dr. Sebastian Kloska ( Oncaphillis )
Powered by: [?]