Nugget
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
psyqo::paths::CDRomLoader Class Reference

A class that reads files from the CDRom. More...

#include <psyqo-paths/cdrom-loader.hh>

Public Member Functions

void setBuffer (Buffer< uint8_t > &&buffer)
 Set the Buffer object for the next read operation.
 
void readFile (eastl::string_view path, ISO9660Parser &parser, eastl::function< void(Buffer< uint8_t > &&)> &&callback)
 Reads a file from the CDRom.
 
psyqo::TaskQueue::Task scheduleReadFile (eastl::string_view path, ISO9660Parser &parser)
 
ReadFileAwaiter readFile (eastl::string_view path, ISO9660Parser &parser)
 

Detailed Description

A class that reads files from the CDRom.

This class provides a PSYQo path to read files from the CDRom. The way to use it is to instantiate the class somewhere persistent, and then call readFile() with a callback. The callback will be called with the data of the file, or an empty buffer if the file could not be read. This is going to allocate memory in different places. Only one file can be read at a time, but it is safe to call readFile() again from the callback. If preferred, the loader can be cascaded into another TaskQueue. Also, for convenience, readFile() can be awaited on using the co_await keyword in a coroutine.

Member Function Documentation

◆ readFile() [1/2]

ReadFileAwaiter psyqo::paths::CDRomLoader::readFile ( eastl::string_view  path,
ISO9660Parser parser 
)
inline

◆ readFile() [2/2]

void psyqo::paths::CDRomLoader::readFile ( eastl::string_view  path,
ISO9660Parser parser,
eastl::function< void(Buffer< uint8_t > &&)> &&  callback 
)
inline

Reads a file from the CDRom.

Parameters
pathThe path to the file to read. The view must be persistent until the callback is called.
parserThe ISO9660Parser to use for reading the file.
callbackThe callback to call when the file is read. The callback will be called with the data of the file, or an empty buffer if the file could not be read.

◆ scheduleReadFile()

psyqo::TaskQueue::Task psyqo::paths::CDRomLoader::scheduleReadFile ( eastl::string_view  path,
ISO9660Parser parser 
)
inline

◆ setBuffer()

void psyqo::paths::CDRomLoader::setBuffer ( Buffer< uint8_t > &&  buffer)
inline

Set the Buffer object for the next read operation.

This function sets the buffer to be used for the next read operation. By default, the archive manager will allocate a buffer of the appropriate size for the file being read. However, if the user wants to use an already allocated buffer, they can use this function to set the buffer to be used.

Parameters
bufferThe buffer to be used for the next read operation.

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