Utility class for creating an index of file names and lengths from a given directory.
Useful for grouping .wav files for playback, etc.
#include <FileTable.h>
Public Member Functions | |
void | Clear () |
bool | Fill (const char *path, const char *endswith=nullptr) |
bool | WriteLog (const char *log_file_name) |
bool | IsFileInSlot (size_t idx) const |
size_t | GetFileSize (size_t idx) const |
const char * | GetFileName (size_t idx) const |
size_t | GetNumFiles () const |
bool | IsLoadPending () const |
void | ClearLoadPending () |
void | SetLoadPending (int slot) |
bool | IsSavePending () const |
void | ClearSavePending () |
void | SetSavePending (int slot) |
int | GetSlotForSaveLoad () const |
Static Public Attributes | |
static constexpr const size_t | kMaxCustomFileNameLen = _MAX_LFN |
static constexpr const size_t | kMaxFileSlots = max_slots |
|
inline |
Reset the table to its initial, empty state.
|
inline |
|
inline |
|
inline |
Search the path provided, and fill the table with files that match the pattern provided. The loaded files are sorted alphabetically by filename
path | path to the directory to search. |
endswith | string suffix to compare to, often a file extension (i.e. ".wav") if this is null, then all files will be loaded. |
|
inline |
Returns the name of the file in the specified slot.
|
inline |
Returns the size of the file in the specified slot.
|
inline |
Returns the number of files found in the table.
|
inline |
|
inline |
Returns whether there is a file present at the index
|
inline |
Flag-y bits for Loading and Saving This class can act like an interface for the actual I/O.
This has to be manually managed, but can be used to coordinate loading/storing data.
|
inline |
|
inline |
|
inline |
|
inline |
Generates a simple log file, and writes it to the destination
The file will contain a list of all of the files loaded, with their slot position, and file size.
|
staticconstexpr |
|
staticconstexpr |