![]() |
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
Build a dynamically-sized string in RAM using the PropWare::Printer interface.
More...
#include <PropWare/string/stringbuilder.h>
Inheritance diagram for PropWare::StringBuilder:
Collaboration diagram for PropWare::StringBuilder:Public Member Functions | |
| StringBuilder (const size_t initialSize=DEFAULT_SPACE_ALLOCATED) | |
| Initialize with a given size to start with. Picking the correct size can increase performance. More... | |
| ~StringBuilder () | |
| Free all memory allocated for the string buffer. | |
| void | put_char (const char c) |
| Print a single character. More... | |
| void | puts (const char string[]) |
| Send a null-terminated character array. Though this method could be created using put_char, some objects (such as PropWare::UART), have optimized methods for sending a string and PrintCapable::puts can utilize them. More... | |
| const char * | to_string () const |
| Retrieve the address of the string buffer. | |
| uint16_t | get_size () const |
| Determine the length of the string, not including the null terminator. | |
| void | clear () |
| Remove all characters from the string and reallocate to the original size (if needed) | |
Static Public Attributes | |
| static const uint16_t | DEFAULT_SPACE_ALLOCATED = 64 |
Build a dynamically-sized string in RAM using the PropWare::Printer interface.
Definition at line 37 of file stringbuilder.h.
| PropWare::StringBuilder::StringBuilder | ( | const size_t | initialSize = DEFAULT_SPACE_ALLOCATED | ) |
Initialize with a given size to start with. Picking the correct size can increase performance.
| [in] | initialSize | Number of bytes that should be (dynamically) allocated for the string buffer |
Definition at line 47 of file stringbuilder.h.
|
virtual |
Print a single character.
| [in] | c | Individual char to be printed |
Implements PropWare::PrintCapable.
Definition at line 62 of file stringbuilder.h.
|
virtual |
Send a null-terminated character array. Though this method could be created using put_char, some objects (such as PropWare::UART), have optimized methods for sending a string and PrintCapable::puts can utilize them.
string[] must be terminated with a null terminator| [in] | string[] | Array of data words with the final word being 0 - the null terminator |
Implements PropWare::PrintCapable.
Definition at line 70 of file stringbuilder.h.
1.8.17