Classes | Functions
zorba::base64 Namespace Reference

Classes

class  auto_attach
 A base64::auto_attach is a class that attaches a base64::streambuf to a stream and automatically detaches it when the auto_attach object is destroyed. More...
class  stream
 A base64::stream is used to wrap a C++ standard I/O stream with a base64::streambuf so that encoding/decoding and the management of the streambuf happens automatically. More...
class  streambuf
 A base64::streambuf is-a std::streambuf for encoding to and decoding from Base64 on-the-fly. More...

Functions

template<typename charT , typename Traits >
void attach (std::basic_ios< charT, Traits > &ios)
 Attaches a base64::streambuf to a stream.
template<typename charT , typename Traits >
void detach (std::basic_ios< charT, Traits > &ios)
 Detaches a previously attached base64::streambuf from a stream.
template<typename charT , typename Traits >
bool is_attached (std::basic_ios< charT, Traits > &ios)
 Checks whether the given stream has a base64::streambuf attached.

Function Documentation

template<typename charT , typename Traits >
void zorba::base64::attach ( std::basic_ios< charT, Traits > &  ios)
inline

Attaches a base64::streambuf to a stream.

Unlike using a base64::streambuf directly, this function will create the streambuf, attach it to the stream, and manage it for the lifetime of the stream automatically.

Parameters:
iosThe stream to attach the base64::streambuf to. If the stream already has a base64::streambuf attached to it, this function does nothing.

Definition at line 153 of file base64_stream.h.

References zorba::internal::base64::alloc_streambuf(), zorba::internal::base64::get_streambuf_index(), and zorba::internal::stream_callback().

Referenced by zorba::base64::auto_attach< StreamType >::auto_attach().

template<typename charT , typename Traits >
void zorba::base64::detach ( std::basic_ios< charT, Traits > &  ios)
inline

Detaches a previously attached base64::streambuf from a stream.

The streambuf is destroyed and the stream's original streambuf is restored.

Parameters:
iosThe stream to detach the base64::streambuf from. If the stream doesn't have a base64::streambuf attached to it, this function does nothing.

Definition at line 174 of file base64_stream.h.

References zorba::internal::dealloc_streambuf(), and zorba::internal::base64::get_streambuf_index().

Referenced by zorba::base64::auto_attach< StreamType >::~auto_attach().

template<typename charT , typename Traits >
bool zorba::base64::is_attached ( std::basic_ios< charT, Traits > &  ios)
inline

Checks whether the given stream has a base64::streambuf attached.

Parameters:
iosThe stream to check.
Returns:
true only if a base64::streambuf is attached.

Definition at line 190 of file base64_stream.h.

References zorba::internal::base64::get_streambuf_index().

blog comments powered by Disqus