From: Mikko Rasa Date: Mon, 19 Sep 2016 13:45:15 +0000 (+0300) Subject: Move all exception classes to except.h, for real this time X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=5da82753b395e335edaa09555566c6ffb8769118;p=libs%2Fdatafile.git Move all exception classes to except.h, for real this time --- diff --git a/source/except.cpp b/source/except.cpp index eea692e..d3929f6 100644 --- a/source/except.cpp +++ b/source/except.cpp @@ -1,4 +1,3 @@ -#include #include #include #include "except.h" @@ -48,5 +47,20 @@ nesting_error::nesting_error(const string &w): logic_error(w) { } + +unknown_keyword::unknown_keyword(const string &k): + runtime_error(k) +{ } + + +invalid_signature::invalid_signature(const string &k, const string &s): + runtime_error(format("%s %s", k, s)) +{ } + + +no_collection::no_collection(const type_info &t): + runtime_error(Debug::demangle(t.name())) +{ } + } // namespace DataFile } // namespace Msp diff --git a/source/except.h b/source/except.h index e68ec48..ed9ca23 100644 --- a/source/except.h +++ b/source/except.h @@ -2,6 +2,7 @@ #define MSP_DATAFILE_EXCEPT_H_ #include +#include namespace Msp { namespace DataFile { @@ -56,6 +57,29 @@ public: virtual ~nesting_error() throw() { } }; + +class unknown_keyword: public std::runtime_error +{ +public: + unknown_keyword(const std::string &); + virtual ~unknown_keyword() throw() { } +}; + + +class invalid_signature: public std::runtime_error +{ +public: + invalid_signature(const std::string &, const std::string &); + virtual ~invalid_signature() throw() { } +}; + + +class no_collection: public std::runtime_error +{ +public: + no_collection(const std::type_info &); +}; + } // namespace DataFile } // namespace Msp diff --git a/source/loader.cpp b/source/loader.cpp index 4bc715a..81fd27e 100644 --- a/source/loader.cpp +++ b/source/loader.cpp @@ -47,28 +47,6 @@ bool signature_match(const string &st_sig, const string &act_sig) namespace Msp { namespace DataFile { -class unknown_keyword: public runtime_error -{ -public: - unknown_keyword(const std::string &k): - runtime_error(k) - { } - - virtual ~unknown_keyword() throw() { } -}; - - -class invalid_signature: public runtime_error -{ -public: - invalid_signature(const std::string &k, const std::string &s): - runtime_error(format("%s %s", k, s)) - { } - - virtual ~invalid_signature() throw() { } -}; - - Loader::Loader(): cur_st(0), direct(false), diff --git a/source/objectloader.cpp b/source/objectloader.cpp deleted file mode 100644 index 6d59812..0000000 --- a/source/objectloader.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "objectloader.h" - -using namespace std; - -namespace Msp { -namespace DataFile { - -no_collection::no_collection(const type_info &t): - runtime_error(Debug::demangle(t.name())) -{ } - -} // namespace DataFile -} // namespace Msp diff --git a/source/objectloader.h b/source/objectloader.h index 76fc412..e383109 100644 --- a/source/objectloader.h +++ b/source/objectloader.h @@ -1,18 +1,12 @@ #ifndef MSP_DATAFILE_OBJECTLOADER_H_ #define MSP_DATAFILE_OBJECTLOADER_H_ -#include +#include "except.h" #include "loader.h" namespace Msp { namespace DataFile { -class no_collection: public std::runtime_error -{ -public: - no_collection(const std::type_info &); -}; - class Collection; /**