comparison Exception/Exception.hpp @ 28:b2c2c2bf2bbd

Refactor Exceptions into a separate directory.
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Thu, 06 Sep 2012 18:29:43 +0200
parents Exception.hpp@06166d6c083b
children c9447697609f
comparison
equal deleted inserted replaced
27:95a10553ff90 28:b2c2c2bf2bbd
1 #ifndef EXCEPTION_HPP
2 #define EXCEPTION_HPP
3
4 #include <QtCore/QString>
5
6 class Exception {
7
8 public:
9 typedef QString string_t;
10
11 virtual const string_t& toString() const
12 {
13 return errorMsg_;
14 }
15 void raise() const
16 {
17 throw *this;
18 }
19
20
21 protected:
22 Exception(const string_t& errorMsg = string_t()) : errorMsg_(errorMsg) {}
23 virtual ~Exception() {}
24
25 void setErrorMsg(string_t& errorMsg);
26 const string_t& errorMsg(string_t& errorMsg);
27
28 private:
29 string_t errorMsg_;
30 };
31
32 #endif //EXCEPTION_HPP