Mountain  1.0.0
Simple C++ 2D Game Framework
Mountain::Directory Class Reference

Defines a directory on the filesystem. More...

#include <directory.hpp>

+ Inheritance diagram for Mountain::Directory:
+ Collaboration diagram for Mountain::Directory:

Public Member Functions

MOUNTAIN_API Directory (std::filesystem::path &&filepath)
 Constructs a Directory corresponding to the given path.
 
MOUNTAIN_API ~Directory () override=default
 Default Directory destruction.
 
MOUNTAIN_API bool_t Load () override
 Loads the contents of this Directory in the FileManager. More...
 
MOUNTAIN_API void Unload () override
 Unloads the contents of this Directory.
 
MOUNTAIN_API void OpenInExplorer () const override
 Opens this Directory in the file explorer.
 
MOUNTAIN_API const std::vector< Pointer< Entry > > & GetChildEntries () const
 Returns all the child Entries of this Directory.
 
MOUNTAIN_API std::vector< Pointer< Entry > > & GetChildEntries ()
 Returns all the child Entries of this Directory.
 
MOUNTAIN_API const std::vector< Pointer< File > > & GetChildFiles () const
 Returns all the child Files of this Directory.
 
MOUNTAIN_API std::vector< Pointer< File > > & GetChildFiles ()
 Returns all the child Files of this Directory.
 
MOUNTAIN_API const std::vector< Pointer< Directory > > & GetChildDirectories () const
 Returns all the child Directories of this Directory.
 
MOUNTAIN_API std::vector< Pointer< Directory > > & GetChildDirectories ()
 Returns all the child Directories of this Directory.
 
void SetName (const std::string &newName) override
 Sets the name of this Directory. More...
 
- Public Member Functions inherited from Mountain::Entry
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< DirectoryGetParent ()
 Returns a Pointer to the parent Directory of this Entry, with a strong reference stored in the FileManager.
 

Additional Inherited Members

- Protected Member Functions inherited from Mountain::Entry
virtual void UpdateUtilityValues ()
 Updates fields of this class using the new value of m_Path.
 
- Protected Attributes inherited from Mountain::Entry
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

Defines a directory on the filesystem.

This is meant to be used with Pointers and with the FileManager.

Definition at line 19 of file directory.hpp.

Member Function Documentation

◆ Load()

MOUNTAIN_API bool_t Mountain::Directory::Load ( )
overridevirtual

Loads the contents of this Directory in the FileManager.

This effectively means loading all children of this Directory.

Returns
false if an error occured while loading.

Implements Mountain::Entry.

◆ SetName()

void Mountain::Directory::SetName ( const std::string &  newName)
overridevirtual

Sets the name of this Directory.

This effectively means changing the path of all its children accordingly.

Reimplemented from Mountain::Entry.


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