CppCMS
Public Member Functions | List of all members
cppcms::util::steal_buffer< Size > Class Template Reference

This is a special buffer that allows to "steal" some chunk of text from the output stream. More...

#include <cppcms/steal_buf.h>

Inheritance diagram for cppcms::util::steal_buffer< Size >:
cppcms::util::stackbuf< Size >

Public Member Functions

 steal_buffer (std::ostream &out)
 
 steal_buffer ()
 
void steal (std::ostream &out)
 
void release ()
 
- Public Member Functions inherited from cppcms::util::stackbuf< Size >
char * begin ()
 
char * end ()
 
char * c_str ()
 
std::string str ()
 

Additional Inherited Members

- Protected Member Functions inherited from cppcms::util::stackbuf< Size >
int overflow (int c)
 

Detailed Description

template<size_t Size = 128>
class cppcms::util::steal_buffer< Size >

This is a special buffer that allows to "steal" some chunk of text from the output stream.

It does this by replacing stream's streambuf object with temporary stream buffer that records all data written to the stream and then returns the original buffer upon call to release() member function it steal_buffer destruction.

The Size parameter defines the default chunk of memory allocated on the stack before heap is used.

Constructor & Destructor Documentation

template<size_t Size = 128>
cppcms::util::steal_buffer< Size >::steal_buffer ( std::ostream &  out)
inline

Create the buffer and "Steal" the buffer from out

template<size_t Size = 128>
cppcms::util::steal_buffer< Size >::steal_buffer ( )
inline

Create an empty buffer

Member Function Documentation

template<size_t Size = 128>
void cppcms::util::steal_buffer< Size >::release ( )
inline

Release the "stolen" buffer back, now the buffer contains all the data that was recorded.

template<size_t Size = 128>
void cppcms::util::steal_buffer< Size >::steal ( std::ostream &  out)
inline

Steal the buffer from out


The documentation for this class was generated from the following file: