nfx-stringbuilderpool 1.0.0
High-performance C++20 library for zero-allocation string building with thread-safe pooling
Loading...
Searching...
No Matches
nfx::string::StringBuilder::Enumerator Class Reference

Forward-only iterator for character-by-character enumeration of StringBuilder content. More...

#include <nfx/string/StringBuilderPool.h>

Public Member Functions

 Enumerator (const StringBuilder &builder)
 Constructs an enumerator for iterating over the characters in the given StringBuilder buffer.
 
 ~Enumerator ()=default
 Destructor.
 
bool next ()
 Advances to the next character in the buffer.
 
char current () const
 Returns the current character in the buffer.
 
void reset ()
 Resets the enumerator to the initial position (before the first character).
 

Detailed Description

Forward-only iterator for character-by-character enumeration of StringBuilder content.

Provides a simple enumeration interface for iterating through StringBuilder characters one at a time. Features reset capability and bounds-checked iteration with explicit advancement control. Designed for scenarios requiring controlled iteration patterns.

Note
This enumerator maintains pointers to the underlying buffer data. The StringBuilder must remain valid and unmodified during the enumeration lifetime.
Warning
Not thread-safe - external synchronization required for concurrent access. Enumerator becomes invalid if the underlying StringBuilder is modified.
See also
StringBuilder for the parent container
StringBuilder::begin(), StringBuilder::end() for STL-compatible iterators

Definition at line 610 of file StringBuilderPool.h.

Constructor & Destructor Documentation

◆ Enumerator()

nfx::string::StringBuilder::Enumerator::Enumerator ( const StringBuilder builder)
inline

Constructs an enumerator for iterating over the characters in the given StringBuilder buffer.

Parameters
builderThe StringBuilder to enumerate
Note
Calling current() is only valid after next() has returned true and until it returns false.

Member Function Documentation

◆ current()

char nfx::string::StringBuilder::Enumerator::current ( ) const
inline

Returns the current character in the buffer.

Returns
The character at the current enumeration position

◆ next()

bool nfx::string::StringBuilder::Enumerator::next ( )
inline

Advances to the next character in the buffer.

Returns
true if advanced to a valid character, false if reached end of buffer

The documentation for this class was generated from the following file: