SleakEngine
0.1.0
C++23 multi-backend game engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Exception.hpp
Go to the documentation of this file.
1
#ifndef _EXCEPTIONS_H_
2
#define _EXCEPTIONS_H_
3
4
#include <exception>
5
#include <string>
6
7
namespace
Sleak
{
8
9
/// Root of every Sleak-specific exception; carries a plain message string.
10
/// @ingroup utility
11
class
SleakException
:
public
std::exception {
12
public
:
13
SleakException
(
const
std::string& message) :
message_
(message) {}
14
virtual
const
char
*
what
() const noexcept
override
{
return
message_
.c_str(); }
15
16
protected
:
17
std::string
message_
;
18
};
19
20
/// Thrown when a container index is out of range.
21
/// @ingroup utility
22
class
IndexOutOfBoundsException
:
public
SleakException
{
23
public
:
24
IndexOutOfBoundsException
(
const
std::string& message =
"Index out of bounds"
)
25
:
SleakException
(message) {}
26
};
27
28
/// Thrown for invalid iterator use (dereferencing end(), stale iterators, etc.).
29
/// @ingroup utility
30
class
InvalidIteratorException
:
public
SleakException
{
31
public
:
32
InvalidIteratorException
(
const
std::string& message =
"Invalid iterator operation"
)
33
:
SleakException
(message) {}
34
};
35
36
/// Thrown when a function receives an argument it can't work with.
37
/// @ingroup utility
38
class
InvalidArgumentException
:
public
SleakException
{
39
public
:
40
InvalidArgumentException
(
const
std::string& message =
"Invalid argument operation"
)
41
:
SleakException
(message) {}
42
};
43
44
/// Thrown by operations that require at least one element (e.g. Stack::top on an empty stack).
45
/// @ingroup utility
46
class
EmptyContainerException
:
public
SleakException
{
47
public
:
48
EmptyContainerException
(
const
std::string& message =
"Container is empty"
)
49
:
SleakException
(message) {}
50
};
51
52
/// Thrown when code dereferences or accesses through a null pointer.
53
/// @ingroup utility
54
class
NullPointerException
:
public
SleakException
{
55
public
:
56
NullPointerException
(
const
std::string& message =
"Null pointer access"
)
57
:
SleakException
(message) {}
58
};
59
60
/// Thrown when no active camera is registered where one is required.
61
/// @ingroup utility
62
class
CameraNotFound
:
public
NullPointerException
{
63
public
:
64
CameraNotFound
(
const
std::string& message =
"No camera found in static list!"
)
65
:
NullPointerException
(message) {}
66
};
67
68
/// Thrown on file read/write failures.
69
/// @ingroup utility
70
class
FileIOException
:
public
SleakException
{
71
public
:
72
FileIOException
(
const
std::string& message =
"File I/O error"
)
73
:
SleakException
(message) {}
74
};
75
76
/// Thrown by stubbed-out code paths that haven't been implemented yet.
77
/// @ingroup utility
78
class
NotImplementedException
:
public
SleakException
{
79
public
:
80
NotImplementedException
(
const
std::string& message =
"Not implemented"
)
81
:
SleakException
(message) {}
82
};
83
}
84
85
#endif
// _EXCEPTIONS_H_
Sleak::CameraNotFound::CameraNotFound
CameraNotFound(const std::string &message="No camera found in static list!")
Definition
Exception.hpp:64
Sleak::EmptyContainerException::EmptyContainerException
EmptyContainerException(const std::string &message="Container is empty")
Definition
Exception.hpp:48
Sleak::FileIOException::FileIOException
FileIOException(const std::string &message="File I/O error")
Definition
Exception.hpp:72
Sleak::IndexOutOfBoundsException::IndexOutOfBoundsException
IndexOutOfBoundsException(const std::string &message="Index out of bounds")
Definition
Exception.hpp:24
Sleak::InvalidArgumentException::InvalidArgumentException
InvalidArgumentException(const std::string &message="Invalid argument operation")
Definition
Exception.hpp:40
Sleak::InvalidIteratorException::InvalidIteratorException
InvalidIteratorException(const std::string &message="Invalid iterator operation")
Definition
Exception.hpp:32
Sleak::NotImplementedException::NotImplementedException
NotImplementedException(const std::string &message="Not implemented")
Definition
Exception.hpp:80
Sleak::NullPointerException::NullPointerException
NullPointerException(const std::string &message="Null pointer access")
Definition
Exception.hpp:56
Sleak::SleakException::what
virtual const char * what() const noexcept override
Definition
Exception.hpp:14
Sleak::SleakException::SleakException
SleakException(const std::string &message)
Definition
Exception.hpp:13
Sleak::SleakException::message_
std::string message_
Definition
Exception.hpp:17
Sleak
Root namespace for everything the engine exposes.
Definition
Camera.hpp:10
include
public
Utility
Exception.hpp
Generated on
for SleakEngine by
1.18.0