DataStreamFwd.hpp
1 #pragma once
2 #include <ossia/detail/config.hpp>
3 
4 class QDataStream;
5 
6 #define SCORE_SERIALIZE_DATASTREAM_DECLARE(EXPORT, T) \
7  EXPORT \
8  QDataStream& operator<<(QDataStream& stream, const T& obj); \
9  EXPORT \
10  QDataStream& operator>>(QDataStream& stream, T& obj);
11 
12 #define SCORE_SERALIZE_DATASTREAM_DEFINE(T) \
13  QDataStream& operator<<(QDataStream& stream, const T& obj) \
14  { \
15  DataStreamReader reader{stream.device()}; \
16  reader.readFrom(obj); \
17  return stream; \
18  } \
19  QDataStream& operator>>(QDataStream& stream, T& obj) \
20  { \
21  DataStreamWriter writer{stream.device()}; \
22  writer.writeTo(obj); \
23  return stream; \
24  }
25 
26 #define SCORE_SERALIZE_DATASTREAM_DEFINE_T(TEMPLATE, T) \
27  TEMPLATE \
28  QDataStream& operator<<(QDataStream& stream, const T& obj) \
29  { \
30  DataStreamReader reader{stream.device()}; \
31  reader.readFrom(obj); \
32  return stream; \
33  } \
34  TEMPLATE \
35  QDataStream& operator>>(QDataStream& stream, T& obj) \
36  { \
37  DataStreamWriter writer{stream.device()}; \
38  writer.writeTo(obj); \
39  return stream; \
40  }