Improve conversion error message.

Instead of showing path to temp file show path to original file.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2020-01-24 09:24:03 +02:00
parent acfd1ac01d
commit 0b82f4a18c
8 changed files with 205 additions and 200 deletions

View File

@ -28,6 +28,7 @@
#include "vabstractconverter.h" #include "vabstractconverter.h"
#include <QAbstractMessageHandler>
#include <QDir> #include <QDir>
#include <QDomElement> #include <QDomElement>
#include <QDomNode> #include <QDomNode>
@ -38,19 +39,81 @@
#include <QMap> #include <QMap>
#include <QRegularExpression> #include <QRegularExpression>
#include <QRegularExpressionMatch> #include <QRegularExpressionMatch>
#include <QSourceLocation>
#include <QStaticStringData> #include <QStaticStringData>
#include <QStringData> #include <QStringData>
#include <QStringDataPtr> #include <QStringDataPtr>
#include <QStringList> #include <QStringList>
#include <QTextDocument>
#include <QXmlSchema>
#include <QXmlSchemaValidator>
#include "../exception/vexception.h" #include "../exception/vexception.h"
#include "../exception/vexceptionwrongid.h" #include "../exception/vexceptionwrongid.h"
#include "vdomdocument.h" #include "vdomdocument.h"
//This class need for validation pattern file using XSD shema
class MessageHandler : public QAbstractMessageHandler
{
public:
MessageHandler()
: QAbstractMessageHandler(),
m_messageType(QtMsgType()),
m_description(),
m_sourceLocation(QSourceLocation())
{}
QString statusMessage() const;
qint64 line() const;
qint64 column() const;
protected:
// cppcheck-suppress unusedFunction
virtual void handleMessage(QtMsgType type, const QString &description,
const QUrl &identifier, const QSourceLocation &sourceLocation) override;
private:
QtMsgType m_messageType;
QString m_description;
QSourceLocation m_sourceLocation;
};
//---------------------------------------------------------------------------------------------------------------------
QString MessageHandler::statusMessage() const
{
QTextDocument doc;
doc.setHtml(m_description);
return doc.toPlainText();
}
//---------------------------------------------------------------------------------------------------------------------
inline qint64 MessageHandler::line() const
{
return m_sourceLocation.line();
}
//---------------------------------------------------------------------------------------------------------------------
inline qint64 MessageHandler::column() const
{
return m_sourceLocation.column();
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
void MessageHandler::handleMessage(QtMsgType type, const QString &description, const QUrl &identifier,
const QSourceLocation &sourceLocation)
{
Q_UNUSED(type)
Q_UNUSED(identifier)
m_messageType = type;
m_description = description;
m_sourceLocation = sourceLocation;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractConverter::VAbstractConverter(const QString &fileName) VAbstractConverter::VAbstractConverter(const QString &fileName)
: VDomDocument(), : VDomDocument(),
m_ver(0x0), m_ver(0x0),
m_originalFileName(fileName),
m_convertedFileName(fileName), m_convertedFileName(fileName),
m_tmpFile() m_tmpFile()
{ {
@ -157,6 +220,71 @@ void VAbstractConverter::BiasTokens(int position, int bias, QMap<int, QString> &
tokens = newTokens; tokens = newTokens;
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ValidateXML validate xml file by xsd schema.
* @param schema path to schema file.
*/
void VAbstractConverter::ValidateXML(const QString &schema) const
{
qCDebug(vXML, "Validation xml file %s.", qUtf8Printable(m_convertedFileName));
QFile pattern(m_convertedFileName);
// cppcheck-suppress ConfigurationNotChecked
if (pattern.open(QIODevice::ReadOnly) == false)
{
const QString errorMsg(tr("Can't open file %1:\n%2.").arg(m_convertedFileName, pattern.errorString()));
throw VException(errorMsg);
}
QFile fileSchema(schema);
// cppcheck-suppress ConfigurationNotChecked
if (fileSchema.open(QIODevice::ReadOnly) == false)
{
pattern.close();
const QString errorMsg(tr("Can't open schema file %1:\n%2.").arg(schema, fileSchema.errorString()));
throw VException(errorMsg);
}
MessageHandler messageHandler;
QXmlSchema sch;
sch.setMessageHandler(&messageHandler);
if (sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName()))==false)
{
pattern.close();
fileSchema.close();
VException e(messageHandler.statusMessage());
e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName()));
throw e;
}
qCDebug(vXML, "Schema loaded.");
bool errorOccurred = false;
if (sch.isValid() == false)
{
errorOccurred = true;
}
else
{
QXmlSchemaValidator validator(sch);
if (validator.validate(&pattern, QUrl::fromLocalFile(pattern.fileName())) == false)
{
errorOccurred = true;
}
}
if (errorOccurred)
{
pattern.close();
fileSchema.close();
VException e(messageHandler.statusMessage());
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2").arg(messageHandler.line())
.arg(messageHandler.column()).arg(m_originalFileName));
throw e;
}
pattern.close();
fileSchema.close();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
Q_NORETURN void VAbstractConverter::InvalidVersion(int ver) const Q_NORETURN void VAbstractConverter::InvalidVersion(int ver) const
{ {
@ -194,7 +322,7 @@ void VAbstractConverter::ValidateInputFile(const QString &currentSchema) const
{ // Version bigger than maximum supported version. We still have a chance to open the file. { // Version bigger than maximum supported version. We still have a chance to open the file.
try try
{ // Try to open like the current version. { // Try to open like the current version.
ValidateXML(currentSchema, m_convertedFileName); ValidateXML(currentSchema);
} }
catch(const VException &exp) catch(const VException &exp)
{ // Nope, we can't. { // Nope, we can't.
@ -210,7 +338,7 @@ void VAbstractConverter::ValidateInputFile(const QString &currentSchema) const
return; // All is fine and we can try to convert to current max version. return; // All is fine and we can try to convert to current max version.
} }
ValidateXML(schema, m_convertedFileName); ValidateXML(schema);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -52,6 +52,7 @@ public:
protected: protected:
int m_ver; int m_ver;
QString m_originalFileName;
QString m_convertedFileName; QString m_convertedFileName;
void ValidateInputFile(const QString &currentSchema) const; void ValidateInputFile(const QString &currentSchema) const;
@ -75,6 +76,8 @@ protected:
void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens) const; void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens) const;
static void BiasTokens(int position, int bias, QMap<int, QString> &tokens); static void BiasTokens(int position, int bias, QMap<int, QString> &tokens);
void ValidateXML(const QString &schema) const;
private: private:
Q_DISABLE_COPY(VAbstractConverter) Q_DISABLE_COPY(VAbstractConverter)

