TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GenericStringBuffer< Encoding, Allocator > Class 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< Allocator > stack_
 

Static Public Attributes

static const size_t kDefaultCapacity = 256
 

Private Member Functions

 GenericStringBuffer (const GenericStringBuffer &)
 
GenericStringBufferoperator= (const GenericStringBuffer &)
 

Detailed Description

template<typename Encoding, typename Allocator = CrtAllocator>
class GenericStringBuffer< Encoding, Allocator >

Represents an in-memory output stream.

Template Parameters
EncodingEncoding of the stream.
Allocatortype for allocating memory buffer.
Note
implements Stream concept

Member Typedef Documentation

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

Constructor & Destructor Documentation

template<typename Encoding, typename Allocator = CrtAllocator>
GenericStringBuffer< Encoding, Allocator >::GenericStringBuffer ( Allocator *  allocator = 0,
size_t  capacity = kDefaultCapacity 
)
inline
39 : stack_(allocator, capacity) {}
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:74
template<typename Encoding, typename Allocator = CrtAllocator>
GenericStringBuffer< Encoding, Allocator >::GenericStringBuffer ( const GenericStringBuffer< Encoding, Allocator > &  )
private

Member Function Documentation

template<typename Encoding, typename Allocator = CrtAllocator>
void GenericStringBuffer< Encoding, Allocator >::Clear ( )
inline
53 { stack_.Clear(); }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:74
template<typename Encoding, typename Allocator = CrtAllocator>
void GenericStringBuffer< Encoding, Allocator >::Flush ( )
inline
51 {}
template<typename Encoding, typename Allocator = CrtAllocator>
size_t GenericStringBuffer< Encoding, Allocator >::GetSize ( ) const
inline
71 { return stack_.GetSize(); }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:74
template<typename Encoding, typename Allocator = CrtAllocator>
const Ch* GenericStringBuffer< Encoding, Allocator >::GetString ( ) const
inline
63  {
64  // Push and pop a null terminator. This is safe.
65  *stack_.template Push<Ch>() = '\0';
66  stack_.template Pop<Ch>(1);
67 
68  return stack_.template Bottom<Ch>();
69  }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:74
template<typename Encoding, typename Allocator = CrtAllocator>
GenericStringBuffer& GenericStringBuffer< Encoding, Allocator >::operator= ( const GenericStringBuffer< Encoding, Allocator > &  )
private
template<typename Encoding, typename Allocator = CrtAllocator>
void GenericStringBuffer< Encoding, Allocator >::Pop ( size_t  count)
inline
61 { stack_.template Pop<Ch>(count); }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:74
template<typename Encoding, typename Allocator = CrtAllocator>
Ch* GenericStringBuffer< Encoding, Allocator >::Push ( size_t  count)
inline
60 { return stack_.template Push<Ch>(count); }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:74
template<typename Encoding, typename Allocator = CrtAllocator>
void GenericStringBuffer< Encoding, Allocator >::Put ( Ch  c)
inline
50 { *stack_.template Push<Ch>() = c; }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:74
template<typename Encoding, typename Allocator = CrtAllocator>
void GenericStringBuffer< Encoding, Allocator >::ShrinkToFit ( )
inline
54  {
55  // Push and pop a null terminator. This is safe.
56  *stack_.template Push<Ch>() = '\0';
57  stack_.ShrinkToFit();
58  stack_.template Pop<Ch>(1);
59  }
internal::Stack< Allocator > stack_
Definition: stringbuffer.h:74

Member Data Documentation

template<typename Encoding, typename Allocator = CrtAllocator>
const size_t GenericStringBuffer< Encoding, Allocator >::kDefaultCapacity = 256
static
template<typename Encoding, typename Allocator = CrtAllocator>
internal::Stack<Allocator> GenericStringBuffer< Encoding, Allocator >::stack_
mutable

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