Mercurial > public > ostc_companion
comparison Utils/Exception.h @ 2:177f640940f2
Update exception class and cleanup redifinitions
During firmware download and exception caused the application to stop.
Rootcause was the defference between QT5 and QT6 exception and string
handling which is updated now. In addition some old definitions were
removed to avoid compiler warnings.
| author | Ideenmodellierer |
|---|---|
| date | Fri, 28 Nov 2025 19:57:35 +0100 |
| parents | 0b3630a29ad8 |
| children |
comparison
equal
deleted
inserted
replaced
| 1:0b3630a29ad8 | 2:177f640940f2 |
|---|---|
| 49 # define EXPORT __declspec(dllexport) | 49 # define EXPORT __declspec(dllexport) |
| 50 #else | 50 #else |
| 51 # define EXPORT __declspec(dllimport) | 51 # define EXPORT __declspec(dllimport) |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 #if 0 | |
| 54 class EXPORT Exception | 55 class EXPORT Exception |
| 55 : public std::exception | 56 : public std::exception |
| 56 { | 57 { |
| 57 const char* const _msg; | 58 const char* const _msg; |
| 58 public: | 59 public: |
| 62 // Final cleanup. | 63 // Final cleanup. |
| 63 ~Exception() throw() override; | 64 ~Exception() throw() override; |
| 64 | 65 |
| 65 /// Message contains, in UTF8 format. | 66 /// Message contains, in UTF8 format. |
| 66 const char* what() const throw() override; | 67 const char* what() const throw() override; |
| 68 }; | |
| 69 #endif | |
| 70 | |
| 71 class EXPORT Exception : public std::exception { | |
| 72 public: | |
| 73 explicit Exception(const QString& msg); | |
| 74 explicit Exception(const char* msg); | |
| 75 | |
| 76 const char* what() const noexcept override; | |
| 77 | |
| 78 private: | |
| 79 std::string _msg; | |
| 67 }; | 80 }; |
| 68 | 81 |
| 69 ////////////////////////////////////////////////////////////////////////////// | 82 ////////////////////////////////////////////////////////////////////////////// |
| 70 | 83 |
| 71 #define DEFINE_EXCEPTION(name, parent) \ | 84 #define DEFINE_EXCEPTION(name, parent) \ |
