Public Member Functions | List of all members
zorba::base64::auto_attach< StreamType > Class Template Reference

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...

#include <zorba/base64_stream.h>

Public Member Functions

 auto_attach (StreamType &stream)
 Constructs an auto_attach object calling attach() on the given stream. More...
 
 ~auto_attach ()
 Destroys this auto_attach object calling detach() on the previously attached stream. More...
 

Detailed Description

template<class StreamType>
class zorba::base64::auto_attach< StreamType >

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.

void f( ostream &os ) {
base64::auto_attach<ostream> const raii( os, "ISO-8859-1" );
// ...
}

A base64::auto_attach is useful for streams not created by you.

See Also
http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization

Definition at line 209 of file base64_stream.h.

Constructor & Destructor Documentation

template<class StreamType >
zorba::base64::auto_attach< StreamType >::auto_attach ( StreamType &  stream)
inline

Constructs an auto_attach object calling attach() on the given stream.

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

Definition at line 218 of file base64_stream.h.

References zorba::base64::attach().

template<class StreamType >
zorba::base64::auto_attach< StreamType >::~auto_attach ( )
inline

Destroys this auto_attach object calling detach() on the previously attached stream.

Definition at line 226 of file base64_stream.h.

References zorba::base64::detach().


The documentation for this class was generated from the following file:
blog comments powered by Disqus