zorba::transcode::streambuf#include <zorba/util/transcode_stream.h> A transcode::streambuf is-a std::streambuf for transcoding character encodings from/to UTF-8 on-the-fly. To use it, replace a stream's streambuf:istream is; // ... transcode::streambuf tbuf( "ISO-8859-1", is.rdbuf() ); is.ios::rdbuf( &tbuf );Note that the transcode::streambuf must exist for as long as it's being used by the stream. If you are replacing the streabuf for a stream you did not create, you should set it back to the original streambuf: void f( ostream &os ) { transcode::streambuf tbuf( "ISO-8859-1", os.rdbuf() ); try { os.ios::rdbuf( &tbuf ); // ... } catch ( ... ) { os.ios::rdbuf( tbuf.orig_streambuf() ); throw; } os.ios::rdbuf( tbuf.orig_streambuf() ); }Alternatively, you may wish to use either , , or instead.While transcode::streambuf does support seeking, the positions are relative to the original byte stream. Private AttributesPublic Functions
Protected Functions
Private AttributesPublic Functionsorig_streambufstd::streambuf * orig_streambuf() const Gets the original streambuf.
Returnssaid streambuf.streambuf streambuf(char const *charset, std::streambuf *orig) Constructs a transcode::streambuf.
Parameters
Parameters
~streambuf ~streambuf() Destructs a transcode::streambuf.
Protected Functionsimbuevoid imbue(std::locale const &)
overflowint_type overflow(int_type)
pbackfailint_type pbackfail(int_type)
seekoffpos_type seekoff(off_type, std::ios_base::seekdir, std::ios_base::openmode)
seekpospos_type seekpos(pos_type, std::ios_base::openmode)
setbufstd::streambuf * setbuf(char_type *, std::streamsize)
showmanycstd::streamsize showmanyc()
syncint sync()
uflowint_type uflow()
underflowint_type underflow()
xsgetnstd::streamsize xsgetn(char_type *, std::streamsize)
xsputnstd::streamsize xsputn(char_type const *, std::streamsize)
Private Functionsstreambuf streambuf(streambuf const &)
|