ProcessMimeSerialization.hpp
1 #pragma once
2 #include <Process/ProcessFactory.hpp>
3 
4 #include <score/plugins/SerializableInterface.hpp>
6 #include <score/serialization/MimeVisitor.hpp>
7 
8 namespace score
9 {
10 namespace mime
11 {
12 inline constexpr auto processdata()
13 {
14  return "application/x-score-processdata";
15 }
16 inline constexpr auto processpreset()
17 {
18  return "application/x-score-processpreset";
19 }
20 inline constexpr auto processcontrol()
21 {
22  return "application/x-score-processcontrol";
23 }
24 inline constexpr auto layerdata()
25 {
26  return "application/x-score-layerdata";
27 }
28 inline constexpr auto scenariodata()
29 {
30  return "application/x-score-scenariodata";
31 }
32 }
33 }
34 
35 namespace Process
36 {
38 {
40  QString prettyName;
41  QString customData;
42 };
43 }
44 template <>
45 struct MimeReader<Process::ProcessData> : public MimeDataReader
46 {
47  using MimeDataReader::MimeDataReader;
48  void serialize(const Process::ProcessData& lst) const
49  {
50  m_mime.setData(score::mime::processdata(), DataStreamReader::marshall(lst));
51  }
52 };
53 
54 template <>
55 struct MimeWriter<Process::ProcessData> : public MimeDataWriter
56 {
57  using MimeDataWriter::MimeDataWriter;
58  auto deserialize()
59  {
60  return DataStreamWriter::unmarshall<Process::ProcessData>(
61  m_mime.data(score::mime::processdata()));
62  }
63 };
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
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
Definition: ProcessMimeSerialization.hpp:38