Mountain  1.0.0
Simple C++ 2D Game Framework
Mountain::Entry Class Referenceabstract

File system entry. Can be either a File or a Directory. More...

#include <entry.hpp>

+ Inheritance diagram for Mountain::Entry:
+ Collaboration diagram for Mountain::Entry:

Public Member Functions

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 Load ()=0
 Loads the contents of this Entry. More...
 
virtual MOUNTAIN_API void Unload ()=0
 Unloads the contents of this Entry.
 
virtual MOUNTAIN_API bool_t Reload ()
 Reloads the contents of this Entry. More...
 
virtual MOUNTAIN_API void OpenInExplorer () const
 Opens this Entry in the file explorer.
 
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.
 
virtual MOUNTAIN_API void SetName (const std::string &newName)
 Renames this Entry on the file system. More...
 
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< DirectoryGetParent ()
 Returns a Pointer to the parent Directory of this Entry, with a strong reference stored in the FileManager.
 

Protected Member Functions

virtual void UpdateUtilityValues ()
 Updates fields of this class using the new value of m_Path.
 

Protected Attributes

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< Directorym_Parent
 The parent of this Entry.
 

Detailed Description

File system entry. Can be either a File or a Directory.

Definition at line 16 of file entry.hpp.

Member Function Documentation

◆ Load()

virtual MOUNTAIN_API bool_t Mountain::Entry::Load ( )
pure virtual

Loads the contents of this Entry.

Returns
false if an error occured while loading.

Implemented in Mountain::File, and Mountain::Directory.

◆ Reload()

virtual MOUNTAIN_API bool_t Mountain::Entry::Reload ( )
virtual

Reloads the contents of this Entry.

This if effectively the same as calling PostUnload() and then Preload().

◆ SetName()

virtual MOUNTAIN_API void Mountain::Entry::SetName ( const std::string &  newName)
virtual

Renames this Entry on the file system.

This function also renames the File entry in the FileManager using FileManager::Rename(const std::filesystem::path&, const std::filesystem::path&).

Parameters
newNameThe new name of this Entry.

Reimplemented in Mountain::File, and Mountain::Directory.

Member Data Documentation

◆ m_Loaded

bool_t Mountain::Entry::m_Loaded = false
protected

Whether this Entry has been loaded.

Default implementation of Preload and PostUnload functions in the Entry class already change this value accordingly. Any override of such function must either call the parent implementation or update this variable so that GetLoaded returns the correct state.

Definition at line 85 of file entry.hpp.


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