View File

@ -54,8 +54,6 @@
#include <QTextStream> #include <QTextStream>
#include <QUrl> #include <QUrl>
#include <QVector> #include <QVector>
#include <QXmlSchema>
#include <QXmlSchemaValidator>
#include <QtDebug> #include <QtDebug>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
#include <QTimer> #include <QTimer>
@ -236,63 +234,6 @@ bool LessThen(const QDomNode &element1, const QDomNode &element2)
} }
} }
//This class need for validation pattern file using XSD shema
class MessageHandler : public QAbstractMessageHandler
{
public:
MessageHandler()
: QAbstractMessageHandler(),
m_messageType(QtMsgType()),
m_description(),
m_sourceLocation(QSourceLocation())
{}
QString statusMessage() const;
qint64 line() const;
qint64 column() const;
protected:
// cppcheck-suppress unusedFunction
virtual void handleMessage(QtMsgType type, const QString &description,
const QUrl &identifier, const QSourceLocation &sourceLocation) override;
private:
QtMsgType m_messageType;
QString m_description;
QSourceLocation m_sourceLocation;
};
//---------------------------------------------------------------------------------------------------------------------
QString MessageHandler::statusMessage() const
{
QTextDocument doc;
doc.setHtml(m_description);
return doc.toPlainText();
}
//---------------------------------------------------------------------------------------------------------------------
inline qint64 MessageHandler::line() const
{
return m_sourceLocation.line();
}
//---------------------------------------------------------------------------------------------------------------------
inline qint64 MessageHandler::column() const
{
return m_sourceLocation.column();
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
void MessageHandler::handleMessage(QtMsgType type, const QString &description, const QUrl &identifier,
const QSourceLocation &sourceLocation)
{
Q_UNUSED(type)
Q_UNUSED(identifier)
m_messageType = type;
m_description = description;
m_sourceLocation = sourceLocation;
}
Q_LOGGING_CATEGORY(vXML, "v.xml") Q_LOGGING_CATEGORY(vXML, "v.xml")
const QString VDomDocument::AttrId = QStringLiteral("id"); const QString VDomDocument::AttrId = QStringLiteral("id");
@ -785,72 +726,6 @@ void VDomDocument::CacheRefreshed()
m_elementIdCache = m_watcher->future().result(); m_elementIdCache = m_watcher->future().result();
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ValidateXML validate xml file by xsd schema.
* @param schema path to schema file.
* @param fileName name of xml file.
*/
void VDomDocument::ValidateXML(const QString &schema, const QString &fileName)
{
qCDebug(vXML, "Validation xml file %s.", qUtf8Printable(fileName));
QFile pattern(fileName);
// cppcheck-suppress ConfigurationNotChecked
if (pattern.open(QIODevice::ReadOnly) == false)
{
const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName, pattern.errorString()));
throw VException(errorMsg);
}
QFile fileSchema(schema);
// cppcheck-suppress ConfigurationNotChecked
if (fileSchema.open(QIODevice::ReadOnly) == false)
{
pattern.close();
const QString errorMsg(tr("Can't open schema file %1:\n%2.").arg(schema, fileSchema.errorString()));
throw VException(errorMsg);
}
MessageHandler messageHandler;
QXmlSchema sch;
sch.setMessageHandler(&messageHandler);
if (sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName()))==false)
{
pattern.close();
fileSchema.close();
VException e(messageHandler.statusMessage());
e.AddMoreInformation(tr("Could not load schema file '%1'.").arg(fileSchema.fileName()));
throw e;
}
qCDebug(vXML, "Schema loaded.");
bool errorOccurred = false;
if (sch.isValid() == false)
{
errorOccurred = true;
}
else
{
QXmlSchemaValidator validator(sch);
if (validator.validate(&pattern, QUrl::fromLocalFile(pattern.fileName())) == false)
{
errorOccurred = true;
}
}
if (errorOccurred)
{
pattern.close();
fileSchema.close();
VException e(messageHandler.statusMessage());
e.AddMoreInformation(tr("Validation error file %3 in line %1 column %2").arg(messageHandler.line())
.arg(messageHandler.column()).arg(fileName));
throw e;
}
pattern.close();
fileSchema.close();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VDomDocument::setXMLContent(const QString &fileName) void VDomDocument::setXMLContent(const QString &fileName)
{ {

View File

@ -120,7 +120,6 @@ public:
Unit MUnit() const; Unit MUnit() const;
static void ValidateXML(const QString &schema, const QString &fileName);
virtual void setXMLContent(const QString &fileName); virtual void setXMLContent(const QString &fileName);
static QString UnitsHelpString(); static QString UnitsHelpString();

View File

@ -254,231 +254,231 @@ void VPatternConverter::ApplyPatches()
{ {
case (FORMAT_VERSION(0, 1, 4)): case (FORMAT_VERSION(0, 1, 4)):
ToV0_2_0(); ToV0_2_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 2, 0)): case (FORMAT_VERSION(0, 2, 0)):
ToV0_2_1(); ToV0_2_1();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 1)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 1)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 2, 1)): case (FORMAT_VERSION(0, 2, 1)):
ToV0_2_2(); ToV0_2_2();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 2)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 2)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 2, 2)): case (FORMAT_VERSION(0, 2, 2)):
ToV0_2_3(); ToV0_2_3();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 3)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 3)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 2, 3)): case (FORMAT_VERSION(0, 2, 3)):
ToV0_2_4(); ToV0_2_4();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 4)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 4)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 2, 4)): case (FORMAT_VERSION(0, 2, 4)):
ToV0_2_5(); ToV0_2_5();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 5)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 5)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 2, 5)): case (FORMAT_VERSION(0, 2, 5)):
ToV0_2_6(); ToV0_2_6();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 6)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 6)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 2, 6)): case (FORMAT_VERSION(0, 2, 6)):
ToV0_2_7(); ToV0_2_7();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 7)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 2, 7)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 2, 7)): case (FORMAT_VERSION(0, 2, 7)):
ToV0_3_0(); ToV0_3_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 0)): case (FORMAT_VERSION(0, 3, 0)):
ToV0_3_1(); ToV0_3_1();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 1)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 1)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 1)): case (FORMAT_VERSION(0, 3, 1)):
ToV0_3_2(); ToV0_3_2();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 2)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 2)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 2)): case (FORMAT_VERSION(0, 3, 2)):
ToV0_3_3(); ToV0_3_3();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 3)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 3)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 3)): case (FORMAT_VERSION(0, 3, 3)):
ToV0_3_4(); ToV0_3_4();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 4)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 4)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 4)): case (FORMAT_VERSION(0, 3, 4)):
ToV0_3_5(); ToV0_3_5();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 5)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 5)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 5)): case (FORMAT_VERSION(0, 3, 5)):
ToV0_3_6(); ToV0_3_6();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 6)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 6)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 6)): case (FORMAT_VERSION(0, 3, 6)):
ToV0_3_7(); ToV0_3_7();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 7)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 7)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 7)): case (FORMAT_VERSION(0, 3, 7)):
ToV0_3_8(); ToV0_3_8();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 8)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 8)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 8)): case (FORMAT_VERSION(0, 3, 8)):
ToV0_3_9(); ToV0_3_9();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 9)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 9)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 9)): case (FORMAT_VERSION(0, 3, 9)):
ToV0_4_0(); ToV0_4_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 0)): case (FORMAT_VERSION(0, 4, 0)):
ToV0_4_1(); ToV0_4_1();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 1)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 1)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 1)): case (FORMAT_VERSION(0, 4, 1)):
ToV0_4_2(); ToV0_4_2();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 2)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 2)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 2)): case (FORMAT_VERSION(0, 4, 2)):
ToV0_4_3(); ToV0_4_3();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 3)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 3)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 3)): case (FORMAT_VERSION(0, 4, 3)):
ToV0_4_4(); ToV0_4_4();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 4)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 4)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 4)): case (FORMAT_VERSION(0, 4, 4)):
ToV0_4_5(); ToV0_4_5();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 5)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 5)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 5)): case (FORMAT_VERSION(0, 4, 5)):
ToV0_4_6(); ToV0_4_6();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 6)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 6)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 6)): case (FORMAT_VERSION(0, 4, 6)):
ToV0_4_7(); ToV0_4_7();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 7)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 7)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 7)): case (FORMAT_VERSION(0, 4, 7)):
ToV0_4_8(); ToV0_4_8();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 8)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 8)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 8)): case (FORMAT_VERSION(0, 4, 8)):
ToV0_5_0(); ToV0_5_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 5, 0)): case (FORMAT_VERSION(0, 5, 0)):
ToV0_5_1(); ToV0_5_1();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 1)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 1)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 5, 1)): case (FORMAT_VERSION(0, 5, 1)):
ToV0_6_0(); ToV0_6_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 6, 0)): case (FORMAT_VERSION(0, 6, 0)):
ToV0_6_1(); ToV0_6_1();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 1)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 1)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 6, 1)): case (FORMAT_VERSION(0, 6, 1)):
ToV0_6_2(); ToV0_6_2();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 2)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 2)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 6, 2)): case (FORMAT_VERSION(0, 6, 2)):
ToV0_6_3(); ToV0_6_3();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 3)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 3)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 6, 3)): case (FORMAT_VERSION(0, 6, 3)):
ToV0_6_4(); ToV0_6_4();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 4)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 4)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 6, 4)): case (FORMAT_VERSION(0, 6, 4)):
ToV0_6_5(); ToV0_6_5();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 5)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 5)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 6, 5)): case (FORMAT_VERSION(0, 6, 5)):
ToV0_6_6(); ToV0_6_6();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 6)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 6, 6)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 6, 6)): case (FORMAT_VERSION(0, 6, 6)):
ToV0_7_0(); ToV0_7_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 0)): case (FORMAT_VERSION(0, 7, 0)):
ToV0_7_1(); ToV0_7_1();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 1)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 1)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 1)): case (FORMAT_VERSION(0, 7, 1)):
ToV0_7_2(); ToV0_7_2();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 2)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 2)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 2)): case (FORMAT_VERSION(0, 7, 2)):
ToV0_7_3(); ToV0_7_3();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 3)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 3)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 3)): case (FORMAT_VERSION(0, 7, 3)):
ToV0_7_4(); ToV0_7_4();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 4)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 4)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 4)): case (FORMAT_VERSION(0, 7, 4)):
ToV0_7_5(); ToV0_7_5();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 5)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 5)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 5)): case (FORMAT_VERSION(0, 7, 5)):
ToV0_7_6(); ToV0_7_6();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 6)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 6)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 6)): case (FORMAT_VERSION(0, 7, 6)):
ToV0_7_7(); ToV0_7_7();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 7)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 7)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 7)): case (FORMAT_VERSION(0, 7, 7)):
ToV0_7_8(); ToV0_7_8();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 8)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 8)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 8)): case (FORMAT_VERSION(0, 7, 8)):
ToV0_7_9(); ToV0_7_9();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 9)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 9)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 9)): case (FORMAT_VERSION(0, 7, 9)):
ToV0_7_10(); ToV0_7_10();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 10)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 10)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 10)): case (FORMAT_VERSION(0, 7, 10)):
ToV0_7_11(); ToV0_7_11();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 11)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 11)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 11)): case (FORMAT_VERSION(0, 7, 11)):
ToV0_7_12(); ToV0_7_12();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 12)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 12)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 12)): case (FORMAT_VERSION(0, 7, 12)):
ToV0_7_13(); ToV0_7_13();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 13)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 7, 13)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 7, 13)): case (FORMAT_VERSION(0, 7, 13)):
ToV0_8_0(); ToV0_8_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 0)): case (FORMAT_VERSION(0, 8, 0)):
ToV0_8_1(); ToV0_8_1();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 1)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 1)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 1)): case (FORMAT_VERSION(0, 8, 1)):
ToV0_8_2(); ToV0_8_2();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 2)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 2)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 2)): case (FORMAT_VERSION(0, 8, 2)):
ToV0_8_3(); ToV0_8_3();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 3)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 3)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 3)): case (FORMAT_VERSION(0, 8, 3)):
ToV0_8_4(); ToV0_8_4();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 4)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 4)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 4)): case (FORMAT_VERSION(0, 8, 4)):
ToV0_8_5(); ToV0_8_5();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 5)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 5)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 5)): case (FORMAT_VERSION(0, 8, 5)):
ToV0_8_6(); ToV0_8_6();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 6)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 6)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 8, 6)): case (FORMAT_VERSION(0, 8, 6)):
break; break;

