Skip to content

Class daisy::FileTable

template <size_t max_slots>

ClassList > daisy > FileTable

More...

  • #include <FileTable.h>

Public Static Attributes

Type Name
constexpr const size_t kMaxCustomFileNameLen = [**\_MAX\_LFN**](ffconf_8h.md#define-_max_lfn)
constexpr const size_t kMaxFileSlots = [**max\_slots**](classdaisy_1_1Apds9960.md)

Public Functions

Type Name
void Clear ()
void ClearLoadPending ()
void ClearSavePending ()
bool Fill (const char * path, const char * endswith=nullptr)
const char * GetFileName (size_t idx) const
size_t GetFileSize (size_t idx) const
size_t GetNumFiles () const
int GetSlotForSaveLoad () const
bool IsFileInSlot (size_t idx) const
bool IsLoadPending () const
bool IsSavePending () const
void SetLoadPending (int slot)
void SetSavePending (int slot)
bool WriteLog (const char * log_file_name)

Detailed Description

Utility class for creating an index of file names and lengths from a given directory.

Useful for grouping .wav files for playback, etc.

Public Static Attributes Documentation

variable kMaxCustomFileNameLen

constexpr const size_t daisy::FileTable< max_slots >::kMaxCustomFileNameLen;

variable kMaxFileSlots

constexpr const size_t daisy::FileTable< max_slots >::kMaxFileSlots;

Public Functions Documentation

function Clear

inline void daisy::FileTable::Clear () 

Reset the table to its initial, empty state.


function ClearLoadPending

inline void daisy::FileTable::ClearLoadPending () 

function ClearSavePending

inline void daisy::FileTable::ClearSavePending () 

function Fill

inline bool daisy::FileTable::Fill (
    const  char * path,
    const  char * endswith=nullptr
) 

Search the path provided, and fill the table with files that match the pattern provided. The loaded files are sorted alphabetically by filename

Parameters:

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

Returns:

true if files are loaded, otherwise false


function GetFileName

inline const  char * daisy::FileTable::GetFileName (
    size_t idx
) const

Returns the name of the file in the specified slot.


function GetFileSize

inline size_t daisy::FileTable::GetFileSize (
    size_t idx
) const

Returns the size of the file in the specified slot.


function GetNumFiles

inline size_t daisy::FileTable::GetNumFiles () const

Returns the number of files found in the table.


function GetSlotForSaveLoad

inline int daisy::FileTable::GetSlotForSaveLoad () const

function IsFileInSlot

inline bool daisy::FileTable::IsFileInSlot (
    size_t idx
) const

Returns whether there is a file present at the index


function IsLoadPending

inline bool daisy::FileTable::IsLoadPending () const

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.


function IsSavePending

inline bool daisy::FileTable::IsSavePending () const

function SetLoadPending

inline void daisy::FileTable::SetLoadPending (
    int slot
) 

function SetSavePending

inline void daisy::FileTable::SetSavePending (
    int slot
) 

function WriteLog

inline bool daisy::FileTable::WriteLog (
    const  char * log_file_name
) 

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.



The documentation for this class was generated from the following file external-docs/libDaisy/src/util/FileTable.h