|
nfx-stringbuilderpool 1.0.0
High-performance C++20 library for zero-allocation string building with thread-safe pooling
|
High-performance dynamic string buffer with efficient memory management. More...
#include <nfx/string/StringBuilderPool.h>
Public Types | |
| using | value_type = char |
| Character type for iterator compatibility. | |
| using | iterator = char * |
| Mutable iterator type for buffer traversal. | |
| using | const_iterator = const char * |
| Immutable iterator type for buffer traversal. | |
Public Member Functions | |
| DynamicStringBuffer (const DynamicStringBuffer &other) | |
| Copy constructor. | |
| DynamicStringBuffer (DynamicStringBuffer &&other) noexcept | |
| Move constructor. | |
| ~DynamicStringBuffer ()=default | |
| Destructor. | |
| DynamicStringBuffer & | operator= (const DynamicStringBuffer &other) |
| Copy assignment operator. | |
| DynamicStringBuffer & | operator= (DynamicStringBuffer &&other) noexcept |
| Move assignment operator. | |
| size_t | size () const noexcept |
| Get current buffer size in bytes. | |
| size_t | capacity () const noexcept |
| Get current buffer capacity in bytes. | |
| bool | isEmpty () const noexcept |
| Check if buffer is empty. | |
| void | clear () noexcept |
| Clear buffer content without deallocating memory. | |
| void | reserve (size_t newCapacity) |
| Reserve minimum capacity for buffer. | |
| void | resize (size_t newSize) |
| Resize buffer to specified size. | |
| char * | data () noexcept |
| Get mutable pointer to buffer data. | |
| const char * | data () const noexcept |
| Get immutable pointer to buffer data. | |
| char & | operator[] (size_t index) |
| Access buffer element by index (mutable) | |
| const char & | operator[] (size_t index) const |
| Access buffer element by index (immutable) | |
| void | append (std::string_view str) |
| Append string_view content to buffer. | |
| void | append (const std::string &str) |
| Append std::string content to buffer. | |
| void | append (const char *str) |
| Append null-terminated C string to buffer. | |
| void | push_back (char c) |
| Append single character to buffer. | |
| std::string | toString () const |
| Convert buffer content to std::string. | |
| std::string_view | toStringView () const noexcept |
| Get string_view of buffer content. | |
| iterator | begin () noexcept |
| Get mutable iterator to beginning of buffer. | |
| const_iterator | begin () const noexcept |
| Get immutable iterator to beginning of buffer. | |
| iterator | end () noexcept |
| Get mutable iterator to end of buffer. | |
| const_iterator | end () const noexcept |
| Get immutable iterator to end of buffer. | |
Friends | |
| class | DynamicStringBufferPool |
High-performance dynamic string buffer with efficient memory management.
Provides a growable character buffer optimized for string building operations. Features automatic capacity management, iterator support, and zero-copy string_view access. Designed for internal use by StringBuilderPool.
Definition at line 103 of file StringBuilderPool.h.
| using nfx::string::DynamicStringBuffer::const_iterator = const char* |
Immutable iterator type for buffer traversal.
Definition at line 315 of file StringBuilderPool.h.
| using nfx::string::DynamicStringBuffer::iterator = char* |
Mutable iterator type for buffer traversal.
Definition at line 312 of file StringBuilderPool.h.
| using nfx::string::DynamicStringBuffer::value_type = char |
Character type for iterator compatibility.
Definition at line 309 of file StringBuilderPool.h.
| nfx::string::DynamicStringBuffer::DynamicStringBuffer | ( | const DynamicStringBuffer & | other | ) |
Copy constructor.
| other | The DynamicStringBuffer to copy from |
|
noexcept |
Move constructor.
| other | The DynamicStringBuffer to move from |
| void nfx::string::DynamicStringBuffer::append | ( | const char * | str | ) |
Append null-terminated C string to buffer.
| str | Null-terminated string to append |
Safe handling of nullptr (no-op)
| std::bad_alloc | if buffer expansion fails |
| void nfx::string::DynamicStringBuffer::append | ( | const std::string & | str | ) |
Append std::string content to buffer.
| str | String to append |
Convenience overload for std::string
| std::bad_alloc | if buffer expansion fails |
| void nfx::string::DynamicStringBuffer::append | ( | std::string_view | str | ) |
Append string_view content to buffer.
| str | String view to append |
Efficient append without copying string data
| std::bad_alloc | if buffer expansion fails |
|
noexcept |
Get immutable iterator to beginning of buffer.
Safe read-only iteration over buffer contents
|
noexcept |
Get mutable iterator to beginning of buffer.
Enables range-based for loops and STL algorithms
|
noexcept |
Get current buffer capacity in bytes.
Capacity may be larger than size to avoid frequent reallocations
|
noexcept |
Clear buffer content without deallocating memory.
Sets size to 0 but preserves allocated capacity for reuse
|
noexcept |
Get immutable pointer to buffer data.
Safe read-only access to buffer contents
|
noexcept |
Get mutable pointer to buffer data.
Provides direct memory access for high-performance operations
|
noexcept |
Get immutable iterator to end of buffer.
Standard STL end iterator semantics
|
noexcept |
Get mutable iterator to end of buffer.
Standard STL end iterator semantics
|
noexcept |
Check if buffer is empty.
| DynamicStringBuffer & nfx::string::DynamicStringBuffer::operator= | ( | const DynamicStringBuffer & | other | ) |
Copy assignment operator.
| other | The DynamicStringBuffer to copy from |
|
noexcept |
Move assignment operator.
| other | The DynamicStringBuffer to move from |
| char & nfx::string::DynamicStringBuffer::operator[] | ( | size_t | index | ) |
Access buffer element by index (mutable)
| index | Zero-based index of element to access |
No bounds checking - undefined behavior if index >= size()
| const char & nfx::string::DynamicStringBuffer::operator[] | ( | size_t | index | ) | const |
Access buffer element by index (immutable)
| index | Zero-based index of element to access |
No bounds checking - undefined behavior if index >= size()
| void nfx::string::DynamicStringBuffer::push_back | ( | char | c | ) |
Append single character to buffer.
| c | Character to append |
Efficient single-character append
| std::bad_alloc | if buffer expansion fails |
| void nfx::string::DynamicStringBuffer::reserve | ( | size_t | newCapacity | ) |
Reserve minimum capacity for buffer.
| newCapacity | Minimum desired capacity in bytes |
May allocate more than requested for efficiency
| std::bad_alloc | if memory allocation fails |
| void nfx::string::DynamicStringBuffer::resize | ( | size_t | newSize | ) |
Resize buffer to specified size.
| newSize | New buffer size in bytes |
May truncate content or extend with undefined bytes
| std::bad_alloc | if memory allocation fails |
|
noexcept |
Get current buffer size in bytes.
Returns actual content size, not allocated capacity
| std::string nfx::string::DynamicStringBuffer::toString | ( | ) | const |
Convert buffer content to std::string.
Creates new string object - consider toStringView() for read-only access
|
noexcept |
Get string_view of buffer content.
Zero-copy access - view becomes invalid if buffer is modified
|
friend |
Definition at line 105 of file StringBuilderPool.h.