From e15cb94a0d6de90bc8e80c94c90fd7c47add1fc1 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Wed, 10 Dec 2014 07:38:56 +0100 Subject: include annotations in binary serialization --- tests/hawd/dataset.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests') 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 @@ namespace HAWD { +static const QString s_annotationKey("__annotation__"); + Dataset::Row::Row(const Row &other) : m_key(other.m_key), m_columns(other.m_columns), @@ -88,7 +90,11 @@ void Dataset::Row::fromBinary(QByteArray &data) while (!stream.atEnd()) { stream >> key >> value; - setValue(key, value); + if (key == s_annotationKey) { + m_annotation = value.toString(); + } else { + setValue(key, value); + } } } @@ -102,6 +108,9 @@ QByteArray Dataset::Row::toBinary() const stream << it.key() << it.value(); } + if (!m_annotation.isEmpty()) { + stream << s_annotationKey << m_annotation; + } return data; } -- cgit v1.2.3