MessageListSerialization.hpp
1 #pragma once
2 #include <State/Message.hpp>
3 
4 #include <score/serialization/JSONVisitor.hpp>
5 #include <score/serialization/MimeVisitor.hpp>
6 
7 namespace score
8 {
9 namespace mime
10 {
11 inline constexpr const char* messagelist()
12 {
13  return "application/x-score-messagelist";
14 }
15 }
16 }
17 
18 template <>
19 struct MimeReader<State::MessageList> : public MimeDataReader
20 {
21  using MimeDataReader::MimeDataReader;
22  void serialize(const State::MessageList& lst) const
23  {
24  m_mime.setData(score::mime::messagelist(), toJson(lst));
25  }
26 };
27 
28 template <>
29 struct MimeWriter<State::MessageList> : public MimeDataWriter
30 {
31  using MimeDataWriter::MimeDataWriter;
32  State::MessageList deserialize()
33  {
34  return fromJson<State::MessageList>(m_mime.data(score::mime::messagelist()));
35  }
36 };
Utilities for OSSIA data structures.
Definition: DeviceInterface.hpp:33
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: MimeVisitor.hpp:22
Definition: MimeVisitor.hpp:32
Definition: MimeVisitor.hpp:7
Definition: MimeVisitor.hpp:9