galaxy
1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
FileError.hpp
Go to the documentation of this file.
1
7
8
#ifndef GALAXY_FS_FILEERROR_HPP_
9
#define GALAXY_FS_FILEERROR_HPP_
10
11
#include <filesystem>
12
#include <format>
13
14
namespace
galaxy
15
{
19
class
FileError
final
20
{
21
public
:
25
FileError
()
noexcept
;
26
34
FileError
(
const
std::string& mode,
const
std::string& reason,
const
std::filesystem::path& path)
noexcept
;
35
39
~FileError
()
noexcept
;
40
44
void
log
()
const
noexcept
;
45
46
public
:
50
std::string
m_mode
;
51
55
std::string
m_reason
;
56
60
std::filesystem::path
m_path
;
61
};
62
}
// namespace galaxy
63
64
template
<>
65
struct
std::formatter<
std
::filesystem::path> : std::formatter<std::string>
66
{
67
auto
format
(
const
std::filesystem::path& path, format_context& ctx)
const
noexcept
68
{
69
return
std::formatter<std::string>::format(path.string(), ctx);
70
}
71
};
72
73
template
<>
74
struct
std::formatter<
galaxy
::FileError> : std::formatter<std::string>
75
{
76
auto
format
(
const
galaxy::FileError
& fe, format_context& ctx)
const
noexcept
77
{
78
return
std::formatter<std::string>::format(std::format(
"Failed to {0} {2} because {1}"
, fe.m_mode, fe.m_reason, fe.m_path), ctx);
79
}
80
};
81
82
#endif
galaxy::FileError
Stores information about a File I/O error.
Definition
FileError.hpp:20
galaxy::FileError::log
void log() const noexcept
Prints the file error in a nice format to the console.
Definition
FileError.cpp:29
galaxy::FileError::m_reason
std::string m_reason
Reason for file i/o failure.
Definition
FileError.hpp:55
galaxy::FileError::m_mode
std::string m_mode
File I/O mode.
Definition
FileError.hpp:50
galaxy::FileError::~FileError
~FileError() noexcept
Destructor.
Definition
FileError.cpp:25
galaxy::FileError::m_path
std::filesystem::path m_path
Path error occured on.
Definition
FileError.hpp:60
galaxy::FileError::FileError
FileError() noexcept
Constructor.
Definition
FileError.cpp:14
galaxy
Animated.cpp galaxy.
Definition
Animated.cpp:16
std
STL namespace.
std::formatter< galaxy::FileError >::format
auto format(const galaxy::FileError &fe, format_context &ctx) const noexcept
Definition
FileError.hpp:76
std::formatter< std::filesystem::path >::format
auto format(const std::filesystem::path &path, format_context &ctx) const noexcept
Definition
FileError.hpp:67
galaxy
src
galaxy
fs
FileError.hpp
Generated on Fri Sep 12 2025 07:29:47 for galaxy by
1.12.0