Fix build with MSVC.

This commit is contained in:
Roman Telezhynskyi 2021-09-14 19:47:41 +03:00
parent 87d62684db
commit 4c946d7da5
18 changed files with 65 additions and 71 deletions

View File

@ -281,7 +281,7 @@ void VAbstractConverter::ValidateXML(const QString &schema) const
}
//---------------------------------------------------------------------------------------------------------------------
Q_NORETURN void VAbstractConverter::InvalidVersion(int ver) const
Q_NORETURN void VAbstractConverter::InvalidVersion(unsigned ver) const
{
if (ver < MinVer())
{

View File

@ -54,22 +54,22 @@ public:
int GetCurrentFormatVersion() const;
protected:
int m_ver;
unsigned m_ver;
QString m_originalFileName;
QString m_convertedFileName;
void ValidateInputFile(const QString &currentSchema) const;
Q_NORETURN void InvalidVersion(int ver) const;
Q_NORETURN void InvalidVersion(unsigned ver) const;
void Save();
void SetVersion(const QString &version);
virtual int MinVer() const =0;
virtual int MaxVer() const =0;
virtual unsigned MinVer() const =0;
virtual unsigned MaxVer() const =0;
virtual QString MinVerStr() const =0;
virtual QString MaxVerStr() const =0;
virtual QString XSDSchema(int ver) const =0;
virtual QString XSDSchema(unsigned ver) const =0;
virtual void ApplyPatches() =0;
virtual void DowngradeToCurrentMaxVersion() =0;

View File

@ -860,7 +860,7 @@ QString VDomDocument::GetFormatVersionStr() const
}
//---------------------------------------------------------------------------------------------------------------------
int VDomDocument::GetFormatVersion(const QString &version)
unsigned VDomDocument::GetFormatVersion(const QString &version)
{
ValidateVersion(version);
@ -887,7 +887,7 @@ int VDomDocument::GetFormatVersion(const QString &version)
return 0x0;
}
return (major<<16)|(minor<<8)|(patch);
return (major<<16u)|(minor<<8u)|(patch);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -129,7 +129,7 @@ public:
QString Minor() const;
QString Patch() const;
virtual QString GetFormatVersionStr() const;
static int GetFormatVersion(const QString &version);
static unsigned GetFormatVersion(const QString &version);
static void RemoveAllChildren(QDomElement &domElement);
QDomNode ParentNodeById(const quint32 &nodeId);

View File

@ -52,13 +52,13 @@ VLabelTemplateConverter::VLabelTemplateConverter(const QString &fileName)
}
//---------------------------------------------------------------------------------------------------------------------
int VLabelTemplateConverter::MinVer() const
unsigned VLabelTemplateConverter::MinVer() const
{
return LabelTemplateMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
int VLabelTemplateConverter::MaxVer() const
unsigned VLabelTemplateConverter::MaxVer() const
{
return LabelTemplateMaxVer;
}
@ -76,7 +76,7 @@ QString VLabelTemplateConverter::MaxVerStr() const
}
//---------------------------------------------------------------------------------------------------------------------
QString VLabelTemplateConverter::XSDSchema(int ver) const
QString VLabelTemplateConverter::XSDSchema(unsigned ver) const
{
switch (ver)
{

View File

@ -39,17 +39,17 @@ public:
static const QString LabelTemplateMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int LabelTemplateMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const int LabelTemplateMaxVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const unsigned LabelTemplateMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const unsigned LabelTemplateMaxVer = FormatVersion(1, 0, 0);
protected:
virtual int MinVer() const override;
virtual int MaxVer() const override;
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual QString XSDSchema(int ver) const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;

View File

@ -73,11 +73,11 @@ auto VLayoutConverter::GetFormatVersionStr() const -> QString
}
//---------------------------------------------------------------------------------------------------------------------
QString VLayoutConverter::XSDSchema(int ver) const
auto VLayoutConverter::XSDSchema(unsigned ver) const -> QString
{
QHash <int, QString> schemas =
QHash <unsigned, QString> schemas =
{
std::make_pair(FormatVersion(0, 1, 0), CurrentSchema)
std::make_pair(FormatVersion(0, 1, 0), CurrentSchema),
};
if (schemas.contains(ver))

View File

@ -44,17 +44,17 @@ public:
static const QString LayoutMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int LayoutMinVer = FormatVersion(0, 1, 0);
static Q_DECL_CONSTEXPR const int LayoutMaxVer = FormatVersion(0, 1, 0);
static Q_DECL_CONSTEXPR const unsigned LayoutMinVer = FormatVersion(0, 1, 0);
static Q_DECL_CONSTEXPR const unsigned LayoutMaxVer = FormatVersion(0, 1, 0);
protected:
virtual int MinVer() const override;
virtual int MaxVer() const override;
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual QString XSDSchema(int ver) const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
@ -66,13 +66,13 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
inline int VLayoutConverter::MinVer() const
inline unsigned VLayoutConverter::MinVer() const
{
return LayoutMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VLayoutConverter::MaxVer() const
inline unsigned VLayoutConverter::MaxVer() const
{
return LayoutMaxVer;
}

View File

@ -178,9 +178,9 @@ VPatternConverter::VPatternConverter(const QString &fileName)
}
//---------------------------------------------------------------------------------------------------------------------
QString VPatternConverter::XSDSchema(int ver) const
auto VPatternConverter::XSDSchema(unsigned ver) const -> QString
{
QHash <int, QString> schemas =
QHash <unsigned, QString> schemas =
{
std::make_pair(FormatVersion(0, 1, 4), QStringLiteral("://schema/pattern/v0.1.4.xsd")),
std::make_pair(FormatVersion(0, 2, 0), QStringLiteral("://schema/pattern/v0.2.0.xsd")),

View File

@ -52,17 +52,17 @@ public:
static const QString PatternMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int PatternMinVer = FormatVersion(0, 1, 4);
static Q_DECL_CONSTEXPR const int PatternMaxVer = FormatVersion(0, 8, 12);
static Q_DECL_CONSTEXPR const unsigned PatternMinVer = FormatVersion(0, 1, 4);
static Q_DECL_CONSTEXPR const unsigned PatternMaxVer = FormatVersion(0, 8, 12);
protected:
virtual int MinVer() const override;
virtual int MaxVer() const override;
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual QString XSDSchema(int ver) const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
@ -193,13 +193,13 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
inline int VPatternConverter::MinVer() const
inline unsigned VPatternConverter::MinVer() const
{
return PatternMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VPatternConverter::MaxVer() const
inline unsigned VPatternConverter::MaxVer() const
{
return PatternMaxVer;
}

View File

@ -79,9 +79,9 @@ VVITConverter::VVITConverter(const QString &fileName)
}
//---------------------------------------------------------------------------------------------------------------------
QString VVITConverter::XSDSchema(int ver) const
QString VVITConverter::XSDSchema(unsigned ver) const
{
QHash <int, QString> schemas =
QHash <unsigned, QString> schemas =
{
std::make_pair(FormatVersion(0, 2, 0), QStringLiteral("://schema/individual_measurements/v0.2.0.xsd")),
std::make_pair(FormatVersion(0, 3, 0), QStringLiteral("://schema/individual_measurements/v0.3.0.xsd")),

View File

@ -48,17 +48,17 @@ public:
static const QString MeasurementMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int MeasurementMinVer = FormatVersion(0, 2, 0);
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = FormatVersion(0, 5, 1);
static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 2, 0);
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 1);
protected:
virtual int MinVer() const override;
virtual int MaxVer() const override;
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual QString XSDSchema(int ver) const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override;
@ -86,13 +86,13 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
inline int VVITConverter::MinVer() const
inline unsigned VVITConverter::MinVer() const
{
return MeasurementMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VVITConverter::MaxVer() const
inline unsigned VVITConverter::MaxVer() const
{
return MeasurementMaxVer;
}

View File

@ -73,9 +73,9 @@ VVSTConverter::VVSTConverter(const QString &fileName)
}
//---------------------------------------------------------------------------------------------------------------------
QString VVSTConverter::XSDSchema(int ver) const
QString VVSTConverter::XSDSchema(unsigned ver) const
{
QHash <int, QString> schemas =
QHash <unsigned, QString> schemas =
{
std::make_pair(FormatVersion(0, 3, 0), QStringLiteral("://schema/multisize_measurements/v0.3.0.xsd")),
std::make_pair(FormatVersion(0, 4, 0), QStringLiteral("://schema/multisize_measurements/v0.4.0.xsd")),

View File

@ -48,23 +48,17 @@ public:
static const QString MeasurementMaxVerStr;
static const QString CurrentSchema;
// GCC 4.6 doesn't allow constexpr and const together
#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406
static Q_DECL_CONSTEXPR int MeasurementMinVer = FormatVersion(0, 3, 0);
static Q_DECL_CONSTEXPR int MeasurementMaxVer = FormatVersion(0, 5, 1);
#else
static Q_DECL_CONSTEXPR const int MeasurementMinVer = FormatVersion(0, 3, 0);
static Q_DECL_CONSTEXPR const int MeasurementMaxVer = FormatVersion(0, 5, 1);
#endif
static Q_DECL_CONSTEXPR const unsigned MeasurementMinVer = FormatVersion(0, 3, 0);
static Q_DECL_CONSTEXPR const unsigned MeasurementMaxVer = FormatVersion(0, 5, 1);
protected:
virtual int MinVer() const override;
virtual int MaxVer() const override;
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual QString XSDSchema(int ver) const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override;
@ -94,13 +88,13 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
inline int VVSTConverter::MinVer() const
inline unsigned VVSTConverter::MinVer() const
{
return MeasurementMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline int VVSTConverter::MaxVer() const
inline unsigned VVSTConverter::MaxVer() const
{
return MeasurementMaxVer;
}

View File

@ -53,13 +53,13 @@ VWatermarkConverter::VWatermarkConverter(const QString &fileName)
}
//---------------------------------------------------------------------------------------------------------------------
int VWatermarkConverter::MinVer() const
unsigned VWatermarkConverter::MinVer() const
{
return WatermarkMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
int VWatermarkConverter::MaxVer() const
unsigned VWatermarkConverter::MaxVer() const
{
return WatermarkMaxVer;
}
@ -77,9 +77,9 @@ QString VWatermarkConverter::MaxVerStr() const
}
//---------------------------------------------------------------------------------------------------------------------
QString VWatermarkConverter::XSDSchema(int ver) const
QString VWatermarkConverter::XSDSchema(unsigned ver) const
{
QHash <int, QString> schemas =
QHash <unsigned, QString> schemas =
{
std::make_pair(FormatVersion(1, 0, 0), QStringLiteral("://schema/watermark/v1.0.0.xsd")),
std::make_pair(FormatVersion(1, 1, 0), CurrentSchema)

View File

@ -38,17 +38,17 @@ public:
static const QString WatermarkMaxVerStr;
static const QString CurrentSchema;
static Q_DECL_CONSTEXPR const int WatermarkMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const int WatermarkMaxVer = FormatVersion(1, 1, 0);
static Q_DECL_CONSTEXPR const unsigned WatermarkMinVer = FormatVersion(1, 0, 0);
static Q_DECL_CONSTEXPR const unsigned WatermarkMaxVer = FormatVersion(1, 1, 0);
protected:
virtual int MinVer() const override;
virtual int MaxVer() const override;
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual QString XSDSchema(int ver) const override;
virtual QString XSDSchema(unsigned ver) const override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;

View File

@ -79,7 +79,7 @@ private:
QColor m_okPathColor;
bool m_isInitialized{false};
int m_curFileFormatVersion{0x0};
unsigned m_curFileFormatVersion{0x0};
QString m_curFileFormatVersionStr{QLatin1String("0.0.0")};
QSharedPointer<VLockGuard<char>> lock{};

View File

@ -55,7 +55,7 @@ protected slots:
void ExportDataToCSV();
protected:
int m_curFileFormatVersion;
unsigned m_curFileFormatVersion;
QString m_curFileFormatVersionStr;
enum { MaxRecentFiles = 5 };
QVector<QAction *> m_recentFileActs{QVector<QAction *>(MaxRecentFiles)};