# HG changeset patch # User Tom Fredrik Blenning Klaussen # Date 1346948983 -7200 # Node ID b2c2c2bf2bbd5d9b4f416898bc5d732349ead493 # Parent 95a10553ff90298e9b5fe20159c6271669166717 Refactor Exceptions into a separate directory. diff -r 95a10553ff90 -r b2c2c2bf2bbd CMakeLists.txt --- a/CMakeLists.txt Thu Sep 06 18:20:11 2012 +0200 +++ b/CMakeLists.txt Thu Sep 06 18:29:43 2012 +0200 @@ -29,7 +29,7 @@ HuffmanString.cpp HuffmanSet.cpp EditDistance.cpp - IOException.cpp + Exception/IOException.cpp FileDBLink.cpp SqliteDBLink.cpp MemoryDBLink.cpp @@ -40,7 +40,7 @@ SET(CLASS_HEADERS DataController.hpp EditDistance.hpp - IOException.hpp + Exception/IOException.hpp FileDBLink.hpp SqliteDBLink.hpp MemoryDBLink.hpp diff -r 95a10553ff90 -r b2c2c2bf2bbd DataController.cpp --- a/DataController.cpp Thu Sep 06 18:20:11 2012 +0200 +++ b/DataController.cpp Thu Sep 06 18:29:43 2012 +0200 @@ -2,7 +2,7 @@ #include "DataController.hpp" #include "EditDistance.hpp" #include "MemoryDBLink.hpp" -#include "PermissionException.hpp" +#include "Exception/PermissionException.hpp" #include "SqliteDBLink.hpp" #include "ConfigurationProcessing.hpp" diff -r 95a10553ff90 -r b2c2c2bf2bbd DeDupe.cpp --- a/DeDupe.cpp Thu Sep 06 18:20:11 2012 +0200 +++ b/DeDupe.cpp Thu Sep 06 18:29:43 2012 +0200 @@ -1,5 +1,5 @@ #include "DataController.hpp" -#include "Exception.hpp" +#include "Exception/Exception.hpp" #include diff -r 95a10553ff90 -r b2c2c2bf2bbd Exception.hpp --- a/Exception.hpp Thu Sep 06 18:20:11 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#ifndef EXCEPTION_HPP -#define EXCEPTION_HPP - -#include - -class Exception { - -public: - typedef QString string_t; - - virtual const string_t& toString() const - { - return errorMsg_; - } - void raise() const - { - throw *this; - } - - -protected: - Exception(const string_t& errorMsg = string_t()) : errorMsg_(errorMsg) {} - virtual ~Exception() {} - - void setErrorMsg(string_t& errorMsg); - const string_t& errorMsg(string_t& errorMsg); - -private: - string_t errorMsg_; -}; - -#endif //EXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd Exception/Exception.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Exception/Exception.hpp Thu Sep 06 18:29:43 2012 +0200 @@ -0,0 +1,32 @@ +#ifndef EXCEPTION_HPP +#define EXCEPTION_HPP + +#include + +class Exception { + +public: + typedef QString string_t; + + virtual const string_t& toString() const + { + return errorMsg_; + } + void raise() const + { + throw *this; + } + + +protected: + Exception(const string_t& errorMsg = string_t()) : errorMsg_(errorMsg) {} + virtual ~Exception() {} + + void setErrorMsg(string_t& errorMsg); + const string_t& errorMsg(string_t& errorMsg); + +private: + string_t errorMsg_; +}; + +#endif //EXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd Exception/IOException.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Exception/IOException.cpp Thu Sep 06 18:29:43 2012 +0200 @@ -0,0 +1,5 @@ +#include "IOException.hpp" + +IOException::IOException(const QString& errorMsg) : Exception(errorMsg) +{ +} diff -r 95a10553ff90 -r b2c2c2bf2bbd Exception/IOException.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Exception/IOException.hpp Thu Sep 06 18:29:43 2012 +0200 @@ -0,0 +1,11 @@ +#ifndef IOEXCEPTION_HPP +#define IOEXCEPTION_HPP + +#include "Exception.hpp" + +class IOException : public Exception { +public: + IOException(const string_t& errMsg); +}; + +#endif //IOEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd Exception/InvalidDataException.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Exception/InvalidDataException.hpp Thu Sep 06 18:29:43 2012 +0200 @@ -0,0 +1,10 @@ +#ifndef INVALIDDATAEXCEPTION_HPP +#define INVALIDDATAEXCEPTION_HPP + +#include "Exception.hpp" + +class InvalidDataException : public Exception +{ +}; + +#endif //INVALIDDATAEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd Exception/NoSuchValueException.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Exception/NoSuchValueException.hpp Thu Sep 06 18:29:43 2012 +0200 @@ -0,0 +1,10 @@ +#ifndef NOSUCHVALUEEXCEPTION_HPP +#define NOSUCHVALUEEXCEPTION_HPP + +#include "Exception.hpp" + +class NoSuchValueException : public Exception +{ +}; + +#endif //NOSUCHVALUEEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd Exception/PermissionException.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Exception/PermissionException.hpp Thu Sep 06 18:29:43 2012 +0200 @@ -0,0 +1,12 @@ +#ifndef PERMISSIONEXCEPTION_HPP +#define PERMISSIONEXCEPTION_HPP + +#include "IOException.hpp" + +class PermissionException : public IOException { +public: + PermissionException(const string_t& errorMsg) : IOException(errorMsg) {} + +}; + +#endif //PERMISSIONEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd Exception/ValueExistsException.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Exception/ValueExistsException.hpp Thu Sep 06 18:29:43 2012 +0200 @@ -0,0 +1,10 @@ +#ifndef VALUEEXISTSEXCEPTION_HPP +#define VALUEEXISTSEXCEPTION_HPP + +#include "Exception.hpp" + +class ValueExistsException : public Exception +{ +}; + +#endif //VALUEEXISTSEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd FileDBLink.cpp --- a/FileDBLink.cpp Thu Sep 06 18:20:11 2012 +0200 +++ b/FileDBLink.cpp Thu Sep 06 18:29:43 2012 +0200 @@ -1,6 +1,6 @@ #include "EditDistance.hpp" #include "FileDBLink.hpp" -#include "PermissionException.hpp" +#include "Exception/PermissionException.hpp" #include #include diff -r 95a10553ff90 -r b2c2c2bf2bbd HuffmanSet.cpp --- a/HuffmanSet.cpp Thu Sep 06 18:20:11 2012 +0200 +++ b/HuffmanSet.cpp Thu Sep 06 18:29:43 2012 +0200 @@ -1,6 +1,6 @@ #include "HuffmanString.hpp" -#include "NoSuchValueException.hpp" -#include "InvalidDataException.hpp" +#include "Exception/NoSuchValueException.hpp" +#include "Exception/InvalidDataException.hpp" #include diff -r 95a10553ff90 -r b2c2c2bf2bbd IOException.cpp --- a/IOException.cpp Thu Sep 06 18:20:11 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#include "IOException.hpp" - -IOException::IOException(const QString& errorMsg) : Exception(errorMsg) -{ -} diff -r 95a10553ff90 -r b2c2c2bf2bbd IOException.hpp --- a/IOException.hpp Thu Sep 06 18:20:11 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#ifndef IOEXCEPTION_HPP -#define IOEXCEPTION_HPP - -#include "Exception.hpp" - -class IOException : public Exception { -public: - IOException(const string_t& errMsg); -}; - -#endif //IOEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd InvalidDataException.hpp --- a/InvalidDataException.hpp Thu Sep 06 18:20:11 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#ifndef INVALIDDATAEXCEPTION_HPP -#define INVALIDDATAEXCEPTION_HPP - -#include "Exception.hpp" - -class InvalidDataException : public Exception -{ -}; - -#endif //INVALIDDATAEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd NoSuchValueException.hpp --- a/NoSuchValueException.hpp Thu Sep 06 18:20:11 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#ifndef NOSUCHVALUEEXCEPTION_HPP -#define NOSUCHVALUEEXCEPTION_HPP - -#include "Exception.hpp" - -class NoSuchValueException : public Exception -{ -}; - -#endif //NOSUCHVALUEEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd PermissionException.hpp --- a/PermissionException.hpp Thu Sep 06 18:20:11 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef PERMISSIONEXCEPTION_HPP -#define PERMISSIONEXCEPTION_HPP - -#include "IOException.hpp" - -class PermissionException : public IOException { -public: - PermissionException(const string_t& errorMsg) : IOException(errorMsg) {} - -}; - -#endif //PERMISSIONEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd RBTree.hpp --- a/RBTree.hpp Thu Sep 06 18:20:11 2012 +0200 +++ b/RBTree.hpp Thu Sep 06 18:29:43 2012 +0200 @@ -3,7 +3,7 @@ #include #include -#include "ValueExistsException.hpp" +#include "Exception/ValueExistsException.hpp" #include diff -r 95a10553ff90 -r b2c2c2bf2bbd TestBitDecoder.cpp --- a/TestBitDecoder.cpp Thu Sep 06 18:20:11 2012 +0200 +++ b/TestBitDecoder.cpp Thu Sep 06 18:29:43 2012 +0200 @@ -1,7 +1,7 @@ #include "BitDecoder.hpp" #include "TestFramework.hpp" -#include "InvalidDataException.hpp" +#include "Exception/InvalidDataException.hpp" #include QBitArray bitsFromString(const QString& str) diff -r 95a10553ff90 -r b2c2c2bf2bbd ValueExistsException.hpp --- a/ValueExistsException.hpp Thu Sep 06 18:20:11 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -#ifndef VALUEEXISTSEXCEPTION_HPP -#define VALUEEXISTSEXCEPTION_HPP - -#include "Exception.hpp" - -class ValueExistsException : public Exception -{ -}; - -#endif //VALUEEXISTSEXCEPTION_HPP diff -r 95a10553ff90 -r b2c2c2bf2bbd updateDeDupe.cpp --- a/updateDeDupe.cpp Thu Sep 06 18:20:11 2012 +0200 +++ b/updateDeDupe.cpp Thu Sep 06 18:29:43 2012 +0200 @@ -1,5 +1,5 @@ #include "DataController.hpp" -#include "Exception.hpp" +#include "Exception/Exception.hpp" #include