cxxtools::BasicTextBuffer< CharT, ByteT > Class Template Reference

Converts character sequences with different encodings. More...

#include <cxxtools/textbuffer.h>

Inheritance diagram for cxxtools::BasicTextBuffer< CharT, ByteT >:
basic_streambuf

Public Types

typedef ByteT extern_type
typedef CharT intern_type
typedef CharT char_type
typedef std::char_traits< CharT > traits_type
typedef traits_type::int_type int_type
typedef traits_type::pos_type pos_type
typedef traits_type::off_type off_type
typedef TextCodec< char_type,
extern_type
CodecType
typedef MBState state_type

Public Member Functions

 BasicTextBuffer (std::basic_ios< extern_type > *target, CodecType *codec)
 Creates a BasicTextBuffer using the given stream buffer and codec.
 ~BasicTextBuffer () throw ()
void attach (std::basic_ios< extern_type > &target)
void detach ()
int terminate ()
std::streamsize import ()

Protected Member Functions

virtual int sync ()
virtual std::streamsize showmanyc ()
virtual int_type overflow (int_type ch=traits_type::eof())
virtual int_type underflow ()
std::pair< int_type,
std::streamsize > 
do_underflow (std::streamsize size)

Static Protected Member Functions

static void copyChars (extern_type *s1, const char_type *s2, size_t n)
static void copyBytes (char_type *s1, const extern_type *s2, size_t n)

Detailed Description

template<typename CharT, typename ByteT>
class cxxtools::BasicTextBuffer< CharT, ByteT >

Converts character sequences with different encodings.

This class derives from std::basic_streambuf which is the super-class of all stream buffer classes. Stream buffer classes are used to connect to an external device, transport characters from and to this external device and buffer the characters in an internal buffer.

The internal character set can be specified using the template parameters 'char_type_', the external character set using 'extern_type_'. The external type is the input type and output type when reading from or writing to the external device. The internal type is the type which is used to internally store the data from the external device after the external format was converted using the Codec which is passed when constructing an object of this class.

The Codec object which is passed as pointer to the constructor will afterwards be completely managed by this class and also be deleted by this class when it's destructed!

See Also
std::basic_streambuf

Member Typedef Documentation

template<typename CharT, typename ByteT>
typedef CharT cxxtools::BasicTextBuffer< CharT, ByteT >::char_type
template<typename CharT, typename ByteT>
typedef TextCodec<char_type, extern_type> cxxtools::BasicTextBuffer< CharT, ByteT >::CodecType
template<typename CharT, typename ByteT>
typedef ByteT cxxtools::BasicTextBuffer< CharT, ByteT >::extern_type
template<typename CharT, typename ByteT>
typedef traits_type::int_type cxxtools::BasicTextBuffer< CharT, ByteT >::int_type
template<typename CharT, typename ByteT>
typedef CharT cxxtools::BasicTextBuffer< CharT, ByteT >::intern_type
template<typename CharT, typename ByteT>
typedef traits_type::off_type cxxtools::BasicTextBuffer< CharT, ByteT >::off_type
template<typename CharT, typename ByteT>
typedef traits_type::pos_type cxxtools::BasicTextBuffer< CharT, ByteT >::pos_type
template<typename CharT, typename ByteT>
typedef MBState cxxtools::BasicTextBuffer< CharT, ByteT >::state_type
template<typename CharT, typename ByteT>
typedef std::char_traits<CharT> cxxtools::BasicTextBuffer< CharT, ByteT >::traits_type

Constructor & Destructor Documentation

template<typename CharT, typename ByteT>
cxxtools::BasicTextBuffer< CharT, ByteT >::BasicTextBuffer ( std::basic_ios< extern_type > *  target,
CodecType codec 
)
inline

Creates a BasicTextBuffer using the given stream buffer and codec.

The given stream buffer target is used as external device, buffered by this Text buffer and all input from and output to the external device is converted using the codec codec.

Note: The Codec object which is passed as pointer will be managed by this class and also be deleted by this class on destruction.

template<typename CharT, typename ByteT>
cxxtools::BasicTextBuffer< CharT, ByteT >::~BasicTextBuffer ( ) throw ()
inline

Member Function Documentation

template<typename CharT, typename ByteT>
void cxxtools::BasicTextBuffer< CharT, ByteT >::attach ( std::basic_ios< extern_type > &  target)
inline
template<typename CharT, typename ByteT>
static void cxxtools::BasicTextBuffer< CharT, ByteT >::copyBytes ( char_type s1,
const extern_type s2,
size_t  n 
)
inlinestaticprotected
template<typename CharT, typename ByteT>
static void cxxtools::BasicTextBuffer< CharT, ByteT >::copyChars ( extern_type s1,
const char_type s2,
size_t  n 
)
inlinestaticprotected
template<typename CharT, typename ByteT>
void cxxtools::BasicTextBuffer< CharT, ByteT >::detach ( )
inline
template<typename CharT, typename ByteT>
std::pair<int_type, std::streamsize> cxxtools::BasicTextBuffer< CharT, ByteT >::do_underflow ( std::streamsize  size)
inlineprotected
template<typename CharT, typename ByteT>
std::streamsize cxxtools::BasicTextBuffer< CharT, ByteT >::import ( )
inline
template<typename CharT, typename ByteT>
virtual int_type cxxtools::BasicTextBuffer< CharT, ByteT >::overflow ( int_type  ch = traits_type::eof())
inlineprotectedvirtual
template<typename CharT, typename ByteT>
virtual std::streamsize cxxtools::BasicTextBuffer< CharT, ByteT >::showmanyc ( )
inlineprotectedvirtual
template<typename CharT, typename ByteT>
virtual int cxxtools::BasicTextBuffer< CharT, ByteT >::sync ( )
inlineprotectedvirtual
template<typename CharT, typename ByteT>
int cxxtools::BasicTextBuffer< CharT, ByteT >::terminate ( )
inline
template<typename CharT, typename ByteT>
virtual int_type cxxtools::BasicTextBuffer< CharT, ByteT >::underflow ( )
inlineprotectedvirtual

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