Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
671 werner 1
/********************************************************************************************
2
**    iLand - an individual based forest landscape and disturbance model
3
**    http://iland.boku.ac.at
4
**    Copyright (C) 2009-  Werner Rammer, Rupert Seidl
5
**
6
**    This program is free software: you can redistribute it and/or modify
7
**    it under the terms of the GNU General Public License as published by
8
**    the Free Software Foundation, either version 3 of the License, or
9
**    (at your option) any later version.
10
**
11
**    This program is distributed in the hope that it will be useful,
12
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
**    GNU General Public License for more details.
15
**
16
**    You should have received a copy of the GNU General Public License
17
**    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
********************************************************************************************/
19
 
102 Werner 20
#ifndef EXCEPTION_H
21
#define EXCEPTION_H
121 Werner 22
#include <stdexcept>
281 werner 23
#include <QtCore/QString>
102 Werner 24
/** Exception IException is the iLand model exception class.
120 Werner 25
    The class uses a string to store exception messages.
102 Werner 26
  */
121 Werner 27
class IException : public std::runtime_error {
102 Werner 28
 public:
121 Werner 29
   ~IException () throw() {  }
30
   IException() : std::runtime_error("iLand model exception.") { }
120 Werner 31
   //IException(QString msg)  { GlobalSettings::instance()->addErrorMessage(msg); }
32
   //QString toString() const { return GlobalSettings::instance()->errorMessage(); }
121 Werner 33
   IException(QString msg) : std::runtime_error("iLand model exception.") { add(msg); }
575 werner 34
   const QString &message() const { return mMsg; }
120 Werner 35
   void add(const QString &msg) { if(!mMsg.isEmpty()) mMsg+="\n"; mMsg += msg; }
102 Werner 36
private:
120 Werner 37
   QString mMsg;
102 Werner 38
};
39
 
40
 
41
#endif // EXCEPTION_H