Fixed up before doing the upgrade to SFML 3.0

This commit is contained in:
Zed A. Shaw 2025-03-27 13:18:41 -04:00
parent 0766a2aacb
commit 2fa68351fc
7 changed files with 143 additions and 37 deletions

50
dbc.hpp Normal file
View file

@ -0,0 +1,50 @@
#pragma once
#include <string>
#include <fmt/core.h>
#include <functional>
#include <source_location>
using std::string;
namespace dbc {
class Error {
public:
const string message;
Error(string m) : message{m} {}
Error(const char *m) : message{m} {}
};
class CheckError : public Error {};
class SentinelError : public Error {};
class PreCondError : public Error {};
class PostCondError : public Error {};
void log(const string &message,
const std::source_location location =
std::source_location::current());
[[noreturn]] void sentinel(const string &message,
const std::source_location location =
std::source_location::current());
void pre(const string &message, bool test,
const std::source_location location =
std::source_location::current());
void pre(const string &message, std::function<bool()> tester,
const std::source_location location =
std::source_location::current());
void post(const string &message, bool test,
const std::source_location location =
std::source_location::current());
void post(const string &message, std::function<bool()> tester,
const std::source_location location =
std::source_location::current());
void check(bool test, const string &message,
const std::source_location location =
std::source_location::current());
}