MochiEngine
Loading...
Searching...
No Matches
Mochi::FS::SystemFileLoader Class Reference

This class creates a very simple virtual file system from a directory. This allows read access to all files in that directory referencing them from their path as a unique identifier. As this doesn't give the benefits of asset obfuscation, it is only used on debug mode, and can't be configured at the moment. More...

#include <SystemFileLoader.h>

Inheritance diagram for Mochi::FS::SystemFileLoader:
Mochi::FS::IFileLoader

Public Member Functions

 SystemFileLoader (const std::string &directoryPath)
virtual bool IsValid () const
 Tells us if the file loader can be used at the moment.
virtual std::vector< char > GetFile (const std::string &path)
 Give us a binary representation of a file in a filesystem.
virtual bool HasFile (const std::string &path) const
 Tells us if the filesystem has a file.
virtual std::vector< std::string > GetAvailableFiles () const
 Tells us which files are in the filesystem.

Detailed Description

This class creates a very simple virtual file system from a directory. This allows read access to all files in that directory referencing them from their path as a unique identifier. As this doesn't give the benefits of asset obfuscation, it is only used on debug mode, and can't be configured at the moment.

Member Function Documentation

◆ GetAvailableFiles()

std::vector< std::string > Mochi::FS::SystemFileLoader::GetAvailableFiles ( ) const
virtual

Tells us which files are in the filesystem.

Returns
A vector with the unique identifiers of all files

Implements Mochi::FS::IFileLoader.

◆ GetFile()

std::vector< char > Mochi::FS::SystemFileLoader::GetFile ( const std::string & path)
virtual

Give us a binary representation of a file in a filesystem.

Exceptions
EngineErrorif is not valid or doesn't have file
Parameters
pathA path, or unique identifier to the file
Returns
A vector of chars, or binary representation of a file.

Implements Mochi::FS::IFileLoader.

◆ HasFile()

bool Mochi::FS::SystemFileLoader::HasFile ( const std::string & path) const
virtual

Tells us if the filesystem has a file.

Parameters
pathA path, or unique identifier to the file
Returns
True if it has the file, false if not

Implements Mochi::FS::IFileLoader.

◆ IsValid()

bool Mochi::FS::SystemFileLoader::IsValid ( ) const
virtual

Tells us if the file loader can be used at the moment.

Returns
True if can be used, false if not

Implements Mochi::FS::IFileLoader.


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