diff options
Diffstat (limited to 'general/Exception.h')
-rw-r--r-- | general/Exception.h | 197 |
1 files changed, 97 insertions, 100 deletions
diff --git a/general/Exception.h b/general/Exception.h index 53a7ab4b..5197e88d 100644 --- a/general/Exception.h +++ b/general/Exception.h @@ -23,106 +23,103 @@ #ifndef __EXCEPTIONS__ #define __EXCEPTIONS__ -namespace PokeGen +class Exception { - class Exception - { - public: - Exception(const QString& c, const QString e) : - cls(c), - error(e) - { - } - - QString getMsg() const - { - return QString("%1: %2").arg(cls).arg(error); - } - private: - QString cls; - QString error; - }; - - class UnusedException : public Exception - { - public: - UnusedException(const QString& c, const QString& var) : - Exception(c, QString("setting unused %1").arg(var)) - { - } - }; - - class BoundsException : public Exception - { - public: - BoundsException(const QString& c, const QString& var) : - Exception(c, QString("%1 out-of-bounds").arg(var)) - { - } - }; - - class IndexException : public BoundsException - { - public: - IndexException(const QString& c) : - BoundsException(c, "index") - { - } - }; - - class ReplaceException : public Exception - { - public: - ReplaceException(const QString& c, const QString& f) : - Exception(c, QString("unable to replace %1").arg(f)) - { - } - }; - - class SaveException : public Exception - { - public: - SaveException(const QString& c, const QString& f) : - Exception(c, QString("unable to save %1").arg(f)) - { - } - }; - - class OpenException : public Exception - { - public: - OpenException(const QString& c, const QString& f) : - Exception(c, QString("unable to open %1").arg(f)) - { - } - }; - - class DirException : public Exception - { - public: - DirException(const QString& c, const QString& p) : - Exception(c, QString("unable to create path %1").arg(p)) - { - } - }; - - class InvalidException : public Exception - { - public: - InvalidException(const QString& c, const QString& f) : - Exception(c, QString("%1 is invalid").arg(f)) - { - } - }; - - class RemoveException : public Exception - { - public: - RemoveException(const QString& c, const QString& f) : - Exception(c, QString("unable to remove %1").arg(f)) - { - } - }; -} + public: + Exception(const QString& c, const QString e) : + cls(c), + error(e) + { + } + + QString getMsg() const + { + return QString("%1: %2").arg(cls).arg(error); + } + private: + QString cls; + QString error; +}; + +class UnusedException : public Exception +{ + public: + UnusedException(const QString& c, const QString& var) : + Exception(c, QString("setting unused %1").arg(var)) + { + } +}; + +class BoundsException : public Exception +{ + public: + BoundsException(const QString& c, const QString& var) : + Exception(c, QString("%1 out-of-bounds").arg(var)) + { + } +}; + +class IndexException : public BoundsException +{ + public: + IndexException(const QString& c) : + BoundsException(c, "index") + { + } +}; + +class ReplaceException : public Exception +{ + public: + ReplaceException(const QString& c, const QString& f) : + Exception(c, QString("unable to replace %1").arg(f)) + { + } +}; + +class SaveException : public Exception +{ + public: + SaveException(const QString& c, const QString& f) : + Exception(c, QString("unable to save %1").arg(f)) + { + } +}; + +class OpenException : public Exception +{ + public: + OpenException(const QString& c, const QString& f) : + Exception(c, QString("unable to open %1").arg(f)) + { + } +}; + +class DirException : public Exception +{ + public: + DirException(const QString& c, const QString& p) : + Exception(c, QString("unable to create path %1").arg(p)) + { + } +}; + +class InvalidException : public Exception +{ + public: + InvalidException(const QString& c, const QString& f) : + Exception(c, QString("%1 is invalid").arg(f)) + { + } +}; + +class RemoveException : public Exception +{ + public: + RemoveException(const QString& c, const QString& f) : + Exception(c, QString("unable to remove %1").arg(f)) + { + } +}; #endif |