summaryrefslogtreecommitdiffstats
path: root/tests/hawd/dataset.cpp
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2014-12-10 07:38:56 +0100
committerAaron Seigo <aseigo@kde.org>2014-12-11 01:01:13 +0100
commite15cb94a0d6de90bc8e80c94c90fd7c47add1fc1 (patch)
treeb0819b7722bd9eaeeaccd90bd62717e5a5f36102 /tests/hawd/dataset.cpp
parent8c01036aab57a59a9921d4c9eae0f113004aab21 (diff)
downloadsink-e15cb94a0d6de90bc8e80c94c90fd7c47add1fc1.tar.gz
sink-e15cb94a0d6de90bc8e80c94c90fd7c47add1fc1.zip
include annotations in binary serialization
Diffstat (limited to 'tests/hawd/dataset.cpp')
-rw-r--r--tests/hawd/dataset.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/hawd/dataset.cpp b/tests/hawd/dataset.cpp
index 9211430..f6a0e4c 100644
--- a/tests/hawd/dataset.cpp
+++ b/tests/hawd/dataset.cpp
@@ -27,6 +27,8 @@
27namespace HAWD 27namespace HAWD
28{ 28{
29 29
30static const QString s_annotationKey("__annotation__");
31
30Dataset::Row::Row(const Row &other) 32Dataset::Row::Row(const Row &other)
31 : m_key(other.m_key), 33 : m_key(other.m_key),
32 m_columns(other.m_columns), 34 m_columns(other.m_columns),
@@ -88,7 +90,11 @@ void Dataset::Row::fromBinary(QByteArray &data)
88 90
89 while (!stream.atEnd()) { 91 while (!stream.atEnd()) {
90 stream >> key >> value; 92 stream >> key >> value;
91 setValue(key, value); 93 if (key == s_annotationKey) {
94 m_annotation = value.toString();
95 } else {
96 setValue(key, value);
97 }
92 } 98 }
93} 99}
94 100
@@ -102,6 +108,9 @@ QByteArray Dataset::Row::toBinary() const
102 stream << it.key() << it.value(); 108 stream << it.key() << it.value();
103 } 109 }
104 110
111 if (!m_annotation.isEmpty()) {
112 stream << s_annotationKey << m_annotation;
113 }
105 return data; 114 return data;
106} 115}
107 116