Owns a heap-allocated file buffer and its length.
More...
#include <IOManager.hpp>
|
| | FileBuffer ()=default |
| | Constructs an empty file buffer.
|
| | FileBuffer (void *data, u32 size) |
| | Constructs a file buffer that takes ownership of data.
|
| | ~FileBuffer () |
| | Releases the owned file data.
|
| | FileBuffer (const FileBuffer &)=delete |
| | Copy construction is disabled to preserve unique ownership.
|
| FileBuffer & | operator= (const FileBuffer &)=delete |
| | Copy assignment is disabled to preserve unique ownership.
|
| | FileBuffer (FileBuffer &&other) noexcept |
| | Transfers ownership from another file buffer.
|
| FileBuffer & | operator= (FileBuffer &&other) noexcept |
| | Releases current data and transfers ownership from another buffer.
|
| void * | get () const |
| | Gets the owned file data without transferring ownership.
|
| u32 | length () const |
| | Gets the file data length.
|
| void * | release () |
| | Releases the file data to the caller.
|
Owns a heap-allocated file buffer and its length.
FileBuffer releases its data when destroyed. It is move-only so ownership cannot be accidentally shared or double-freed.
Definition at line 22 of file IOManager.hpp.
◆ FileBuffer() [1/4]
| FileBuffer::FileBuffer |
( |
| ) |
|
|
default |
Constructs an empty file buffer.
◆ FileBuffer() [2/4]
| FileBuffer::FileBuffer |
( |
void * | data, |
|
|
u32 | size ) |
|
inline |
Constructs a file buffer that takes ownership of data.
- Parameters
-
| data | Heap-allocated file data owned by this object. |
| size | Size of data in bytes. |
Definition at line 35 of file IOManager.hpp.
◆ ~FileBuffer()
| FileBuffer::~FileBuffer |
( |
| ) |
|
|
inline |
◆ FileBuffer() [3/4]
Copy construction is disabled to preserve unique ownership.
◆ FileBuffer() [4/4]
Transfers ownership from another file buffer.
- Parameters
-
| other | Buffer whose data ownership is transferred. |
Definition at line 61 of file IOManager.hpp.
◆ get()
| void * FileBuffer::get |
( |
| ) |
const |
|
inline |
Gets the owned file data without transferring ownership.
- Returns
- Pointer to the file data, or nullptr if the buffer is empty.
Definition at line 89 of file IOManager.hpp.
◆ length()
| u32 FileBuffer::length |
( |
| ) |
const |
|
inline |
Gets the file data length.
- Returns
- Size of the file data in bytes.
Definition at line 98 of file IOManager.hpp.
◆ operator=() [1/2]
Copy assignment is disabled to preserve unique ownership.
◆ operator=() [2/2]
Releases current data and transfers ownership from another buffer.
- Parameters
-
| other | Buffer whose data ownership is transferred. |
- Returns
- This buffer after ownership has been transferred.
Definition at line 72 of file IOManager.hpp.
◆ release()
| void * FileBuffer::release |
( |
| ) |
|
|
inline |
Releases the file data to the caller.
- Returns
- The previously owned data pointer, or nullptr if empty.
- Note
- The caller becomes responsible for releasing the returned pointer.
Definition at line 108 of file IOManager.hpp.
◆ data
| void* FileBuffer::data = nullptr |
|
private |
◆ size
The documentation for this class was generated from the following file: