From 4c946d7da54869050052817a80e01c760cd84c8d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 14 Sep 2021 19:47:41 +0300 Subject: [PATCH] Fix build with MSVC. --- src/libs/ifc/xml/vabstractconverter.cpp | 2 +- src/libs/ifc/xml/vabstractconverter.h | 10 +++++----- src/libs/ifc/xml/vdomdocument.cpp | 4 ++-- src/libs/ifc/xml/vdomdocument.h | 2 +- src/libs/ifc/xml/vlabeltemplateconverter.cpp | 6 +++--- src/libs/ifc/xml/vlabeltemplateconverter.h | 10 +++++----- src/libs/ifc/xml/vlayoutconverter.cpp | 6 +++--- src/libs/ifc/xml/vlayoutconverter.h | 14 +++++++------- src/libs/ifc/xml/vpatternconverter.cpp | 4 ++-- src/libs/ifc/xml/vpatternconverter.h | 14 +++++++------- src/libs/ifc/xml/vvitconverter.cpp | 4 ++-- src/libs/ifc/xml/vvitconverter.h | 14 +++++++------- src/libs/ifc/xml/vvstconverter.cpp | 4 ++-- src/libs/ifc/xml/vvstconverter.h | 20 +++++++------------- src/libs/ifc/xml/vwatermarkconverter.cpp | 8 ++++---- src/libs/ifc/xml/vwatermarkconverter.h | 10 +++++----- src/libs/vlayout/dialogs/watermarkwindow.h | 2 +- src/libs/vwidgets/vabstractmainwindow.h | 2 +- 18 files changed, 65 insertions(+), 71 deletions(-) diff --git a/src/libs/ifc/xml/vabstractconverter.cpp b/src/libs/ifc/xml/vabstractconverter.cpp index 990a98d14..5524015b5 100644 --- a/src/libs/ifc/xml/vabstractconverter.cpp +++ b/src/libs/ifc/xml/vabstractconverter.cpp @@ -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()) { diff --git a/src/libs/ifc/xml/vabstractconverter.h b/src/libs/ifc/xml/vabstractconverter.h index eefac4be4..bd6e25591 100644 --- a/src/libs/ifc/xml/vabstractconverter.h +++ b/src/libs/ifc/xml/vabstractconverter.h @@ -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 ¤tSchema) 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; diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index b4394eecd..57284a1bc 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -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); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/ifc/xml/vdomdocument.h b/src/libs/ifc/xml/vdomdocument.h index b0feda21f..1df9ea43d 100644 --- a/src/libs/ifc/xml/vdomdocument.h +++ b/src/libs/ifc/xml/vdomdocument.h @@ -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); diff --git a/src/libs/ifc/xml/vlabeltemplateconverter.cpp b/src/libs/ifc/xml/vlabeltemplateconverter.cpp index aa74ec4f4..990fa2442 100644 --- a/src/libs/ifc/xml/vlabeltemplateconverter.cpp +++ b/src/libs/ifc/xml/vlabeltemplateconverter.cpp @@ -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) { diff --git a/src/libs/ifc/xml/vlabeltemplateconverter.h b/src/libs/ifc/xml/vlabeltemplateconverter.h index d3f7ca5e8..6b2cb881d 100644 --- a/src/libs/ifc/xml/vlabeltemplateconverter.h +++ b/src/libs/ifc/xml/vlabeltemplateconverter.h @@ -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; diff --git a/src/libs/ifc/xml/vlayoutconverter.cpp b/src/libs/ifc/xml/vlayoutconverter.cpp index ed60eae5d..035085567 100644 --- a/src/libs/ifc/xml/vlayoutconverter.cpp +++ b/src/libs/ifc/xml/vlayoutconverter.cpp @@ -73,11 +73,11 @@ auto VLayoutConverter::GetFormatVersionStr() const -> QString } //--------------------------------------------------------------------------------------------------------------------- -QString VLayoutConverter::XSDSchema(int ver) const +auto VLayoutConverter::XSDSchema(unsigned ver) const -> QString { - QHash schemas = + QHash schemas = { - std::make_pair(FormatVersion(0, 1, 0), CurrentSchema) + std::make_pair(FormatVersion(0, 1, 0), CurrentSchema), }; if (schemas.contains(ver)) diff --git a/src/libs/ifc/xml/vlayoutconverter.h b/src/libs/ifc/xml/vlayoutconverter.h index eee9aadd1..1dff7432c 100644 --- a/src/libs/ifc/xml/vlayoutconverter.h +++ b/src/libs/ifc/xml/vlayoutconverter.h @@ -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; } diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 6c14beeb8..deaa80405 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -178,9 +178,9 @@ VPatternConverter::VPatternConverter(const QString &fileName) } //--------------------------------------------------------------------------------------------------------------------- -QString VPatternConverter::XSDSchema(int ver) const +auto VPatternConverter::XSDSchema(unsigned ver) const -> QString { - QHash schemas = + QHash 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")), diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index df8e93ac6..7d2c3b92a 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -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; } diff --git a/src/libs/ifc/xml/vvitconverter.cpp b/src/libs/ifc/xml/vvitconverter.cpp index a5b770c30..f1f7c4e2f 100644 --- a/src/libs/ifc/xml/vvitconverter.cpp +++ b/src/libs/ifc/xml/vvitconverter.cpp @@ -79,9 +79,9 @@ VVITConverter::VVITConverter(const QString &fileName) } //--------------------------------------------------------------------------------------------------------------------- -QString VVITConverter::XSDSchema(int ver) const +QString VVITConverter::XSDSchema(unsigned ver) const { - QHash schemas = + QHash 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")), diff --git a/src/libs/ifc/xml/vvitconverter.h b/src/libs/ifc/xml/vvitconverter.h index 80430488e..28627c30f 100644 --- a/src/libs/ifc/xml/vvitconverter.h +++ b/src/libs/ifc/xml/vvitconverter.h @@ -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; } diff --git a/src/libs/ifc/xml/vvstconverter.cpp b/src/libs/ifc/xml/vvstconverter.cpp index 42fa41bec..ff247acdd 100644 --- a/src/libs/ifc/xml/vvstconverter.cpp +++ b/src/libs/ifc/xml/vvstconverter.cpp @@ -73,9 +73,9 @@ VVSTConverter::VVSTConverter(const QString &fileName) } //--------------------------------------------------------------------------------------------------------------------- -QString VVSTConverter::XSDSchema(int ver) const +QString VVSTConverter::XSDSchema(unsigned ver) const { - QHash schemas = + QHash 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")), diff --git a/src/libs/ifc/xml/vvstconverter.h b/src/libs/ifc/xml/vvstconverter.h index 176a51121..1bab8bcb1 100644 --- a/src/libs/ifc/xml/vvstconverter.h +++ b/src/libs/ifc/xml/vvstconverter.h @@ -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; } diff --git a/src/libs/ifc/xml/vwatermarkconverter.cpp b/src/libs/ifc/xml/vwatermarkconverter.cpp index d5453637a..4b26fde3d 100644 --- a/src/libs/ifc/xml/vwatermarkconverter.cpp +++ b/src/libs/ifc/xml/vwatermarkconverter.cpp @@ -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 schemas = + QHash schemas = { std::make_pair(FormatVersion(1, 0, 0), QStringLiteral("://schema/watermark/v1.0.0.xsd")), std::make_pair(FormatVersion(1, 1, 0), CurrentSchema) diff --git a/src/libs/ifc/xml/vwatermarkconverter.h b/src/libs/ifc/xml/vwatermarkconverter.h index 0d4770c73..f5ccba165 100644 --- a/src/libs/ifc/xml/vwatermarkconverter.h +++ b/src/libs/ifc/xml/vwatermarkconverter.h @@ -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; diff --git a/src/libs/vlayout/dialogs/watermarkwindow.h b/src/libs/vlayout/dialogs/watermarkwindow.h index 940d42236..1d65a835b 100644 --- a/src/libs/vlayout/dialogs/watermarkwindow.h +++ b/src/libs/vlayout/dialogs/watermarkwindow.h @@ -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> lock{}; diff --git a/src/libs/vwidgets/vabstractmainwindow.h b/src/libs/vwidgets/vabstractmainwindow.h index 424231817..20421843a 100644 --- a/src/libs/vwidgets/vabstractmainwindow.h +++ b/src/libs/vwidgets/vabstractmainwindow.h @@ -55,7 +55,7 @@ protected slots: void ExportDataToCSV(); protected: - int m_curFileFormatVersion; + unsigned m_curFileFormatVersion; QString m_curFileFormatVersionStr; enum { MaxRecentFiles = 5 }; QVector m_recentFileActs{QVector(MaxRecentFiles)};