View File

@ -109,27 +109,27 @@ void VVITConverter::ApplyPatches()
{ {
case (FORMAT_VERSION(0, 2, 0)): case (FORMAT_VERSION(0, 2, 0)):
ToV0_3_0(); ToV0_3_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 0)): case (FORMAT_VERSION(0, 3, 0)):
ToV0_3_1(); ToV0_3_1();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 1)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 1)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 1)): case (FORMAT_VERSION(0, 3, 1)):
ToV0_3_2(); ToV0_3_2();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 2)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 2)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 2)): case (FORMAT_VERSION(0, 3, 2)):
ToV0_3_3(); ToV0_3_3();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 3)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 3, 3)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 3, 3)): case (FORMAT_VERSION(0, 3, 3)):
ToV0_4_0(); ToV0_4_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 4, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 4, 0)): case (FORMAT_VERSION(0, 4, 0)):
ToV0_5_0(); ToV0_5_0();
ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 0)), m_convertedFileName); ValidateXML(XSDSchema(FORMAT_VERSION(0, 5, 0)));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (FORMAT_VERSION(0, 5, 0)): case (FORMAT_VERSION(0, 5, 0)):
break; break;

View File

@ -103,23 +103,23 @@ void VVSTConverter::ApplyPatches()
{ {
case (0x000300): case (0x000300):
ToV0_4_0(); ToV0_4_0();
ValidateXML(XSDSchema(0x000400), m_convertedFileName); ValidateXML(XSDSchema(0x000400));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (0x000400): case (0x000400):
ToV0_4_1(); ToV0_4_1();
ValidateXML(XSDSchema(0x000401), m_convertedFileName); ValidateXML(XSDSchema(0x000401));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (0x000401): case (0x000401):
ToV0_4_2(); ToV0_4_2();
ValidateXML(XSDSchema(0x000402), m_convertedFileName); ValidateXML(XSDSchema(0x000402));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (0x000402): case (0x000402):
ToV0_4_3(); ToV0_4_3();
ValidateXML(XSDSchema(0x000403), m_convertedFileName); ValidateXML(XSDSchema(0x000403));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (0x000403): case (0x000403):
ToV0_4_4(); ToV0_4_4();
ValidateXML(XSDSchema(0x000404), m_convertedFileName); ValidateXML(XSDSchema(0x000404));
Q_FALLTHROUGH(); Q_FALLTHROUGH();
case (0x000404): case (0x000404):
break; break;

View File

@ -81,7 +81,7 @@ void TST_VMeasurements::CreateEmptyMultisizeFile()
try try
{ {
VDomDocument::ValidateXML(VVSTConverter::CurrentSchema, fileName); VVSTConverter converter(fileName);
} }
catch (VException &e) catch (VException &e)
{ {
@ -122,7 +122,7 @@ void TST_VMeasurements::CreateEmptyIndividualFile()
try try
{ {
VDomDocument::ValidateXML(VVITConverter::CurrentSchema, fileName); VVITConverter converter(fileName);
} }
catch (VException &e) catch (VException &e)
{ {
@ -176,7 +176,7 @@ void TST_VMeasurements::ValidPMCodesMultisizeFile()
try try
{ {
VDomDocument::ValidateXML(VVSTConverter::CurrentSchema, fileName); VVSTConverter converter(fileName);
} }
catch (VException &e) catch (VException &e)
{ {
@ -228,7 +228,7 @@ void TST_VMeasurements::ValidPMCodesIndividualFile()
try try
{ {
VDomDocument::ValidateXML(VVITConverter::CurrentSchema, fileName); VVITConverter converter(fileName);
} }
catch (VException &e) catch (VException &e)
{ {