34#include "utility/system_io/file.hpp"
89 virtual std::shared_ptr<utility::File>
add(
const std::string &path) = 0;
96 std::shared_ptr<utility::File>
add(
const std::filesystem::path &path)
98 return add(path.string());
114 virtual void remove(
const std::string &path,
bool save =
true) = 0;
121 void remove(
const std::filesystem::path &path,
bool save =
true)
138 virtual bool save(
const std::string &path,
139 const std::string &newPath =
"") = 0;
147 bool save(
const std::filesystem::path &path,
148 const std::filesystem::path &newPath)
150 return save(path.string(), newPath.string());
158 bool save(
const std::filesystem::path &path)
160 return save(path.string());
170 bool exists(
const std::string &path)
const;
177 bool exists(
const std::filesystem::path &path)
const
179 return exists(path.string());
190 std::shared_ptr<utility::File>
open(
const std::string &path)
const;
197 std::shared_ptr<utility::File>
198 open(
const std::filesystem::path &path)
const
200 return open(path.string());
210 std::map<std::string, std::shared_ptr<utility::File>>
_assets;
The SystemIO class is an abstract base class for managing file assets.
virtual bool loadDirectory(const std::string &directory)=0
Loads assets from a directory.
bool save(const std::filesystem::path &path, const std::filesystem::path &newPath)
Saves an asset to the disk.
std::shared_ptr< utility::File > open(const std::filesystem::path &path) const
Opens an asset from the manager.
std::map< std::string, std::shared_ptr< utility::File > > _assets
Map of loaded assets.
bool exists(const std::string &path) const
Checks if an asset exists in the manager.
virtual void remove(const std::string &path, bool save=true)=0
Removes an asset from the manager.
virtual bool save(const std::string &path, const std::string &newPath="")=0
Saves an asset to the disk.
bool save(const std::filesystem::path &path)
Saves an asset to its original path.
bool exists(const std::filesystem::path &path) const
Checks if an asset exists in the manager.
void remove(const std::filesystem::path &path, bool save=true)
Removes an asset from the manager.
std::shared_ptr< utility::File > open(const std::string &path) const
Opens an asset from the manager.
std::shared_ptr< utility::File > add(const std::filesystem::path &path)
Adds an asset to the manager.
virtual std::shared_ptr< utility::File > add(const std::string &path)=0
Adds an asset to the manager.
bool loadDirectory(const std::filesystem::path &directory)
Loads assets from a directory.
virtual ~SystemIO()=default
Default destructor for SystemIO.
The utility namespace contains classes and functions for the utility project.