Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

BasicTextBuffer Class Template Reference

Converts character sequences with different encodings. More...

#include <cxxtools/textbuffer.h>

List of all members.

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.
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)
template<typename T>
void copyChars (T *s1, const T *s2, size_t n)
template<typename A, typename B>
void copyChars (A *s1, const B *s2, size_t n)


Detailed Description

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

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


Constructor & Destructor Documentation

BasicTextBuffer ( std::basic_ios< extern_type > *  target,
CodecType 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.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6