3 #include <score/tools/Debug.hpp>
20 #include <QtContainerFwd>
22 #include <score_lib_base_export.h>
26 #include <type_traits>
39 struct is_qpointer : std::false_type
43 struct is_qpointer<QPointer<T>> : std::true_type
47 static constexpr
bool is_qpointer_v = is_qpointer<T>::value;
49 #if defined(SCORE_DEBUG_DELIMITERS)
50 #define SCORE_DEBUG_INSERT_DELIMITER \
55 #define SCORE_DEBUG_INSERT_DELIMITER2(Vis) \
58 Vis.insertDelimiter(); \
60 #define SCORE_DEBUG_CHECK_DELIMITER \
65 #define SCORE_DEBUG_CHECK_DELIMITER2(Vis) \
68 Vis.checkDelimiter(); \
71 #define SCORE_DEBUG_INSERT_DELIMITER
72 #define SCORE_DEBUG_INSERT_DELIMITER2(Vis)
73 #define SCORE_DEBUG_CHECK_DELIMITER
74 #define SCORE_DEBUG_CHECK_DELIMITER2(Vis)
86 concept is_QDataStreamSerializable
87 = std::is_arithmetic<T>::value || std::is_same<T, QStringList>::value
88 || std::is_same<T, QVector2D>::value || std::is_same<T, QVector3D>::value
89 || std::is_same<T, QVector4D>::value || std::is_same<T, QPointF>::value
90 || std::is_same<T, QPoint>::value || std::is_same<T, std::string>::value;
92 SCORE_LIB_BASE_EXPORT QDataStream&
93 operator<<(QDataStream& stream,
const std::string& obj);
94 SCORE_LIB_BASE_EXPORT QDataStream& operator>>(QDataStream& stream, std::string& obj);
107 #if(INTPTR_MAX == INT64_MAX) && !defined(__APPLE__) && !defined(_WIN32)
108 #define SCORE_INT64_IS_QINT64
111 #if defined(SCORE_INT64_IS_QINT64)
112 inline QDataStream& operator<<(QDataStream& s, uint64_t val)
117 inline QDataStream& operator>>(QDataStream& s, uint64_t& val)
122 inline QDataStream& operator<<(QDataStream& s, int64_t val)
127 inline QDataStream& operator>>(QDataStream& s, int64_t& val)
134 #if defined(__APPLE__) || defined(__EMSCRIPTEN__)
135 inline QDataStream& operator<<(QDataStream& s, std::size_t val)
140 inline QDataStream& operator>>(QDataStream& s, std::size_t& val)
147 template <
typename T>
148 requires(!std::is_enum_v<T>)
151 template <
typename T>
152 requires(!std::is_enum_v<T>)
155 #define DATASTREAM_QT_BUILTIN(T) \
157 DataStreamInput& operator<<(DataStreamInput& s, const T& obj) \
163 DataStreamOutput& operator>>(DataStreamOutput& s, T& obj) \
169 DATASTREAM_QT_BUILTIN(
bool)
170 DATASTREAM_QT_BUILTIN(
char)
171 DATASTREAM_QT_BUILTIN(qint8)
172 DATASTREAM_QT_BUILTIN(qint16)
173 DATASTREAM_QT_BUILTIN(qint32)
174 DATASTREAM_QT_BUILTIN(qint64)
176 #if defined(SCORE_INT64_IS_QINT64)
177 DATASTREAM_QT_BUILTIN(int64_t)
180 DATASTREAM_QT_BUILTIN(quint8)
181 DATASTREAM_QT_BUILTIN(quint16)
182 DATASTREAM_QT_BUILTIN(quint32)
183 DATASTREAM_QT_BUILTIN(quint64)
185 #if defined(SCORE_INT64_IS_QINT64)
186 DATASTREAM_QT_BUILTIN(uint64_t)
189 DATASTREAM_QT_BUILTIN(
float)
190 DATASTREAM_QT_BUILTIN(
double)
191 DATASTREAM_QT_BUILTIN(QString)
192 DATASTREAM_QT_BUILTIN(QStringList)
193 DATASTREAM_QT_BUILTIN(QPoint)
194 DATASTREAM_QT_BUILTIN(QPointF)
195 DATASTREAM_QT_BUILTIN(QRect)
196 DATASTREAM_QT_BUILTIN(QRectF)
197 DATASTREAM_QT_BUILTIN(QVector2D)
198 DATASTREAM_QT_BUILTIN(QVector3D)
199 DATASTREAM_QT_BUILTIN(QVector4D)
200 DATASTREAM_QT_BUILTIN(QByteArray)
201 DATASTREAM_QT_BUILTIN(QSizeF)
202 DATASTREAM_QT_BUILTIN(QColor)
203 DATASTREAM_QT_BUILTIN(QVariant)
204 DATASTREAM_QT_BUILTIN(std::string)
206 template <
typename T>
208 template <
typename T>
211 template <
typename K,
typename V>
213 template <
typename K,
typename V>
216 template <
typename K,
typename V>
218 template <
typename K,
typename V>
221 template <
typename T>
222 requires(std::is_enum_v<T>)
229 template <
typename T>
230 requires(std::is_enum_v<T>)
Definition: ClipMode.hpp:10
Definition: DataStreamHelpers.hpp:103
Definition: DataStreamHelpers.hpp:30