#include <rex/string/text.h>
|
| | StringBuffer (size_t initial_capacity=0) |
| char * | GetBuffer () const |
| size_t | GetLength () const |
| void | Reset () |
|
void | Append (char c) |
| void | Append (char c, size_t count) |
|
void | Append (const char *value) |
|
void | Append (const std::string_view value) |
| template<typename... Args> |
| void | AppendFormat (std::format_string< const Args &... > format, const Args &... args) |
| void | AppendVarargs (const char *format, va_list args) |
|
void | AppendBytes (const u8 *buffer, size_t length) |
|
std::string | ToString () |
| std::string_view | ToStringView () const |
| std::vector< u8 > | ToBytes () const |
Growable character buffer that stays NUL terminated after every append.
◆ StringBuffer()
| rex::string::StringBuffer::StringBuffer |
( |
size_t | initial_capacity = 0 | ) |
|
|
explicit |
Allocates the buffer.
- Parameters
-
| initial_capacity | Initial capacity in bytes. The buffer holds at least 16 KiB. |
◆ Append()
| void rex::string::StringBuffer::Append |
( |
char | c, |
|
|
size_t | count ) |
Appends a character count times.
◆ AppendFormat()
template<typename... Args>
| void rex::string::StringBuffer::AppendFormat |
( |
std::format_string< const Args &... > | format, |
|
|
const Args &... | args ) |
|
inline |
Appends text formatted with std::format.
- Parameters
-
| format | Format string, checked at compile time. |
◆ AppendVarargs()
| void rex::string::StringBuffer::AppendVarargs |
( |
const char * | format, |
|
|
va_list | args ) |
Appends text formatted with vsnprintf.
- Parameters
-
| format | printf format string. |
◆ GetBuffer()
| char * rex::string::StringBuffer::GetBuffer |
( |
| ) |
const |
|
inline |
Returns the characters. The contents are NUL terminated.
◆ GetLength()
| size_t rex::string::StringBuffer::GetLength |
( |
| ) |
const |
|
inline |
Returns the content length. The count excludes the terminator.
◆ Reset()
| void rex::string::StringBuffer::Reset |
( |
| ) |
|
Empties the buffer and keeps its capacity.
◆ ToBytes()
| std::vector< u8 > rex::string::StringBuffer::ToBytes |
( |
| ) |
const |
Copies the contents into a byte vector.
- Returns
- The contents without the terminator.
◆ ToStringView()
| std::string_view rex::string::StringBuffer::ToStringView |
( |
| ) |
const |
Returns a view of the contents. The view is valid until the next append or destruction.
The documentation for this class was generated from the following file: