DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
displaceexception.h
Go to the documentation of this file.
1 #ifndef DISPLACEEXCEPTION_H
2 #define DISPLACEEXCEPTION_H
3 
4 #include <QException>
5 #include <QString>
6 
7 namespace displace {
8 
9 class DisplaceException : public QException {
10 public:
11  explicit DisplaceException (QString what, QString file = QString(), int line = -1)
12  : mWhat(what), mFile(file), mLine(line) {
13  }
14 
15  void raise() const { throw *this; }
16  DisplaceException *clone() const { return new DisplaceException(*this); }
17 
18  QString message() const {
19  return mWhat;
20  }
21  const char *what() const noexcept {
22  return mWhat.toStdString().c_str();
23  }
24  QString file() const {
25  return mFile;
26  }
27  int line() const {
28  return mLine;
29  }
30 protected:
31  QString mWhat;
32  QString mFile;
33  int mLine;
34 };
35 
36 }
37 
38 #endif // DISPLACEEXCEPTION_H
int line() const
Definition: displaceexception.h:27
Definition: decisiontreemanager.h:13
DisplaceException * clone() const
Definition: displaceexception.h:16
Definition: displaceexception.h:9
int mLine
Definition: displaceexception.h:33
QString mFile
Definition: displaceexception.h:32
const char * what() const noexcept
Definition: displaceexception.h:21
DisplaceException(QString what, QString file=QString(), int line=-1)
Definition: displaceexception.h:11
QString mWhat
Definition: displaceexception.h:31
QString message() const
Definition: displaceexception.h:18
QString file() const
Definition: displaceexception.h:24