diff --git a/src/plugins/axivion/axivionoutputpane.cpp b/src/plugins/axivion/axivionoutputpane.cpp index 4e8326da0b5..8d33abba7b2 100644 --- a/src/plugins/axivion/axivionoutputpane.cpp +++ b/src/plugins/axivion/axivionoutputpane.cpp @@ -150,9 +150,9 @@ void DashboardWidget::updateUi() // not use the issue counts, thus the QtCreator Axivion Plugin // is going to stop using them, too. if (last.issueCounts.isMap()) { - for (const auto &issueCount : last.issueCounts.getMap()) { + for (const Dto::Any::MapEntry &issueCount : last.issueCounts.getMap()) { if (issueCount.second.isMap()) { - const auto &counts = issueCount.second.getMap(); + const Dto::Any::Map &counts = issueCount.second.getMap(); qint64 total = extract_value(counts, QStringLiteral(u"Total")); allTotal += total; qint64 added = extract_value(counts, QStringLiteral(u"Added")); diff --git a/src/plugins/axivion/dashboard/concat.cpp b/src/plugins/axivion/dashboard/concat.cpp index 837cf4a311a..1da7f2b081f 100644 --- a/src/plugins/axivion/dashboard/concat.cpp +++ b/src/plugins/axivion/dashboard/concat.cpp @@ -17,7 +17,8 @@ #include template -static Output concat(const std::initializer_list &args) { +static Output concat(const std::initializer_list &args) +{ size_t size = 0; for (const Input &arg : args) size += arg.size(); @@ -28,14 +29,17 @@ static Output concat(const std::initializer_list &args) { return output; } -std::string concat(const std::initializer_list &args) { +std::string concat(const std::initializer_list &args) +{ return concat(args); } -QString concat(const std::initializer_list &args) { +QString concat(const std::initializer_list &args) +{ return concat(args); } -QByteArray concat_bytes(const std::initializer_list &args) { +QByteArray concat_bytes(const std::initializer_list &args) +{ return concat(args); } diff --git a/src/plugins/axivion/dashboard/dto.cpp b/src/plugins/axivion/dashboard/dto.cpp index 5c0747ea9e5..607c227816c 100644 --- a/src/plugins/axivion/dashboard/dto.cpp +++ b/src/plugins/axivion/dashboard/dto.cpp @@ -597,11 +597,11 @@ namespace Axivion::Internal::Dto { } if (json.isObject()) { - return Any(deserialize_json>(json)); + return Any(deserialize_json(json)); } if (json.isArray()) { - return Any(deserialize_json>(json)); + return Any(deserialize_json(json)); } if (json.isBool()) { @@ -657,9 +657,9 @@ namespace Axivion::Internal::Dto { Any::Any(double value) : data(std::move(value)) {} - Any::Any(std::map value) : data(std::move(value)) {} + Any::Any(Map value) : data(std::move(value)) {} - Any::Any(std::vector value) : data(std::move(value)) {} + Any::Any(Vector value) : data(std::move(value)) {} Any::Any(bool value) : data(std::move(value)) {} @@ -702,12 +702,12 @@ namespace Axivion::Internal::Dto { return this->data.index() == 3; } - std::map &Any::getMap() + Any::Map &Any::getMap() { return std::get<3>(this->data); } - const std::map &Any::getMap() const + const Any::Map &Any::getMap() const { return std::get<3>(this->data); } @@ -717,12 +717,12 @@ namespace Axivion::Internal::Dto { return this->data.index() == 4; } - std::vector &Any::getList() + Any::Vector &Any::getList() { return std::get<4>(this->data); } - const std::vector &Any::getList() const + const Any::Vector &Any::getList() const { return std::get<4>(this->data); } diff --git a/src/plugins/axivion/dashboard/dto.h b/src/plugins/axivion/dashboard/dto.h index fe36257afb2..bdede500c39 100644 --- a/src/plugins/axivion/dashboard/dto.h +++ b/src/plugins/axivion/dashboard/dto.h @@ -62,18 +62,13 @@ namespace Axivion::Internal::Dto virtual ~Serializable() = default; }; - class Any : public Serializable { - private: - std::variant< - std::nullptr_t, // .index() == 0 - QString, // .index() == 1 - double, // .index() == 2 - std::map, // .index() == 3 - std::vector, // .index() == 4 - bool // .index() == 5 - > data; - + class Any : public Serializable + { public: + using Map = std::map; + using MapEntry = std::pair; + using Vector = std::vector; + // Throws Axivion::Internal::Dto::invalid_dto_exception static Any deserialize(const QByteArray &json); @@ -83,9 +78,9 @@ namespace Axivion::Internal::Dto Any(double value); - Any(std::map value); + Any(Map value); - Any(std::vector value); + Any(Vector value); Any(bool value); @@ -110,18 +105,18 @@ namespace Axivion::Internal::Dto bool isMap() const; // Throws std::bad_variant_access - std::map &getMap(); + Map &getMap(); // Throws std::bad_variant_access - const std::map &getMap() const; + const Map &getMap() const; bool isList() const; // Throws std::bad_variant_access - std::vector &getList(); + Vector &getList(); // Throws std::bad_variant_access - const std::vector &getList() const; + const Vector &getList() const; bool isBool() const; @@ -132,9 +127,20 @@ namespace Axivion::Internal::Dto const bool &getBool() const; virtual QByteArray serialize() const override; + + private: + std::variant< + std::nullptr_t, // .index() == 0 + QString, // .index() == 1 + double, // .index() == 2 + Map, // .index() == 3 + Vector, // .index() == 4 + bool // .index() == 5 + > data; }; - class ApiVersion { + class ApiVersion + { public: static const std::array number; static const QLatin1String string;