19 lines
569 B
C++
19 lines
569 B
C++
|
#ifndef sk_MUTILS_HPP
|
||
|
#define sk_MUTILS_HPP
|
||
|
|
||
|
#include <stdexcept>
|
||
|
|
||
|
#define ENUM_ENUM(X) X
|
||
|
#define ENUM_STRING(X) #X
|
||
|
|
||
|
#define SK_ENUM(PREFIX, ENUM) \
|
||
|
enum PREFIX ## Type { ENUM(ENUM_ENUM) }; \
|
||
|
constexpr char const* PREFIX ## TypeStr [] = { ENUM(ENUM_STRING) }
|
||
|
|
||
|
#define SK_ERROR(NAME) \
|
||
|
struct NAME : public std::runtime_error { \
|
||
|
NAME (std::string const& what) : std::runtime_error(what) {} \
|
||
|
}
|
||
|
|
||
|
#endif
|