textwolf  0.2
Public Member Functions | List of all members
textwolf::StaticBuffer Class Reference

Simple back insertion sequence for storing the outputs of textwolf in a contant size buffer. More...

#include <staticbuffer.hpp>

Inheritance diagram for textwolf::StaticBuffer:
textwolf::throws_exception

Public Member Functions

 StaticBuffer (std::size_t n)
 Constructor. More...
 
 StaticBuffer (char *p, std::size_t n, std::size_t i=0)
 Constructor. More...
 
 StaticBuffer (const StaticBuffer &o)
 Copy constructor. More...
 
 ~StaticBuffer ()
 Destructor. More...
 
void clear ()
 Clear the buffer content. More...
 
void push_back (char ch)
 Append one character. More...
 
void append (const char *cc, std::size_t ccsize)
 Append an array of characters. More...
 
std::size_t size () const
 Return the number of characters in the buffer. More...
 
const char * ptr () const
 Return the buffer content as 0-terminated string. More...
 
void resize (std::size_t n, char c=0)
 Shrinks the size of the buffer or expands it with c. More...
 
char operator[] (std::size_t ii) const
 random access of element More...
 
char & at (std::size_t ii) const
 random access of element reference More...
 
bool overflow () const
 check for array bounds write More...
 

Additional Inherited Members

- Public Types inherited from textwolf::throws_exception
enum  Cause {
  Unknown, DimOutOfRange, StateNumbersNotAscending, InvalidParamState,
  InvalidParamChar, DuplicateStateTransition, InvalidState, IllegalParam,
  IllegalAttributeName, OutOfMem, ArrayBoundsReadWrite, NotAllowedOperation,
  FileReadError, IllegalXmlHeader, InvalidTagOffset, CorruptTagStack,
  CodePageIndexNotSupported
}
 Enumeration of error cases. More...
 

Detailed Description

Simple back insertion sequence for storing the outputs of textwolf in a contant size buffer.

Constructor & Destructor Documentation

textwolf::StaticBuffer::StaticBuffer ( std::size_t  n)
inlineexplicit

Constructor.

textwolf::StaticBuffer::StaticBuffer ( char *  p,
std::size_t  n,
std::size_t  i = 0 
)
inline

Constructor.

textwolf::StaticBuffer::StaticBuffer ( const StaticBuffer o)
inline

Copy constructor.

textwolf::StaticBuffer::~StaticBuffer ( )
inline

Destructor.

Member Function Documentation

void textwolf::StaticBuffer::append ( const char *  cc,
std::size_t  ccsize 
)
inline

Append an array of characters.

Parameters
[in]ccthe characters to append
[in]ccsizethe number of characters to append
char& textwolf::StaticBuffer::at ( std::size_t  ii) const
inline

random access of element reference

Parameters
[in]ii
Returns
the reference to the character at this position
void textwolf::StaticBuffer::clear ( )
inline

Clear the buffer content.

char textwolf::StaticBuffer::operator[] ( std::size_t  ii) const
inline

random access of element

Parameters
[in]ii
Returns
the character at this position
bool textwolf::StaticBuffer::overflow ( ) const
inline

check for array bounds write

Returns
true if a push_back would have caused an array bounds write
const char* textwolf::StaticBuffer::ptr ( ) const
inline

Return the buffer content as 0-terminated string.

Returns
the C-string
void textwolf::StaticBuffer::push_back ( char  ch)
inline

Append one character.

Parameters
[in]chthe character to append
void textwolf::StaticBuffer::resize ( std::size_t  n,
char  c = 0 
)
inline

Shrinks the size of the buffer or expands it with c.

Parameters
[in]nnew size of the buffer
[in]cfill character if n bigger than the current fill size
std::size_t textwolf::StaticBuffer::size ( ) const
inline

Return the number of characters in the buffer.

Returns
the number of characters (bytes)

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