![]() |
Raven Engine v0.1
|
A wrapper around Buffer that ensures automatic release of memory when it goes out of scope. More...
#include <Buffer.h>
Public Member Functions | |
| ScopedBuffer (Buffer buffer) | |
| Constructs a ScopedBuffer from a Buffer. | |
| ScopedBuffer (u64 size) | |
| Constructs a ScopedBuffer by allocating a buffer of the specified size. | |
| ~ScopedBuffer () | |
| Destructor that releases the buffer's memory. | |
| u8 * | Data () const |
| Accessor for the buffer's raw data. | |
| u64 | Size () const |
| Accessor for the buffer's size. | |
| template<typename T> | |
| T * | As () |
| Casts the buffer's raw data to a specific type. | |
| operator bool () const | |
| Converts the ScopedBuffer to a boolean value. | |
A wrapper around Buffer that ensures automatic release of memory when it goes out of scope.
This class encapsulates a Buffer and ensures that the memory is released automatically when the object is destroyed. It is useful when you need to manage buffer memory in a scope-bound manner.
|
inlineexplicit |
Constructs a ScopedBuffer from a Buffer.
| buffer | The buffer to wrap in this scoped object. |
|
inlineexplicit |
Constructs a ScopedBuffer by allocating a buffer of the specified size.
| size | The size of the buffer to allocate. |
|
inline |
Destructor that releases the buffer's memory.
|
inline |
Casts the buffer's raw data to a specific type.
| T | The type to cast to. |
|
inlinenodiscard |
Accessor for the buffer's raw data.
|
inlineexplicit |
Converts the ScopedBuffer to a boolean value.
|
inlinenodiscard |
Accessor for the buffer's size.