score
Home
Classes
Namespaces
Files
StringFactoryKeySerialization.hpp
1
#pragma once
2
#include <score/plugins/StringFactoryKey.hpp>
3
#include <
score/serialization/DataStreamVisitor.hpp
>
4
#include <score/serialization/JSONValueVisitor.hpp>
5
6
//SCORE_SERALIZE_DATASTREAM_DEFINE_T(template<typename T>, StringKey<T>)
7
8
template
<
typename
U>
9
struct
TSerializer
<
DataStream
,
StringKey
<U>>
10
{
11
static
void
readFrom(
DataStream::Serializer
& s,
const
StringKey<U>
& key)
12
{
13
s.stream() << key.toString();
14
}
15
16
static
void
writeTo(
DataStream::Deserializer
& s,
StringKey<U>
& key)
17
{
18
s.stream() >> key.toString();
19
}
20
};
21
22
/*
23
template <typename U>
24
struct TSerializer<JSONValue, StringKey<U>>
25
{
26
static void readFrom(JSONObject::Serializer& s, const StringKey<U>& key)
27
{
28
s.val = QString::fromStdString(key.toString());
29
}
30
31
static void writeTo(JSONValue::Serializer& s, StringKey<U>& key)
32
{
33
key.toString() = s.val.toString().toStdString();
34
}
35
};
36
*/
DataStreamVisitor.hpp
DataStream
Definition:
VisitorInterface.hpp:53
DataStreamReader
Definition:
DataStreamVisitor.hpp:27
DataStreamWriter
Definition:
DataStreamVisitor.hpp:202
StringKey
Definition:
StringFactoryKey.hpp:8
TSerializer
Definition:
VisitorInterface.hpp:13