20 #ifndef GAIA_GAIAEXCEPTION_H 21 #define GAIA_GAIAEXCEPTION_H 24 #include <QStringList> 25 #include <QTextStream> 27 #include "baseexception.h" 32 inline QTextStream& operator<<(QTextStream& out, const QPair<int, int>& p) {
33 return out <<
'<' << p.first <<
", " << p.second <<
'>';
37 inline QTextStream& operator<<(QTextStream& out,
const QStringList& slist) {
38 if (slist.empty())
return out <<
"[]";
39 return out <<
"[ " << slist.join(
", ") <<
" ]";
58 template <
typename T,
typename U>
60 QTextStream(&_msg) << a << b;
63 template <
typename T,
typename U,
typename V>
65 QTextStream(&_msg) << a << b << c;
68 template <
typename T,
typename U,
typename V,
typename W>
70 QTextStream(&_msg) << a << b << c << d;
74 virtual const char* what()
const throw() {
81 if (_msg.size() > 0) {
82 const_cast<GaiaException*
>(
this)->_message = _msg.toUtf8().data();
84 return _message.c_str();
87 const QString& msg()
const throw () {
return _msg; }
88 QString& msg()
throw () {
return _msg; }
95 #define GAIA_DEFINE_EXCEPTION(UserException) \ 96 class UserException : public gaia2::GaiaException { \ 99 UserException(const QString& msg) : gaia2::GaiaException(msg) {} \ 100 UserException(const char* msg) : gaia2::GaiaException(msg) {} \ 101 UserException(const std::string& msg) : gaia2::GaiaException(msg) {} \ 102 UserException(const QStringList& msg) : gaia2::GaiaException(msg) {} \ 103 template <typename T, typename U> \ 104 UserException(const T& a, const U& b) : gaia2::GaiaException(a, b) {} \ 105 template <typename T, typename U, typename V> \ 106 UserException(const T& a, const U& b, const V& c) : gaia2::GaiaException(a, b, c) {} \ 107 template <typename T, typename U, typename V, typename W> \ 108 UserException(const T& a, const U& b, const V& c, const W& d) : \ 109 gaia2::GaiaException(a, b, c, d) {} \ 114 GAIA_DEFINE_EXCEPTION(FixedLengthException);
119 #endif // GAIA_GAIAEXCEPTION_H Main Gaia namespace, which contains all the library functions.
Definition: addfield.cpp:22
Definition: baseexception.h:28
Exception class that can take up to 3 arguments of any type, which will be serialized into a QString ...
Definition: gaiaexception.h:46