summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qcborstream.cpp
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@qt.io>2018-09-10 08:47:32 +0200
committerJędrzej Nowacki <jedrzej.nowacki@qt.io>2018-10-03 14:49:27 +0000
commit31f3facac32913074fe91b8f77e72be7c2f55a65 (patch)
tree1528f1f903485657ea4f5514988f344fed2dc888 /src/corelib/serialization/qcborstream.cpp
parente74cb37159b593b6c180949d56c99f4ea63986db (diff)
Implement QDataStream operator for QCborSimpleValue
That allows us to remove custom handling in QMetaType. Change-Id: Ic09fb96e1a05c6897803811d70aebbc6ea6e4f2e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/serialization/qcborstream.cpp')
-rw-r--r--src/corelib/serialization/qcborstream.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp
index aed286a11f..38b809158a 100644
--- a/src/corelib/serialization/qcborstream.cpp
+++ b/src/corelib/serialization/qcborstream.cpp
@@ -44,6 +44,7 @@
#include <qbuffer.h>
#include <qdebug.h>
#include <qstack.h>
+#include <qdatastream.h>
QT_BEGIN_NAMESPACE
@@ -170,6 +171,21 @@ Q_CORE_EXPORT const char *qt_cbor_simpletype_id(QCborSimpleType st)
return nullptr;
}
+#if !defined(QT_NO_DATASTREAM)
+QDataStream &operator<<(QDataStream &ds, QCborSimpleType st)
+{
+ return ds << quint8(st);
+}
+
+QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st)
+{
+ quint8 v;
+ ds >> v;
+ st = QCborSimpleType(v);
+ return ds;
+}
+#endif
+
#if !defined(QT_NO_DEBUG_STREAM)
QDebug operator<<(QDebug dbg, QCborSimpleType st)
{