35 lines
530 B
C++
Executable File
35 lines
530 B
C++
Executable File
#ifndef EXCEPTION_H
|
|
#define EXCEPTION_H
|
|
|
|
#include <exception>
|
|
#include <string>
|
|
|
|
#ifdef ANDROID
|
|
#include <QMessageBox>
|
|
#endif
|
|
|
|
class Exception : public std::exception {
|
|
|
|
private:
|
|
|
|
/** the exception message */
|
|
std::string str;
|
|
|
|
public:
|
|
|
|
/** ctor */
|
|
Exception(const std::string& str) : str(str) {
|
|
|
|
// TODO better solution?
|
|
#ifdef ANDROID
|
|
QMessageBox::question(nullptr, "Exception", str.c_str(), QMessageBox::Ok);
|
|
#endif
|
|
|
|
}
|
|
|
|
const char* what() const throw() {return str.c_str();}
|
|
|
|
};
|
|
|
|
#endif // EXCEPTION_H
|