All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
rapidjson::GenericStringBuffer< Encoding, Allocator > Struct Template Reference

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

#include <stringbuffer.h>

Public Types

typedef Encoding::Ch Ch
 

Public Member Functions

 GenericStringBuffer (Allocator *allocator=0, size_t capacity=kDefaultCapacity)
 
void Put (Ch c)
 
void Flush ()
 
void Clear ()
 
void ShrinkToFit ()
 
ChPush (size_t count)
 
void Pop (size_t count)
 
const ChGetString () const
 
size_t GetSize () 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.
Note
implements Stream concept

Definition at line 36 of file stringbuffer.h.

Member Typedef Documentation

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

Definition at line 37 of file stringbuffer.h.

Constructor & Destructor Documentation

template<typename Encoding , typename Allocator = CrtAllocator>
rapidjson::GenericStringBuffer< Encoding, Allocator >::GenericStringBuffer ( Allocator allocator = 0,
size_t  capacity = kDefaultCapacity 
)
inline

Definition at line 39 of file stringbuffer.h.

39 : stack_(allocator, capacity) {}
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:65

Member Function Documentation

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

Definition at line 44 of file stringbuffer.h.

44 { stack_.Clear(); }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:65
template<typename Encoding , typename Allocator = CrtAllocator>
void rapidjson::GenericStringBuffer< Encoding, Allocator >::Flush ( )
inline

Definition at line 42 of file stringbuffer.h.

42 {}
template<typename Encoding , typename Allocator = CrtAllocator>
size_t rapidjson::GenericStringBuffer< Encoding, Allocator >::GetSize ( ) const
inline

Definition at line 62 of file stringbuffer.h.

62 { return stack_.GetSize(); }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:65
template<typename Encoding , typename Allocator = CrtAllocator>
const Ch* rapidjson::GenericStringBuffer< Encoding, Allocator >::GetString ( ) const
inline

Definition at line 54 of file stringbuffer.h.

54  {
55  // Push and pop a null terminator. This is safe.
56  *stack_.template Push<Ch>() = '\0';
57  stack_.template Pop<Ch>(1);
58 
59  return stack_.template Bottom<Ch>();
60  }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:65
template<typename Encoding , typename Allocator = CrtAllocator>
void rapidjson::GenericStringBuffer< Encoding, Allocator >::Pop ( size_t  count)
inline

Definition at line 52 of file stringbuffer.h.

52 { stack_.template Pop<Ch>(count); }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:65
template<typename Encoding , typename Allocator = CrtAllocator>
Ch* rapidjson::GenericStringBuffer< Encoding, Allocator >::Push ( size_t  count)
inline

Definition at line 51 of file stringbuffer.h.

51 { return stack_.template Push<Ch>(count); }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:65
template<typename Encoding , typename Allocator = CrtAllocator>
void rapidjson::GenericStringBuffer< Encoding, Allocator >::Put ( Ch  c)
inline

Definition at line 41 of file stringbuffer.h.

41 { *stack_.template Push<Ch>() = c; }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:65
template<typename Encoding , typename Allocator = CrtAllocator>
void rapidjson::GenericStringBuffer< Encoding, Allocator >::ShrinkToFit ( )
inline

Definition at line 45 of file stringbuffer.h.

45  {
46  // Push and pop a null terminator. This is safe.
47  *stack_.template Push<Ch>() = '\0';
48  stack_.ShrinkToFit();
49  stack_.template Pop<Ch>(1);
50  }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:65

Member Data Documentation

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

Definition at line 64 of file stringbuffer.h.

template<typename Encoding , typename Allocator = CrtAllocator>
internal::Stack<Allocator> rapidjson::GenericStringBuffer< Encoding, Allocator >::stack_
mutable

Definition at line 65 of file stringbuffer.h.


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