105 friend class DynamicStringBufferPool;
170 [[nodiscard]]
size_t size() const noexcept;
223 [[nodiscard]]
char*
data() noexcept;
231 [[nodiscard]] const
char*
data() const noexcept;
239 char& operator[](
size_t index );
247 const
char& operator[](
size_t index ) const;
355 static constexpr
size_t STACK_BUFFER_SIZE = 256;
358 static constexpr auto GROWTH_FACTOR = 1.5;
365 alignas(
char )
char m_stackBuffer[STACK_BUFFER_SIZE];
368 std::unique_ptr<
char[]> m_heapBuffer;
387 void ensureCapacity(
size_t needed_capacity );
393 char* currentBuffer() noexcept;
399 const
char* currentBuffer() const noexcept;
469 inline
char& operator[](
size_t index );
476 inline const
char& operator[](
size_t index ) const;
486 inline
void append( std::string_view str );
492 inline
void append( const std::
string& str );
546 inline
size_t length() const noexcept;
662 const char* m_current;
774 [[noreturn]]
void throwInvalidOperation()
const;
925 static
void resetStats() noexcept;
935 static
size_t clear();
941 static
size_t size() noexcept;
945#include "nfx/detail/string/StringBuilderPool.inl"
High-performance dynamic string buffer with efficient memory management.
iterator begin() noexcept
Get mutable iterator to beginning of buffer.
void append(std::string_view str)
Append string_view content to buffer.
bool isEmpty() const noexcept
Check if buffer is empty.
const char * const_iterator
Immutable iterator type for buffer traversal.
char * iterator
Mutable iterator type for buffer traversal.
DynamicStringBuffer(const DynamicStringBuffer &other)
Copy constructor.
char * data() noexcept
Get mutable pointer to buffer data.
void reserve(size_t newCapacity)
Reserve minimum capacity for buffer.
char value_type
Character type for iterator compatibility.
DynamicStringBuffer & operator=(DynamicStringBuffer &&other) noexcept
Move assignment operator.
void resize(size_t newSize)
Resize buffer to specified size.
DynamicStringBuffer & operator=(const DynamicStringBuffer &other)
Copy assignment operator.
~DynamicStringBuffer()=default
Destructor.
std::string toString() const
Convert buffer content to std::string.
void clear() noexcept
Clear buffer content without deallocating memory.
DynamicStringBuffer(DynamicStringBuffer &&other) noexcept
Move constructor.
void push_back(char c)
Append single character to buffer.
size_t size() const noexcept
Get current buffer size in bytes.
iterator end() noexcept
Get mutable iterator to end of buffer.
std::string_view toStringView() const noexcept
Get string_view of buffer content.
size_t capacity() const noexcept
Get current buffer capacity in bytes.
High-performance string builder with fluent interface and efficient memory management.
const char * const_iterator
Immutable iterator type for buffer traversal.
StringBuilder(StringBuilder &&) noexcept=delete
Move constructor.
StringBuilder(const StringBuilder &)=default
Copy constructor.
char * iterator
Mutable iterator type for buffer traversal.
char value_type
Character type for iterator compatibility.
StringBuilder()=delete
Default constructor.
Forward-only iterator for character-by-character enumeration of StringBuilder content.
Enumerator(const StringBuilder &builder)
Constructs an enumerator for iterating over the characters in the given StringBuilder buffer.
void reset()
Resets the enumerator to the initial position (before the first character).
bool next()
Advances to the next character in the buffer.
char current() const
Returns the current character in the buffer.
~Enumerator()=default
Destructor.
RAII lease wrapper for pooled StringBuilder buffers with automatic resource management.
std::string toString() const
Converts buffer contents to std::string.
StringBuilderLease & operator=(const StringBuilderLease &)=delete
Copy assignment operator.
StringBuilderLease(const StringBuilderLease &)=delete
Copy constructor.
StringBuilderLease()=delete
Default constructor.
StringBuilderLease & operator=(StringBuilderLease &&other) noexcept
Move assignment operator.
DynamicStringBuffer & buffer()
Provides direct access to underlying memory buffer.
StringBuilderLease(StringBuilderLease &&other) noexcept
Move constructor.
~StringBuilderLease()
Destructor.
StringBuilder create()
Creates StringBuilder wrapper for buffer manipulation.
Thread-safe memory pool for high-performance StringBuilder instances with optimized allocation strate...
static PoolStatistics stats() noexcept
Gets current pool statistics.
static StringBuilderLease lease()
Creates a new StringBuilder lease with an optimally sourced memory buffer.
Pool performance statistics for external access.
uint64_t dynamicStringBufferPoolHits
Number of successful buffer retrievals from shared cross-thread pool.
uint64_t totalRequests
Total number of buffer requests made to the pool.
double hitRate
Cache hit rate as a percentage (0.0 to 1.0)
uint64_t newAllocations
Number of new buffer allocations when pools were empty.
uint64_t threadLocalHits
Number of successful buffer retrievals from thread-local cache.