rapidjson::GenericStringBuffer< Encoding, Allocator > Struct Template Reference

Represents an in-memory output stream. More...

#include <stringbuffer.h>

+ Inheritance diagram for rapidjson::GenericStringBuffer< Encoding, Allocator >:

Public Types

typedef Encoding::Ch Ch
 

Public Member Functions

 GenericStringBuffer (Allocator *allocator=0, size_t capacity=kDefaultCapacity)
 
void Put (Ch c)
 
void Clear ()
 
const charGetString () const
 
size_t Size () const
 

Public Attributes

internal::Stack< Allocatorstack_
 

Static Public Attributes

static const size_t kDefaultCapacity = 256
 

Detailed Description

template<typename Encoding, typename Allocator = CrtAllocator>
struct rapidjson::GenericStringBuffer< Encoding, Allocator >

Represents an in-memory output stream.

Template Parameters
EncodingEncoding of the stream.
Allocatortype for allocating memory buffer.

Member Typedef Documentation

◆ Ch

template<typename Encoding , typename Allocator = CrtAllocator>
typedef Encoding::Ch rapidjson::GenericStringBuffer< Encoding, Allocator >::Ch

Constructor & Destructor Documentation

◆ GenericStringBuffer()

template<typename Encoding , typename Allocator = CrtAllocator>
rapidjson::GenericStringBuffer< Encoding, Allocator >::GenericStringBuffer ( Allocator allocator = 0,
size_t  capacity = kDefaultCapacity 
)
inline
44 : stack_(allocator, capacity) {}
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:61

Member Function Documentation

◆ Clear()

template<typename Encoding , typename Allocator = CrtAllocator>
void rapidjson::GenericStringBuffer< Encoding, Allocator >::Clear ( )
inline

◆ GetString()

template<typename Encoding , typename Allocator = CrtAllocator>
const char* rapidjson::GenericStringBuffer< Encoding, Allocator >::GetString ( ) const
inline
50  {
51  // Push and pop a null terminator. This is safe.
52  *stack_.template Push<Ch>() = '\0';
53  stack_.template Pop<Ch>(1);
54 
55  return stack_.template Bottom<Ch>();
56  }

References rapidjson::GenericStringBuffer< Encoding, Allocator >::stack_.

◆ Put()

template<typename Encoding , typename Allocator = CrtAllocator>
void rapidjson::GenericStringBuffer< Encoding, Allocator >::Put ( Ch  c)
inline
46 { *stack_.template Push<Ch>() = c; }

References rapidjson::GenericStringBuffer< Encoding, Allocator >::stack_.

◆ Size()

template<typename Encoding , typename Allocator = CrtAllocator>
size_t rapidjson::GenericStringBuffer< Encoding, Allocator >::Size ( ) const
inline

Member Data Documentation

◆ kDefaultCapacity

template<typename Encoding , typename Allocator = CrtAllocator>
const size_t rapidjson::GenericStringBuffer< Encoding, Allocator >::kDefaultCapacity = 256
static

◆ stack_


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