Skip to content

Core::ResourceFiles

A collection of file paths in the filesystem that are together required to load a single resource like a model. More...

#include "Core/Resources/ResourceFiles.h"

Inherited by Core::ModelResourceFiles

Public Functions

Name
ResourceFiles(fs::path path, std::string name)
virtual~ResourceFiles() =default
voidaddFile(fs::path filePath)
boolchangeLocation(fs::path newDir, bool deleteOriginals)<br>Change the location of the managed files.
booldeleteFiles()
virtual boolfetchFiles() =0<br>Derive and fetch all required files from the primary file path.
virtual boolfetchFiles(void * data) =0<br>Derive and fetch all required files from the primary file path and supplied arbitrary data.
booloperator!=(const ResourceFiles & rhs) const
booloperator<(const ResourceFiles & rhs) const
booloperator==(const ResourceFiles & rhs) const

Public Attributes

Name
std::set< fs::path >m_files
std::stringm_name <br>Arbitrary name, can be used as a name for the root subfolder.
fs::pathm_path <br>Path to the "primary" file, from which other paths are derived.
fs::pathm_rootDir <br>Root directory of the resource. Derived from m_path.

Detailed Description

cpp
class Core::ResourceFiles;
class Core::ResourceFiles;

A collection of file paths in the filesystem that are together required to load a single resource like a model.

An instance of this class helps keep track of actual files that a resource was loaded from and allows them to be deleted when not used anymore.

Public Functions Documentation

function ResourceFiles

cpp
ResourceFiles(
    fs::path path,
    std::string name
)
ResourceFiles(
    fs::path path,
    std::string name
)

function ~ResourceFiles

cpp
virtual ~ResourceFiles() =default
virtual ~ResourceFiles() =default

function addFile

cpp
void addFile(
    fs::path filePath
)
void addFile(
    fs::path filePath
)

function changeLocation

cpp
bool changeLocation(
    fs::path newDir,
    bool deleteOriginals
)
bool changeLocation(
    fs::path newDir,
    bool deleteOriginals
)

Change the location of the managed files.

Parameters:

  • newDir New file structure root.
  • deleteOriginals Delete the original files.

Return: True on success, false otherwise

function deleteFiles

cpp
bool deleteFiles()
bool deleteFiles()

function fetchFiles

cpp
virtual bool fetchFiles() =0
virtual bool fetchFiles() =0

Derive and fetch all required files from the primary file path.

Reimplemented by: Core::ModelResourceFiles::fetchFiles

function fetchFiles

cpp
virtual bool fetchFiles(
    void * data
) =0
virtual bool fetchFiles(
    void * data
) =0

Derive and fetch all required files from the primary file path and supplied arbitrary data.

Reimplemented by: Core::ModelResourceFiles::fetchFiles

function operator!=

cpp
inline bool operator!=(
    const ResourceFiles & rhs
) const
inline bool operator!=(
    const ResourceFiles & rhs
) const

function operator<

cpp
inline bool operator<(
    const ResourceFiles & rhs
) const
inline bool operator<(
    const ResourceFiles & rhs
) const

function operator==

cpp
inline bool operator==(
    const ResourceFiles & rhs
) const
inline bool operator==(
    const ResourceFiles & rhs
) const

Public Attributes Documentation

variable m_files

cpp
std::set< fs::path > m_files;
std::set< fs::path > m_files;

variable m_name

cpp
std::string m_name;
std::string m_name;

Arbitrary name, can be used as a name for the root subfolder.

variable m_path

cpp
fs::path m_path;
fs::path m_path;

Path to the "primary" file, from which other paths are derived.

variable m_rootDir

cpp
fs::path m_rootDir;
fs::path m_rootDir;

Root directory of the resource. Derived from m_path.


Updated on 2024-11-06 at 20:16:54 +0000