zorba::base64::streambuf#include <zorba/util/base64_stream.h> A base64::streambuf is-a std::streambuf for decoding from and encoding to Base64 on-the-fly while reading or writing, respectively. To use it, replace a stream's streambuf:istream is; // ... base64::streambuf b64buf( is.rdbuf() ); is.ios::rdbuf( &b64buf );Note that the base64::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 ) { base64::streambuf b64buf( os.rdbuf() ); try { os.ios::rdbuf( &b64buf ); // ... } catch ( ... ) { os.ios::rdbuf( b64buf.orig_streambuf() ); throw; } os.ios::rdbuf( b64buf.orig_streambuf() ); }Alternatively, you may wish to use either , , or instead.Note: due to the nature of Base64-encoding, when writing, you must ensure that the streambuf is flushed (by calling either pubsync() on the streambuf or flush() on the owning stream) when done.While base64::streambuf does support seeking, the positions are relative to the original byte stream. Public Functions
Protected Functions
Private Functions
Private Attributesgbuf_char gbuf_[3]
orig_buf_std::streambuf * orig_buf_
pbuf_char pbuf_[3]
plen_int plen_
Public Functionsorig_streambufstd::streambuf * orig_streambuf() const Gets the original streambuf.
Returnssaid streambuf.streambuf streambuf(std::streambuf *orig) Constructs a base64::streambuf.
Parameters
Parameters
~streambuf ~streambuf() Destructs a base64::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()
underflowint_type underflow()
xsgetnstd::streamsize xsgetn(char_type *, std::streamsize)
xsputnstd::streamsize xsputn(char_type const *, std::streamsize)
Private Functionsclearvoid clear()
resetgvoid resetg()
resetpvoid resetp()
streambuf streambuf(streambuf const &)
writepvoid writep()
|