RAII lease wrapper for pooled StringBuilder buffers with automatic resource management.
More...
#include <nfx/string/StringBuilder.h>
|
|
| StringBuilderLease ()=delete |
| | Default constructor.
|
|
| StringBuilderLease (const StringBuilderLease &)=delete |
| | Copy constructor.
|
| | StringBuilderLease (StringBuilderLease &&other) noexcept |
| | Move constructor.
|
|
| ~StringBuilderLease () |
| | Destructor.
|
|
StringBuilderLease & | operator= (const StringBuilderLease &)=delete |
| | Copy assignment operator.
|
| StringBuilderLease & | operator= (StringBuilderLease &&other) noexcept |
| | Move assignment operator.
|
| StringBuilder | create () |
| | Creates StringBuilder wrapper for buffer manipulation.
|
| DynamicStringBuffer & | buffer () |
| | Provides direct access to underlying memory buffer.
|
| std::string | toString () const |
| | Converts buffer contents to std::string.
|
RAII lease wrapper for pooled StringBuilder buffers with automatic resource management.
Provides exclusive access to a pooled DynamicStringBuffer through RAII semantics. Automatically returns the buffer to the pool when the lease is destroyed, ensuring optimal memory reuse and preventing resource leaks. Features move-only semantics for safe transfer of ownership and convenient access methods.
- Note
- This class implements move-only semantics - copying is disabled to prevent multiple ownership of the same buffer. Use std::move() for ownership transfer.
- Warning
- Not thread-safe - external synchronization required for concurrent access. Do not share lease instances between threads without proper synchronization.
- See also
- StringBuilderPool::lease() for obtaining lease instances
-
StringBuilder for the high-level string building interface
-
DynamicStringBuffer for the underlying buffer implementation
Definition at line 705 of file StringBuilder.h.
◆ StringBuilderLease()
| nfx::string::StringBuilderLease::StringBuilderLease |
( |
StringBuilderLease && | other | ) |
|
|
inlinenoexcept |
Move constructor.
- Parameters
-
| other | The StringBuilderLease to move from |
◆ buffer()
Provides direct access to underlying memory buffer.
- Returns
- Reference to the underlying DynamicStringBuffer
- Note
- This function is marked [[nodiscard]] - the return value should not be ignored
◆ create()
Creates StringBuilder wrapper for buffer manipulation.
- Returns
- StringBuilder instance wrapping the leased buffer
- Note
- This function is marked [[nodiscard]] - the return value should not be ignored
◆ operator=()
| StringBuilderLease & nfx::string::StringBuilderLease::operator= |
( |
StringBuilderLease && | other | ) |
|
|
inlinenoexcept |
Move assignment operator.
- Parameters
-
| other | The StringBuilderLease to move from |
- Returns
- Reference to this StringBuilderLease after assignment
◆ toString()
| std::string nfx::string::StringBuilderLease::toString |
( |
| ) |
const |
|
inlinenodiscard |
Converts buffer contents to std::string.
- Returns
- String copy of the buffer contents
- Note
- This function is marked [[nodiscard]] - the return value should not be ignored
◆ StringBuilderPool
| friend class StringBuilderPool |
|
friend |
The documentation for this class was generated from the following file: