iLand
exception.h
Go to the documentation of this file.
1/********************************************************************************************
2** iLand - an individual based forest landscape and disturbance model
3** http://iland-model.org
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
20#ifndef EXCEPTION_H
21#define EXCEPTION_H
22#include <stdexcept>
23#include <QtCore/QString>
27class IException : public std::runtime_error {
28 public:
29 ~IException () throw() { }
30 IException() : std::runtime_error("iLand model exception.") { }
31 //IException(QString msg) { GlobalSettings::instance()->addErrorMessage(msg); }
32 //QString toString() const { return GlobalSettings::instance()->errorMessage(); }
33 IException(QString msg) : std::runtime_error("iLand model exception.") { add(msg); }
34 const QString &message() const { return mMsg; }
35 void add(const QString &msg) { if(!mMsg.isEmpty()) mMsg+="\n"; mMsg += msg; }
36private:
37 QString mMsg;
38};
39
40
41#endif // EXCEPTION_H
Exception IException is the iLand model exception class.
Definition: exception.h:27
~IException()
Definition: exception.h:29
IException(QString msg)
Definition: exception.h:33
const QString & message() const
Definition: exception.h:34
IException()
Definition: exception.h:30
void add(const QString &msg)
Definition: exception.h:35