Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
GenericStringBuffer< Encoding, Allocator > Class Template Reference

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

#include <stringbuffer.h>

Collaboration diagram for 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 PutUnsafe (Ch c)
 
void Flush ()
 
void Clear ()
 
void ShrinkToFit ()
 
void Reserve (size_t count)
 
ChPush (size_t count)
 
ChPushUnsafe (size_t count)
 
void Pop (size_t count)
 
const ChGetString () const
 
size_t GetSize () const
 Get the size of string in bytes in the string buffer.
 
size_t GetLength () const
 Get the length of string in Ch in the string buffer.
 

Public Attributes

internal::Stack< Allocatorstack_
 

Static Public Attributes

static const size_t kDefaultCapacity = 256
 

Detailed Description

template<typename Encoding, typename Allocator = CrtAllocator>
class GenericStringBuffer< Encoding, Allocator >
Template Parameters
EncodingEncoding of the stream.
Allocatortype for allocating memory buffer.
Note
implements Stream concept

Definition at line 41 of file stringbuffer.h.

Member Typedef Documentation

◆ Ch

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

Definition at line 43 of file stringbuffer.h.

Constructor & Destructor Documentation

◆ GenericStringBuffer()

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

Definition at line 45 of file stringbuffer.h.

45: stack_(allocator, capacity) {}
internal::Stack< Allocator > stack_

Member Function Documentation

◆ Clear()

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

Definition at line 60 of file stringbuffer.h.

60{ stack_.Clear(); }
Here is the caller graph for this function:

◆ Flush()

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

Definition at line 58 of file stringbuffer.h.

58{}

◆ GetLength()

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

Definition at line 85 of file stringbuffer.h.

85{ return stack_.GetSize() / sizeof(Ch); }
Here is the caller graph for this function:

◆ GetSize()

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

Definition at line 82 of file stringbuffer.h.

82{ return stack_.GetSize(); }
Here is the caller graph for this function:

◆ GetString()

template<typename Encoding , typename Allocator = CrtAllocator>
const Ch * GenericStringBuffer< Encoding, Allocator >::GetString ( ) const
inline

Definition at line 73 of file stringbuffer.h.

73 {
74 // Push and pop a null terminator. This is safe.
75 *stack_.template Push<Ch>() = '\0';
76 stack_.template Pop<Ch>(1);
77
78 return stack_.template Bottom<Ch>();
79 }
void Pop(size_t count)
Ch * Push(size_t count)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pop()

template<typename Encoding , typename Allocator = CrtAllocator>
void GenericStringBuffer< Encoding, Allocator >::Pop ( size_t count)
inline

Definition at line 71 of file stringbuffer.h.

71{ stack_.template Pop<Ch>(count); }
int * count
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Push()

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

Definition at line 69 of file stringbuffer.h.

69{ return stack_.template Push<Ch>(count); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PushUnsafe()

template<typename Encoding , typename Allocator = CrtAllocator>
Ch * GenericStringBuffer< Encoding, Allocator >::PushUnsafe ( size_t count)
inline

Definition at line 70 of file stringbuffer.h.

70{ return stack_.template PushUnsafe<Ch>(count); }
Ch * PushUnsafe(size_t count)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Put()

template<typename Encoding , typename Allocator = CrtAllocator>
void GenericStringBuffer< Encoding, Allocator >::Put ( Ch c)
inline

Definition at line 56 of file stringbuffer.h.

56{ *stack_.template Push<Ch>() = c; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PutUnsafe()

template<typename Encoding , typename Allocator = CrtAllocator>
void GenericStringBuffer< Encoding, Allocator >::PutUnsafe ( Ch c)
inline

Definition at line 57 of file stringbuffer.h.

57{ *stack_.template PushUnsafe<Ch>() = c; }
Here is the call graph for this function:

◆ Reserve()

template<typename Encoding , typename Allocator = CrtAllocator>
void GenericStringBuffer< Encoding, Allocator >::Reserve ( size_t count)
inline

Definition at line 68 of file stringbuffer.h.

68{ stack_.template Reserve<Ch>(count); }
void Reserve(size_t count)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShrinkToFit()

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

Definition at line 61 of file stringbuffer.h.

61 {
62 // Push and pop a null terminator. This is safe.
63 *stack_.template Push<Ch>() = '\0';
64 stack_.ShrinkToFit();
65 stack_.template Pop<Ch>(1);
66 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ kDefaultCapacity

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

Definition at line 87 of file stringbuffer.h.

◆ stack_

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

Definition at line 88 of file stringbuffer.h.


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