From 2a88e74086c254baf66ac45fff9d4c57895c2aaa Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 26 Oct 2013 22:30:20 +0300 Subject: [PATCH] Refactoring. --HG-- branch : develop --- exception/vexception.cpp | 3 --- exception/vexception.h | 22 ++++++++---------- exception/vexceptionbadid.cpp | 11 --------- exception/vexceptionbadid.h | 20 ++++++++-------- exception/vexceptionconversionerror.cpp | 4 ---- exception/vexceptionconversionerror.h | 13 +++++------ exception/vexceptionemptyparameter.cpp | 5 ---- exception/vexceptionemptyparameter.h | 28 +++++++++++------------ exception/vexceptionobjecterror.cpp | 4 ---- exception/vexceptionobjecterror.h | 29 ++++++++++++------------ exception/vexceptionuniqueid.cpp | 1 - exception/vexceptionuniqueid.h | 21 ++++++++--------- exception/vexceptionwrongparameterid.cpp | 4 ---- exception/vexceptionwrongparameterid.h | 23 +++++++++---------- 14 files changed, 75 insertions(+), 113 deletions(-) diff --git a/exception/vexception.cpp b/exception/vexception.cpp index a22df35a3..ade9cb27d 100644 --- a/exception/vexception.cpp +++ b/exception/vexception.cpp @@ -25,9 +25,6 @@ VException::VException(const QString &what):QException(), what(what){ Q_ASSERT_X(!what.isEmpty(), Q_FUNC_INFO, "Error message is empty"); } -VException::VException(const VException &e):what(e.What()){ -} - QString VException::ErrorMessage() const{ QString error = QString("Exception: %1").arg(what); return error; diff --git a/exception/vexception.h b/exception/vexception.h index fc53c3d77..ad21054fb 100644 --- a/exception/vexception.h +++ b/exception/vexception.h @@ -24,21 +24,19 @@ #define VEXCEPTION_H #include -#include -class VException : public QException -{ +class VException : public QException{ public: - VException(const QString &what); - VException(const VException &e); - virtual ~VException() noexcept(true){} - void raise() const { throw *this; } - VException *clone() const { return new VException(*this); } - virtual QString ErrorMessage() const; - virtual QString DetailedInformation() const { return QString(); } - QString What() const {return what;} + VException(const QString &what); + VException(const VException &e):what(e.What()){} + virtual ~VException() noexcept(true){} + inline void raise() const { throw *this; } + inline VException *clone() const { return new VException(*this); } + virtual QString ErrorMessage() const; + virtual QString DetailedInformation() const { return QString(); } + inline QString What() const {return what;} protected: - QString what; + QString what; }; #endif // VEXCEPTION_H diff --git a/exception/vexceptionbadid.cpp b/exception/vexceptionbadid.cpp index 82f686f48..6e6d13691 100644 --- a/exception/vexceptionbadid.cpp +++ b/exception/vexceptionbadid.cpp @@ -21,17 +21,6 @@ #include "vexceptionbadid.h" -VExceptionBadId::VExceptionBadId(const QString &what, const qint64 &id):VException(what), id(id), - key(QString()){ -} - -VExceptionBadId::VExceptionBadId(const QString &what, const QString &key):VException(what), id(0), key(key) -{ -} - -VExceptionBadId::VExceptionBadId(const VExceptionBadId &e):VException(e), id(e.BadId()), key(e.BadKey()){ -} - QString VExceptionBadId::ErrorMessage() const{ QString error; if(key.isEmpty()){ diff --git a/exception/vexceptionbadid.h b/exception/vexceptionbadid.h index caa9fcd54..47a772c6b 100644 --- a/exception/vexceptionbadid.h +++ b/exception/vexceptionbadid.h @@ -24,19 +24,19 @@ #include "vexception.h" -class VExceptionBadId : public VException -{ +class VExceptionBadId : public VException{ public: - VExceptionBadId(const QString &what, const qint64 &id); - VExceptionBadId(const QString &what, const QString &key); - VExceptionBadId(const VExceptionBadId &e); - virtual ~VExceptionBadId() noexcept(true){} + VExceptionBadId(const QString &what, const qint64 &id):VException(what), id(id), + key(QString()){} + VExceptionBadId(const QString &what, const QString &key):VException(what), id(0), key(key){} + VExceptionBadId(const VExceptionBadId &e):VException(e), id(e.BadId()), key(e.BadKey()){} + virtual ~VExceptionBadId() noexcept(true){} virtual QString ErrorMessage() const; - qint64 BadId() const {return id; } - QString BadKey() const {return key; } + inline qint64 BadId() const {return id; } + inline QString BadKey() const {return key; } protected: - qint64 id; - QString key; + qint64 id; + QString key; }; #endif // VEXCEPTIONBADID_H diff --git a/exception/vexceptionconversionerror.cpp b/exception/vexceptionconversionerror.cpp index 7bfbf1366..6fca5172b 100644 --- a/exception/vexceptionconversionerror.cpp +++ b/exception/vexceptionconversionerror.cpp @@ -26,10 +26,6 @@ VExceptionConversionError::VExceptionConversionError(const QString &what, const Q_ASSERT_X(!str.isEmpty(), Q_FUNC_INFO, "Error converting string is empty"); } -VExceptionConversionError::VExceptionConversionError(const VExceptionConversionError &e): - VException(e), str(e.String()){ -} - QString VExceptionConversionError::ErrorMessage() const{ QString error = QString("ExceptionConversionError: %1 %2").arg(what, str); return error; diff --git a/exception/vexceptionconversionerror.h b/exception/vexceptionconversionerror.h index f0650a50d..3b011ed07 100644 --- a/exception/vexceptionconversionerror.h +++ b/exception/vexceptionconversionerror.h @@ -24,16 +24,15 @@ #include "vexception.h" -class VExceptionConversionError : public VException -{ +class VExceptionConversionError : public VException{ public: - VExceptionConversionError(const QString &what, const QString &str); - VExceptionConversionError(const VExceptionConversionError &e); - virtual ~VExceptionConversionError() noexcept(true) {} + VExceptionConversionError(const QString &what, const QString &str); + VExceptionConversionError(const VExceptionConversionError &e):VException(e), str(e.String()){} + virtual ~VExceptionConversionError() noexcept(true) {} virtual QString ErrorMessage() const; - QString String() const {return str;} + inline QString String() const {return str;} protected: - QString str; + QString str; }; #endif // VEXCEPTIONCONVERSIONERROR_H diff --git a/exception/vexceptionemptyparameter.cpp b/exception/vexceptionemptyparameter.cpp index fb7ee565f..b070a682f 100644 --- a/exception/vexceptionemptyparameter.cpp +++ b/exception/vexceptionemptyparameter.cpp @@ -20,7 +20,6 @@ ****************************************************************************/ #include "vexceptionemptyparameter.h" -#include VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QString &name, const QDomElement &domElement): VException(what), @@ -33,10 +32,6 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QS lineNumber = domElement.lineNumber(); } -VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParameter &e):VException(e), - name(e.Name()), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){ -} - QString VExceptionEmptyParameter::ErrorMessage() const{ QString error = QString("ExceptionEmptyParameter: %1 %2").arg(what, name); return error; diff --git a/exception/vexceptionemptyparameter.h b/exception/vexceptionemptyparameter.h index 5e2ad973f..694ab0913 100644 --- a/exception/vexceptionemptyparameter.h +++ b/exception/vexceptionemptyparameter.h @@ -23,25 +23,25 @@ #define VEXCEPTIONEMPTYPARAMETER_H #include "vexception.h" -#include -class VExceptionEmptyParameter : public VException -{ +class VExceptionEmptyParameter : public VException{ public: - VExceptionEmptyParameter(const QString &what, const QString &name, const QDomElement &domElement); - VExceptionEmptyParameter(const VExceptionEmptyParameter &e); - virtual ~VExceptionEmptyParameter() noexcept(true) {} + VExceptionEmptyParameter(const QString &what, const QString &name, + const QDomElement &domElement); + VExceptionEmptyParameter(const VExceptionEmptyParameter &e):VException(e), name(e.Name()), + tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){} + virtual ~VExceptionEmptyParameter() noexcept(true) {} virtual QString ErrorMessage() const; virtual QString DetailedInformation() const; - QString Name() const {return name;} - QString TagText() const {return tagText;} - QString TagName() const {return tagName;} - qint32 LineNumber() const {return lineNumber;} + inline QString Name() const {return name;} + inline QString TagText() const {return tagText;} + inline QString TagName() const {return tagName;} + inline qint32 LineNumber() const {return lineNumber;} protected: - QString name; - QString tagText; - QString tagName; - qint32 lineNumber; + QString name; + QString tagText; + QString tagName; + qint32 lineNumber; }; #endif // VEXCEPTIONEMPTYPARAMETER_H diff --git a/exception/vexceptionobjecterror.cpp b/exception/vexceptionobjecterror.cpp index d1a424eff..e3f4d833c 100644 --- a/exception/vexceptionobjecterror.cpp +++ b/exception/vexceptionobjecterror.cpp @@ -31,10 +31,6 @@ VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElem lineNumber = domElement.lineNumber(); } -VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e):VException(e), - tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()), moreInfo(e.MoreInformation()){ -} - QString VExceptionObjectError::ErrorMessage() const{ QString error = QString("ExceptionObjectError: %1").arg(what); return error; diff --git a/exception/vexceptionobjecterror.h b/exception/vexceptionobjecterror.h index f0e36bb99..ab38f164e 100644 --- a/exception/vexceptionobjecterror.h +++ b/exception/vexceptionobjecterror.h @@ -23,26 +23,25 @@ #define VEXCEPTIONOBJECTERROR_H #include "vexception.h" -#include -class VExceptionObjectError : public VException -{ +class VExceptionObjectError : public VException{ public: - VExceptionObjectError(const QString &what, const QDomElement &domElement); - VExceptionObjectError(const VExceptionObjectError &e); - virtual ~VExceptionObjectError() noexcept(true) {} + VExceptionObjectError(const QString &what, const QDomElement &domElement); + VExceptionObjectError(const VExceptionObjectError &e):VException(e), tagText(e.TagText()), + tagName(e.TagName()), lineNumber(e.LineNumber()), moreInfo(e.MoreInformation()){} + virtual ~VExceptionObjectError() noexcept(true) {} virtual QString ErrorMessage() const; virtual QString DetailedInformation() const; - QString TagText() const {return tagText;} - QString TagName() const {return tagName;} - qint32 LineNumber() const {return lineNumber;} - void AddMoreInformation(const QString &info); - QString MoreInformation() const {return moreInfo;} + inline QString TagText() const {return tagText;} + inline QString TagName() const {return tagName;} + inline qint32 LineNumber() const {return lineNumber;} + void AddMoreInformation(const QString &info); + inline QString MoreInformation() const {return moreInfo;} protected: - QString tagText; - QString tagName; - qint32 lineNumber; - QString moreInfo; + QString tagText; + QString tagName; + qint32 lineNumber; + QString moreInfo; }; #endif // VEXCEPTIONOBJECTERROR_H diff --git a/exception/vexceptionuniqueid.cpp b/exception/vexceptionuniqueid.cpp index 51ddf4c82..c33fb592d 100644 --- a/exception/vexceptionuniqueid.cpp +++ b/exception/vexceptionuniqueid.cpp @@ -1,5 +1,4 @@ #include "vexceptionuniqueid.h" -#include VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &domElement) :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){ diff --git a/exception/vexceptionuniqueid.h b/exception/vexceptionuniqueid.h index 1bf1760d4..d2e9cb5bd 100644 --- a/exception/vexceptionuniqueid.h +++ b/exception/vexceptionuniqueid.h @@ -2,23 +2,22 @@ #define VEXCEPTIONUNIQUEID_H #include "vexception.h" -#include class VExceptionUniqueId : public VException{ public: - VExceptionUniqueId(const QString &what, const QDomElement &domElement); - VExceptionUniqueId(const VExceptionUniqueId &e):VException(e), tagText(e.TagText()), - tagName(e.TagName()), lineNumber(e.LineNumber()){} - virtual ~VExceptionUniqueId() noexcept(true){} + VExceptionUniqueId(const QString &what, const QDomElement &domElement); + VExceptionUniqueId(const VExceptionUniqueId &e):VException(e), tagText(e.TagText()), + tagName(e.TagName()), lineNumber(e.LineNumber()){} + virtual ~VExceptionUniqueId() noexcept(true){} virtual QString ErrorMessage() const; virtual QString DetailedInformation() const; - QString TagText() const {return tagText;} - QString TagName() const {return tagName;} - qint32 LineNumber() const {return lineNumber;} + inline QString TagText() const {return tagText;} + inline QString TagName() const {return tagName;} + inline qint32 LineNumber() const {return lineNumber;} protected: - QString tagText; - QString tagName; - qint32 lineNumber; + QString tagText; + QString tagName; + qint32 lineNumber; }; #endif // VEXCEPTIONUNIQUEID_H diff --git a/exception/vexceptionwrongparameterid.cpp b/exception/vexceptionwrongparameterid.cpp index 0da7ea21b..59dd94450 100644 --- a/exception/vexceptionwrongparameterid.cpp +++ b/exception/vexceptionwrongparameterid.cpp @@ -31,10 +31,6 @@ VExceptionWrongParameterId::VExceptionWrongParameterId(const QString &what, cons lineNumber = domElement.lineNumber(); } -VExceptionWrongParameterId::VExceptionWrongParameterId(const VExceptionWrongParameterId &e):VException(e), - tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){ -} - QString VExceptionWrongParameterId::ErrorMessage() const{ QString error = QString("ExceptionWrongParameterId: %1").arg(what); return error; diff --git a/exception/vexceptionwrongparameterid.h b/exception/vexceptionwrongparameterid.h index 1b8e611f6..1c4a9933c 100644 --- a/exception/vexceptionwrongparameterid.h +++ b/exception/vexceptionwrongparameterid.h @@ -23,23 +23,22 @@ #define VEXCEPTIONWRONGPARAMETERID_H #include "vexception.h" -#include -class VExceptionWrongParameterId : public VException -{ +class VExceptionWrongParameterId : public VException{ public: - VExceptionWrongParameterId(const QString &what, const QDomElement &domElement); - VExceptionWrongParameterId(const VExceptionWrongParameterId &e); - virtual ~VExceptionWrongParameterId() noexcept(true){} + VExceptionWrongParameterId(const QString &what, const QDomElement &domElement); + VExceptionWrongParameterId(const VExceptionWrongParameterId &e):VException(e),tagText(e.TagText()), + tagName(e.TagName()), lineNumber(e.LineNumber()){} + virtual ~VExceptionWrongParameterId() noexcept(true){} virtual QString ErrorMessage() const; virtual QString DetailedInformation() const; - QString TagText() const {return tagText;} - QString TagName() const {return tagName;} - qint32 LineNumber() const {return lineNumber;} + inline QString TagText() const {return tagText;} + inline QString TagName() const {return tagName;} + inline qint32 LineNumber() const {return lineNumber;} protected: - QString tagText; - QString tagName; - qint32 lineNumber; + QString tagText; + QString tagName; + qint32 lineNumber; }; #endif // VEXCEPTIONWRONGPARAMETERID_H