zorba::transcode::auto_attach#include <zorba/util/transcode_stream.h> A transcode::auto_attach is a class that attaches a transcode::streambuf to a stream and automatically detaches it when the auto_attach object is destroyed.void f( ostream &os ) { transcode::auto_attach<ostream> const raii( os, "ISO-8859-1" ); // ... }A transcode::auto_attach is useful for streams not created by you. Private Attributes
Public Functions
Private Attributesstream_StreamType * stream_
Public Functionsattachbool attach(StreamType &stream, char const *charset) Calls transcode::attach() on the given stream.
Parameters
Returnstrue only if a transcode::streambuf was attached.auto_attach auto_attach() Default constructor; does nothing.
auto_attach auto_attach(StreamType &stream, char const *charset) Constructs an auto_attach object calling attach() on the given stream.
Parameters
auto_attach auto_attach(auto_attach &from) Copy constructor that takes ownership of the stream.
Parameters
operator=auto_attach & operator=(auto_attach &from) Assignment operator that takes ownership of the stream.
Parameters
Returns*this.~auto_attach ~auto_attach() Destroys this auto_attach object calling detach() on the previously attached stream, if any.
|