CalcMySky  v0.3.1
Exception.hpp
1 #ifndef INCLUDE_ONCE_AA4CEB19_3901_49E3_A1FD_4287402FC84B
2 #define INCLUDE_ONCE_AA4CEB19_3901_49E3_A1FD_4287402FC84B
3 
4 #include <QString>
5 #include <QObject>
6 
7 namespace ShowMySky
8 {
9 
10 /* We use GCC-(and clang-)specific pragma instead of SHOWMYSKY_DLL_PUBLIC, because:
11  * 1. This declaration as public is not needed on MSVC;
12  * 2. If SHOWMYSKY_DLL_PUBLIC is used, it results in __declspec(dllimport)
13  * conflicting with declaration of the derivative classes, which leads to
14  * LNK4217 and LNK4049 warnings, and finally LNK2001 error.
15  * We still do set default visibility, because on macOS this symbol being
16  * hidden prevents the exceptions from being caught when emitted from the
17  * library and expected in an application.
18  */
19 #ifdef __GNUC__
20 # pragma GCC visibility push(default)
21 #endif
22 
25 class Error
26 {
27 public:
29  virtual QString errorType() const = 0;
31  virtual QString what() const = 0;
32 };
33 #ifdef __GNUC__
34 # pragma GCC visibility pop
35 #endif
36 
37 }
38 
39 #endif
An error that ShowMySky classes may throw.
Definition: Exception.hpp:25
virtual QString what() const =0
A description of the error.
virtual QString errorType() const =0
A string suitable for use as a title of a message box.