bes  Updated for version 3.20.10
GenericMemoryBuffer< Allocator > Struct Template Reference

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

#include <memorybuffer.h>

Collaboration diagram for GenericMemoryBuffer< Allocator >:
Collaboration graph

Public Types

typedef char Ch
 

Public Member Functions

void Clear ()
 
void Flush ()
 
 GenericMemoryBuffer (Allocator *allocator=0, size_t capacity=kDefaultCapacity)
 
const Ch * GetBuffer () const
 
size_t GetSize () const
 
void Pop (size_t count)
 
Ch * Push (size_t count)
 
void Put (Ch c)
 
void ShrinkToFit ()
 

Public Attributes

internal::Stack< Allocatorstack_
 

Static Public Attributes

static const size_t kDefaultCapacity = 256
 

Detailed Description

template<typename Allocator = CrtAllocator>
struct GenericMemoryBuffer< Allocator >

Represents an in-memory output byte stream.

This class is mainly for being wrapped by EncodedOutputStream or AutoUTFOutputStream.

It is similar to FileWriteBuffer but the destination is an in-memory buffer instead of a file.

Differences between MemoryBuffer and StringBuffer:

  1. StringBuffer has Encoding but MemoryBuffer is only a byte buffer.
  2. StringBuffer::GetString() returns a null-terminated string. MemoryBuffer::GetBuffer() returns a buffer without terminator.
Template Parameters
Allocatortype for allocating memory buffer.
Note
implements Stream concept

Definition at line 37 of file memorybuffer.h.


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