#include <m2mstringbuffer.h>
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 |
This class performs common string concatenation operations on a fixed-sized buffers.
|
inline |
Initialize a empty buffer with zero length and zero content.
|
inline |
Append given char to end of string. Return false if the buffer would overflow, true otherwise.
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.
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.
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.
|
inline |
Get a read only pointer to the data.
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.
|
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().