2021-07-06 15:43:33 +02:00
|
|
|
#ifndef YERBACON_HPP
|
|
|
|
#define YERBACON_HPP
|
|
|
|
|
2021-07-06 17:29:26 +02:00
|
|
|
#ifndef YBCON_VERSION
|
2021-07-07 20:06:18 +02:00
|
|
|
#warning "YBCON_VERSION is unknown and will therefore be set to a default value"
|
2021-07-06 17:29:26 +02:00
|
|
|
#define YBCON_VERSION "UNKNOWN"
|
|
|
|
#endif
|
|
|
|
|
2021-07-31 16:47:00 +02:00
|
|
|
#ifdef __STDC_NO_THREADS__
|
|
|
|
#error "A valid std::threads implementation is required"
|
|
|
|
#endif
|
|
|
|
|
2021-10-02 12:59:33 +02:00
|
|
|
#include <version>
|
|
|
|
#if not defined(__cpp_lib_concepts) || not defined(__cpp_lib_integer_comparison_functions)
|
|
|
|
#error "The current standard library is incomplete"
|
|
|
|
#endif
|
|
|
|
#ifndef __cpp_using_enum
|
|
|
|
#error "The "using enum" syntax is not supported by this compiler"
|
|
|
|
#endif
|
|
|
|
|
2021-07-29 17:35:35 +02:00
|
|
|
#include <exception>
|
|
|
|
#include <string_view>
|
|
|
|
#include <string>
|
2021-08-18 19:31:02 +02:00
|
|
|
#include <optional>
|
2021-07-29 17:35:35 +02:00
|
|
|
|
2021-07-06 15:43:33 +02:00
|
|
|
namespace Yerbacon {
|
|
|
|
consteval const char* getVersion() noexcept { return YBCON_VERSION; }
|
2021-07-29 17:35:35 +02:00
|
|
|
class Exception: public std::exception {
|
2021-09-25 17:34:41 +02:00
|
|
|
std::string exceptionCause;
|
2021-08-18 18:59:46 +02:00
|
|
|
public:
|
|
|
|
[[nodiscard]] const char* what() const noexcept final {
|
2021-07-29 17:35:35 +02:00
|
|
|
return exceptionCause.data();
|
|
|
|
}
|
|
|
|
explicit Exception(const std::string_view& cause): exceptionCause(cause) {}
|
2021-10-02 13:33:50 +02:00
|
|
|
Exception(const std::string_view& cause, unsigned long line): Exception(('L' + std::to_string(line) + ": ").append(cause)) {}
|
2021-07-29 17:35:35 +02:00
|
|
|
};
|
2021-07-06 15:43:33 +02:00
|
|
|
}
|
|
|
|
|
2021-08-10 15:48:26 +02:00
|
|
|
#undef YBCON_VERSION
|
2021-07-06 15:43:33 +02:00
|
|
|
#endif
|