Mountain
1.0.0
Simple C++ 2D Game Framework
|
Defines a file on the filesystem. More...
#include <file.hpp>
Public Types | |
enum | Type : uint8_t { Unknown, AudioTrack, Texture, Font, Xml, VertexShader, FragmentShader, ComputeShader, Glsl } |
Type of file according to file extension. | |
Public Member Functions | |
MOUNTAIN_API | File (std::filesystem::path &&filepath) |
Constructs a File corresponding to the given path . | |
MOUNTAIN_API | ~File () override |
Destructs the File instance by calling PostUnload. | |
MOUNTAIN_API bool_t | Load () override |
Loads the contents of this File. More... | |
MOUNTAIN_API void | Load (const char_t *data, size_t size) |
Loads the given contents in this File. Note: This doesn't have anything to do with the file system. This only loads the given data in this resource. | |
MOUNTAIN_API void | Unload () override |
Unloads the contents of this File. | |
MOUNTAIN_API void | OpenInExplorer () const override |
Opens this File in the file explorer. | |
MOUNTAIN_API void | OpenFile () const |
Opens this File on the user's computer using the default software for its file extension. | |
MOUNTAIN_API Type | GetType () const |
Returns the Type of this File. | |
MOUNTAIN_API void | Delete () const |
Deletes the corresponding filesystem file. | |
MOUNTAIN_API bool_t | Exists () |
Get whether this file exists on the file system or is just a virtual file representation. | |
MOUNTAIN_API std::string | GetNameNoExtension () const |
Returns the name of this File without the file extension. | |
MOUNTAIN_API std::string | GetPathNoExtension () const |
Returns the name of this File without the file extension. | |
MOUNTAIN_API std::string | GetExtension () const |
Returns the file extension of this File. | |
template<typename T = char_t> | |
const T * | GetData () const |
Returns a const pointer to the raw loaded data. | |
template<typename T = char_t> | |
T * | GetData () |
Returns a pointer to the raw loaded data. | |
MOUNTAIN_API int64_t | GetSize () const |
Returns the size of the loaded data. | |
MOUNTAIN_API void | SetName (const std::string &newName) override |
Sets the name of this File. | |
MOUNTAIN_API Pointer< Resource > | GetResource () const |
Returns the stored Pointer to the Resource loaded from this File. More... | |
![]() | |
MOUNTAIN_API | Entry (std::filesystem::path &&path) |
Constructs an Entry corresponding to the given path . | |
virtual MOUNTAIN_API | ~Entry ()=default |
Default Entry destruction. | |
virtual MOUNTAIN_API bool_t | Reload () |
Reloads the contents of this Entry. More... | |
MOUNTAIN_API const std::filesystem::path & | GetPath () const |
Returns the corresponding filesystem path. | |
MOUNTAIN_API std::string | GetPathString () const |
Returns the string representation of GetPath. | |
MOUNTAIN_API std::string | GetName () const |
Returns this Entry name. | |
MOUNTAIN_API bool_t | GetLoaded () const |
Returns whether this Entry has been loaded. | |
virtual void | SetParent (Pointer< Directory > &&newParent) |
Sets the new path of this Entry. | |
MOUNTAIN_API Pointer< Directory > | GetParent () |
Returns a Pointer to the parent Directory of this Entry, with a strong reference stored in the FileManager. | |
Protected Member Functions | |
void | UpdateUtilityValues () override |
Updates fields of this class using the new value of m_Path. | |
Friends | |
class | ResourceManager |
Additional Inherited Members | |
![]() | |
std::filesystem::path | m_Path |
The underlying filesystem path of this Entry. | |
std::string | m_Name |
The name of this Entry. | |
bool_t | m_Loaded = false |
Whether this Entry has been loaded. More... | |
Pointer< Directory > | m_Parent |
The parent of this Entry. | |
Defines a file on the filesystem.
This is meant to be used with Pointers and with the FileManager.
MOUNTAIN_API Pointer<Resource> Mountain::File::GetResource | ( | ) | const |
|
overridevirtual |
Loads the contents of this File.
false
if an error occured while loading. Implements Mountain::Entry.