aboutsummaryrefslogtreecommitdiff
path: root/lib/converters.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-14 11:20:43 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-14 11:23:48 +0200
commit572b727b22d66a79431326c924236ef431fd972b (patch)
tree5c60030964cf8ca9d279cd66fcdc22bd1ac92b48 /lib/converters.h
parentb32c1c27ae412d073a7e98bdaf22678bdc66ab23 (diff)
downloadlibquotient-572b727b22d66a79431326c924236ef431fd972b.tar.gz
libquotient-572b727b22d66a79431326c924236ef431fd972b.zip
Cleanup across the board
Mainly driven by clang-tidy and SonarCloud warnings (sadly, SonarCloud doesn't store historical reports so no link can be provided here).
Diffstat (limited to 'lib/converters.h')
-rw-r--r--lib/converters.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/converters.h b/lib/converters.h
index 6515310a..5e3becb8 100644
--- a/lib/converters.h
+++ b/lib/converters.h
@@ -163,6 +163,14 @@ inline qint64 fromJson(const QJsonValue& jv) { return qint64(jv.toDouble()); }
template <>
inline QString fromJson(const QJsonValue& jv) { return jv.toString(); }
+//! Use fromJson<QString> and use toLatin1()/toUtf8()/... to make QByteArray
+//!
+//! QJsonValue can only convert to QString and there's ambiguity whether
+//! conversion to QByteArray should use (fast but very limited) toLatin1() or
+//! (all encompassing and conforming to the JSON spec but slow) toUtf8().
+template <>
+inline QByteArray fromJson(const QJsonValue& jv) = delete;
+
template <>
inline QJsonArray fromJson(const QJsonValue& jv) { return jv.toArray(); }