Loading...
Searching...
No Matches
Exception.h
Go to the documentation of this file.
1#ifndef _EXCEPTION_H
2#define _EXCEPTION_H
3
4#include <sstream>
5using std::stringstream;
6
7// this Exception class can be used as follows:
8//
9// throw Exception("Error");
10//
11// throw Exception("Error ") << n + 7 << " while opening file: " << filename;
12
13class Exception {
14public:
15 Exception(char const *m);
16 Exception(const Exception &ex);
18 template <class T> Exception &operator<<(const T &x) {
19 *message << x;
20 return *this;
21 }
22 const char *GetMessage() const;
23
24private:
25 stringstream *message;
26};
27
28#endif // _EXCEPTION_H
const char * GetMessage() const
Exception(char const *m)
Exception(const Exception &ex)
stringstream * message
Definition Exception.h:25
Exception & operator<<(const T &x)
Definition Exception.h:18