persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
FileBuffer Class Reference

Owns a heap-allocated file buffer and its length. More...

#include <IOManager.hpp>

Public Member Functions

 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.

Private Attributes

void * data = nullptr
u32 size = 0

Detailed Description

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.

Constructor & Destructor Documentation

◆ FileBuffer() [1/4]

FileBuffer::FileBuffer ( )
default

Constructs an empty file buffer.

Here is the caller graph for this function:

◆ FileBuffer() [2/4]

FileBuffer::FileBuffer ( void * data,
u32 size )
inline

Constructs a file buffer that takes ownership of data.

Parameters
dataHeap-allocated file data owned by this object.
sizeSize of data in bytes.

Definition at line 35 of file IOManager.hpp.

◆ ~FileBuffer()

FileBuffer::~FileBuffer ( )
inline

Releases the owned file data.

Definition at line 42 of file IOManager.hpp.

◆ FileBuffer() [3/4]

FileBuffer::FileBuffer ( const FileBuffer & )
delete

Copy construction is disabled to preserve unique ownership.

Here is the call graph for this function:

◆ FileBuffer() [4/4]

FileBuffer::FileBuffer ( FileBuffer && other)
inlinenoexcept

Transfers ownership from another file buffer.

Parameters
otherBuffer whose data ownership is transferred.

Definition at line 61 of file IOManager.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ 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.

Here is the caller graph for this function:

◆ 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.

Here is the caller graph for this function:

◆ operator=() [1/2]

FileBuffer & FileBuffer::operator= ( const FileBuffer & )
delete

Copy assignment is disabled to preserve unique ownership.

Here is the call graph for this function:

◆ operator=() [2/2]

FileBuffer & FileBuffer::operator= ( FileBuffer && other)
inlinenoexcept

Releases current data and transfers ownership from another buffer.

Parameters
otherBuffer whose data ownership is transferred.
Returns
This buffer after ownership has been transferred.

Definition at line 72 of file IOManager.hpp.

Here is the call graph for this function:

◆ 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.

Here is the caller graph for this function:

Member Data Documentation

◆ data

void* FileBuffer::data = nullptr
private

Definition at line 117 of file IOManager.hpp.

◆ size

u32 FileBuffer::size = 0
private

Definition at line 118 of file IOManager.hpp.


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