cppcms::util::stackbuf< OnStackSize > Class Template Reference

Very simple output stream buffer that uses stack for small chunks of text and then allocates memory of the default buffer is too small. More...

`#include <cppcms/steal_buf.h>`

Inheritance diagram for cppcms::util::stackbuf< OnStackSize >:

## Public Member Functions

char * | begin ()
char * | end ()
char * | c_str ()
std::string | str ()

## Protected Member Functions

int | overflow (int c)

## Detailed Description

### template<size_t OnStackSize = 128>
class cppcms::util::stackbuf< OnStackSize >

Very simple output stream buffer that uses stack for small chunks of text and then allocates memory of the default buffer is too small.

It is something like std::stringbuf with small string optimization, it also allows to access the memory without actually creating the string itself.

The template parameter defines how many characters should be allocated on stack by default before heap is used.

## Member Function Documentation

template<size_t OnStackSize = 128>

char* cppcms::util::stackbuf< OnStackSize >::begin | ( |  | ) |

inline

get the pointer to the beginning of the output buffer

Referenced by cppcms::util::stackstream< Size >::begin(), cppcms::util::stackbuf< Size >::c_str(), and cppcms::util::stackbuf< Size >::str().

template<size_t OnStackSize = 128>

char* cppcms::util::stackbuf< OnStackSize >::c_str | ( |  | ) |

inline

get the 0 terminated string from the buffer.

Referenced by cppcms::util::stackstream< Size >::c_str().

template<size_t OnStackSize = 128>

char* cppcms::util::stackbuf< OnStackSize >::end | ( |  | ) |

inline

get the pointer to the end of the output buffer

Referenced by cppcms::util::stackstream< Size >::end(), and cppcms::util::stackbuf< Size >::str().

template<size_t OnStackSize = 128>

std::string cppcms::util::stackbuf< OnStackSize >::str | ( |  | ) |

inline

get the std::string from the buffer.

Referenced by cppcms::util::stackstream< Size >::str().

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

- cppcms/steal_buf.h