]> git.tdb.fi Git - ext/openal.git/blob - core/except.h
Import OpenAL Soft 1.23.1 sources
[ext/openal.git] / core / except.h
1 #ifndef CORE_EXCEPT_H
2 #define CORE_EXCEPT_H
3
4 #include <cstdarg>
5 #include <exception>
6 #include <string>
7 #include <utility>
8
9
10 namespace al {
11
12 class base_exception : public std::exception {
13     std::string mMessage;
14
15 protected:
16     base_exception() = default;
17     virtual ~base_exception();
18
19     void setMessage(const char *msg, std::va_list args);
20
21 public:
22     const char *what() const noexcept override { return mMessage.c_str(); }
23 };
24
25 } // namespace al
26
27 #define START_API_FUNC try
28
29 #define END_API_FUNC catch(...) { std::terminate(); }
30
31 #endif /* CORE_EXCEPT_H */