Mistake on this page? Email us
StringBuffer< SIZE > Class Template Reference

#include <m2mstringbuffer.h>

Inheritance diagram for StringBuffer< SIZE >:
StringBufferBase

Public Member Functions

 StringBuffer ()
 
bool ensure_space (size_t required_size) const
 
bool append (char data)
 
bool append (const char *data)
 
bool append (const char *data, size_t data_len)
 
bool append_int (uint16_t data)
 
size_t get_size () const
 
int find_last_of (char search_char) const
 
const char * c_str () const
 

Detailed Description

template<int SIZE>
class StringBuffer< SIZE >

This class performs common string concatenation operations on a fixed-sized buffers.

Constructor & Destructor Documentation

template<int SIZE>
StringBuffer< SIZE >::StringBuffer ( )
inline

Initialize a empty buffer with zero length and zero content.

Member Function Documentation

template<int SIZE>
bool StringBuffer< SIZE >::append ( char  data)
inline

Append given char to end of string. Return false if the buffer would overflow, true otherwise.

template<int SIZE>
bool StringBuffer< SIZE >::append ( const char *  data)

Append given zero terminated string to end of buffer.

Return false if the buffer would overflow, true otherwise.

Note: the whole string, including the zero terminator must fit to buffer or the append operation is not done and false is returned.

template<int SIZE>
bool StringBuffer< SIZE >::append ( const char *  data,
size_t  data_len 
)

Append given block of chars to end of buffer.

Return false if the buffer would overflow, true otherwise.

Note: the whole string, including the zero terminator must fit to buffer or the append operation is not done and false is returned.

template<int SIZE>
bool StringBuffer< SIZE >::append_int ( uint16_t  data)

Convert given uint16_t into string representation and add it to the end of buffer.

Note: the whole string, including the zero terminator must fit to buffer or the append operation is not done and false is returned.

template<int SIZE>
const char * StringBuffer< SIZE >::c_str ( ) const
inline

Get a read only pointer to the data.

template<int SIZE>
bool StringBuffer< SIZE >::ensure_space ( size_t  required_size) const

Verify, if the buffer has still room for given amount of bytes. Note: the given size value must include the zero terminator as it is not implicitly taken into account for.

template<int SIZE>
size_t StringBuffer< SIZE >::get_size ( ) const
inline

Get the amount of bytes added to the buffer.

Note: the size does not include the terminating zero, so this is functionally equal to strlen().


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