diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-07-21 11:31:06 +0200 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-07-21 11:31:06 +0200 |
commit | c94dc1104e1eb5e0537fcd9429626988524c8a98 (patch) | |
tree | 7737c6f74985b254f7320a170ef14cda447e9f11 /lib | |
parent | 8da4918aa10340ef52177977a8bcad489419f8e2 (diff) | |
download | libquotient-c94dc1104e1eb5e0537fcd9429626988524c8a98.tar.gz libquotient-c94dc1104e1eb5e0537fcd9429626988524c8a98.zip |
converters.*: clean away old cruft
Diffstat (limited to 'lib')
-rw-r--r-- | lib/converters.cpp | 20 | ||||
-rw-r--r-- | lib/converters.h | 28 |
2 files changed, 6 insertions, 42 deletions
diff --git a/lib/converters.cpp b/lib/converters.cpp index 9f4b9360..e5236bb9 100644 --- a/lib/converters.cpp +++ b/lib/converters.cpp @@ -32,24 +32,12 @@ QVariant JsonConverter<QVariant>::load(const QJsonValue& jv) return jv.toVariant(); } -QJsonObject JsonConverter<variant_map_t>::dump(const variant_map_t& map) +QJsonObject JsonConverter<QVariantHash>::dump(const QVariantHash& map) { - return -#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - QJsonObject::fromVariantHash -#else - QJsonObject::fromVariantMap -#endif - (map); + return QJsonObject::fromVariantHash(map); } -variant_map_t JsonConverter<QVariantHash>::load(const QJsonValue& jv) +QVariantHash JsonConverter<QVariantHash>::load(const QJsonValue& jv) { - return jv.toObject(). -#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - toVariantHash -#else - toVariantMap -#endif - (); + return jv.toObject().toVariantHash(); } diff --git a/lib/converters.h b/lib/converters.h index 075af7ef..543e9496 100644 --- a/lib/converters.h +++ b/lib/converters.h @@ -30,21 +30,6 @@ #include <vector> -#if QT_VERSION < QT_VERSION_CHECK(5,14,0) -// Enable std::unordered_map<QString, T> -// REMOVEME in favor of UnorderedMap, once we regenerate API files -namespace std { -template <> -struct hash<QString> { - size_t operator()(const QString& s) const Q_DECL_NOEXCEPT - { - return qHash(s, uint(qGlobalQHashSeed()) - ); - } -}; -} // namespace std -#endif - class QVariant; namespace Quotient { @@ -296,18 +281,9 @@ template <typename T> struct JsonObjectConverter<QHash<QString, T>> : public HashMapFromJson<QHash<QString, T>> {}; -// We could use std::conditional<> below but QT_VERSION* macros in C++ code -// cause (kinda valid but useless and noisy) compiler warnings about -// bitwise operations on signed integers; so use the preprocessor for now. -using variant_map_t = -#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - QVariantHash; -#else - QVariantMap; -#endif template <> -struct JsonConverter<variant_map_t> { - static QJsonObject dump(const variant_map_t& vh); +struct JsonConverter<QVariantHash> { + static QJsonObject dump(const QVariantHash& vh); static QVariantHash load(const QJsonValue& jv); }; |