Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
GenericMemoryBuffer< Allocator > Struct Template Reference

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

#include <fwd.h>

Public Types

typedef char Ch
 

Public Member Functions

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

Public Attributes

internal::Stack< Allocator > stack_
 

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 83 of file fwd.h.

Member Typedef Documentation

template<typename Allocator = CrtAllocator>
typedef char GenericMemoryBuffer< Allocator >::Ch

Definition at line 40 of file memorybuffer.h.

Constructor & Destructor Documentation

template<typename Allocator = CrtAllocator>
GenericMemoryBuffer< Allocator >::GenericMemoryBuffer ( Allocator *  allocator = 0,
size_t  capacity = kDefaultCapacity 
)
inline

Definition at line 42 of file memorybuffer.h.

Member Function Documentation

template<typename Allocator = CrtAllocator>
void GenericMemoryBuffer< Allocator >::Clear ( )
inline

Definition at line 54 of file memorybuffer.h.

template<typename Allocator = CrtAllocator>
void GenericMemoryBuffer< Allocator >::Flush ( )
inline

Definition at line 50 of file memorybuffer.h.

template<typename Allocator = CrtAllocator>
const Ch* GenericMemoryBuffer< Allocator >::GetBuffer ( ) const
inline

Definition at line 71 of file memorybuffer.h.

template<typename Allocator = CrtAllocator>
size_t GenericMemoryBuffer< Allocator >::GetSize ( ) const
inline

Definition at line 76 of file memorybuffer.h.

template<typename Allocator = CrtAllocator>
void GenericMemoryBuffer< Allocator >::Pop ( size_t  count)
inline

Definition at line 66 of file memorybuffer.h.

template<typename Allocator = CrtAllocator>
Ch* GenericMemoryBuffer< Allocator >::Push ( size_t  count)
inline

Definition at line 62 of file memorybuffer.h.

template<typename Allocator = CrtAllocator>
void GenericMemoryBuffer< Allocator >::Put ( Ch  c)
inline

Definition at line 46 of file memorybuffer.h.

template<typename Allocator = CrtAllocator>
void GenericMemoryBuffer< Allocator >::ShrinkToFit ( )
inline

Definition at line 58 of file memorybuffer.h.

Member Data Documentation

template<typename Allocator = CrtAllocator>
const size_t GenericMemoryBuffer< Allocator >::kDefaultCapacity = 256
static

Definition at line 81 of file memorybuffer.h.

template<typename Allocator = CrtAllocator>
internal::Stack<Allocator> GenericMemoryBuffer< Allocator >::stack_
mutable

Definition at line 82 of file memorybuffer.h.


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


xbot_talker
Author(s): wangxiaoyun
autogenerated on Sat Oct 10 2020 03:27:54