Itasca C++ Interface
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
baseqexception.h
1 #pragma once
2 
3 #include "basetoqt.h"
4 
9 class Exception : public std::exception {
10 public:
13  BASE_EXPORT Exception(const QString &s_,const QVariant &v1=QVariant(),const QVariant &v2=QVariant(),
14  const QVariant &v3=QVariant(),const QVariant &v4=QVariant(),
15  const QVariant &v5=QVariant(),const QVariant &v6=QVariant());
17  BASE_EXPORT ~Exception() throw() { }
19  BASE_EXPORT virtual const char *what() const throw() { return message_; }
21  BASE_EXPORT void setMessage(const QString &s);
22 private:
23  static const int maxExceptionMessageLength_ = 2048;
24  char message_[maxExceptionMessageLength_];
25 };
26 
28 class QuitException : public Exception {
29 public:
30  BASE_EXPORT QuitException() : Exception("quit") { }
31 };
32 
34 class InterruptException : public Exception {
35 public:
39  BASE_EXPORT InterruptException(bool safe,const QString &state=QString())
40  : Exception("Processing interrupted by user."), safe_(safe), state_(state) { }
41 
43  BASE_EXPORT bool wasSafe() const { return safe_; }
48  BASE_EXPORT QString state() const { return state_; }
49 private:
50  bool safe_;
51  QString state_;
52 };
53 
54 // EoF
BASE_EXPORT Exception(const QString &s_, const QVariant &v1=QVariant(), const QVariant &v2=QVariant(), const QVariant &v3=QVariant(), const QVariant &v4=QVariant(), const QVariant &v5=QVariant(), const QVariant &v6=QVariant())
Definition: baseexception.cpp:5
Base exception class for all Itasca code.
Definition: baseqexception.h:9
Exception thrown when processing is done.
Definition: baseqexception.h:28
BASE_EXPORT bool wasSafe() const
returns TRUE if the interrupt was "Safe", in that the model was left in a repeatable and valid state.
Definition: baseqexception.h:43
#define BASE_EXPORT
Definition: basedef.h:21
BASE_EXPORT ~Exception()
Destructor.
Definition: baseqexception.h:17
Exception thrown when interruption occurs, e.g. user press ESC key.
Definition: baseqexception.h:34
virtual BASE_EXPORT const char * what() const
Returns the contents of the error message as a const char.
Definition: baseqexception.h:19
BASE_EXPORT void setMessage(const QString &s)
Allows the message carried by the exception to be replaced with a new one.
Definition: baseexception.cpp:12
BASE_EXPORT QString state() const
Definition: baseqexception.h:48
Combines base interface with Qt – allows Qt to interact with other Base types transparently.
BASE_EXPORT InterruptException(bool safe, const QString &state=QString())
Definition: baseqexception.h:39