utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
default_system_io.hpp
1/*
2 Copyright (c) 2026 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
25#include <filesystem>
26#include <fstream>
27#include <iostream>
28#include <memory>
29#include <string>
30
31#include "utility/system_io/system_io.hpp"
32
33namespace utility::logging
34{
35 class Logger;
36}
37
38namespace utility
39{
40
50 {
51 private:
52 std::unique_ptr<utility::logging::Logger> _logger;
53
54 protected:
60
66
67 public:
72
76 ~DefaultSystemIO() override;
77
78 using SystemIO::add;
80 using SystemIO::remove;
81 using SystemIO::save;
82
88 bool loadDirectory(const std::string &directory) override;
89
97 std::shared_ptr<utility::File> add(const std::string &path) override;
98
104 void remove(const std::string &path, bool save = true) override;
105
113 bool save(const std::string &path,
114 const std::string &newPath = "") override;
115 };
116} // namespace utility
The DefaultSystemIO class is a concrete implementation of the SystemIO interface that loads assets fr...
void remove(const std::string &path, bool save=true) override
Removes an asset from the manager.
bool loadDirectory(const std::string &directory) override
Loads assets from a directory.
DefaultSystemIO()
Constructs a DefaultSystemIO.
bool save(const std::string &path, const std::string &newPath="") override
Saves an asset to the file system.
std::shared_ptr< utility::File > add(const std::string &path) override
Adds an asset to the manager by loading it from the file system.
utility::logging::Logger & getLogger(void)
Get the internal logger.
~DefaultSystemIO() override
Default destructor for DefaultSystemIO.
The SystemIO class is an abstract base class for managing file assets.
Definition system_io.hpp:49
virtual bool loadDirectory(const std::string &directory)=0
Loads assets from a directory.
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.
virtual std::shared_ptr< utility::File > add(const std::string &path)=0
Adds an asset to the manager.
Abstract logger interface defining stream-style logging operations.
Definition logger.hpp:96
The utility namespace contains classes and functions for the utility project.
Definition cache.hpp:34