Refactoring.
--HG-- branch : develop
This commit is contained in:
parent
b42bc9560a
commit
2a88e74086
|
@ -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;
|
||||
|
|
|
@ -24,19 +24,17 @@
|
|||
#define VEXCEPTION_H
|
||||
|
||||
#include <QException>
|
||||
#include <QString>
|
||||
|
||||
class VException : public QException
|
||||
{
|
||||
class VException : public QException{
|
||||
public:
|
||||
VException(const QString &what);
|
||||
VException(const VException &e);
|
||||
VException(const VException &e):what(e.What()){}
|
||||
virtual ~VException() noexcept(true){}
|
||||
void raise() const { throw *this; }
|
||||
VException *clone() const { return new VException(*this); }
|
||||
inline void raise() const { throw *this; }
|
||||
inline VException *clone() const { return new VException(*this); }
|
||||
virtual QString ErrorMessage() const;
|
||||
virtual QString DetailedInformation() const { return QString(); }
|
||||
QString What() const {return what;}
|
||||
inline QString What() const {return what;}
|
||||
protected:
|
||||
QString what;
|
||||
};
|
||||
|
|
|
@ -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()){
|
||||
|
|
|
@ -24,16 +24,16 @@
|
|||
|
||||
#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);
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -24,14 +24,13 @@
|
|||
|
||||
#include "vexception.h"
|
||||
|
||||
class VExceptionConversionError : public VException
|
||||
{
|
||||
class VExceptionConversionError : public VException{
|
||||
public:
|
||||
VExceptionConversionError(const QString &what, const QString &str);
|
||||
VExceptionConversionError(const VExceptionConversionError &e);
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "vexceptionemptyparameter.h"
|
||||
#include <QDebug>
|
||||
|
||||
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;
|
||||
|
|
|
@ -23,20 +23,20 @@
|
|||
#define VEXCEPTIONEMPTYPARAMETER_H
|
||||
|
||||
#include "vexception.h"
|
||||
#include <QDomElement>
|
||||
|
||||
class VExceptionEmptyParameter : public VException
|
||||
{
|
||||
class VExceptionEmptyParameter : public VException{
|
||||
public:
|
||||
VExceptionEmptyParameter(const QString &what, const QString &name, const QDomElement &domElement);
|
||||
VExceptionEmptyParameter(const VExceptionEmptyParameter &e);
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -23,21 +23,20 @@
|
|||
#define VEXCEPTIONOBJECTERROR_H
|
||||
|
||||
#include "vexception.h"
|
||||
#include <QDomElement>
|
||||
|
||||
class VExceptionObjectError : public VException
|
||||
{
|
||||
class VExceptionObjectError : public VException{
|
||||
public:
|
||||
VExceptionObjectError(const QString &what, const QDomElement &domElement);
|
||||
VExceptionObjectError(const VExceptionObjectError &e);
|
||||
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;}
|
||||
inline QString TagText() const {return tagText;}
|
||||
inline QString TagName() const {return tagName;}
|
||||
inline qint32 LineNumber() const {return lineNumber;}
|
||||
void AddMoreInformation(const QString &info);
|
||||
QString MoreInformation() const {return moreInfo;}
|
||||
inline QString MoreInformation() const {return moreInfo;}
|
||||
protected:
|
||||
QString tagText;
|
||||
QString tagName;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "vexceptionuniqueid.h"
|
||||
#include <QTextStream>
|
||||
|
||||
VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &domElement)
|
||||
:VException(what), tagText(QString()), tagName(QString()), lineNumber(-1){
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define VEXCEPTIONUNIQUEID_H
|
||||
|
||||
#include "vexception.h"
|
||||
#include <QDomElement>
|
||||
|
||||
class VExceptionUniqueId : public VException{
|
||||
public:
|
||||
|
@ -12,9 +11,9 @@ public:
|
|||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -23,19 +23,18 @@
|
|||
#define VEXCEPTIONWRONGPARAMETERID_H
|
||||
|
||||
#include "vexception.h"
|
||||
#include <QDomElement>
|
||||
|
||||
class VExceptionWrongParameterId : public VException
|
||||
{
|
||||
class VExceptionWrongParameterId : public VException{
|
||||
public:
|
||||
VExceptionWrongParameterId(const QString &what, const QDomElement &domElement);
|
||||
VExceptionWrongParameterId(const VExceptionWrongParameterId &e);
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user