Overte C++ Documentation
StreamUtils.h
1 //
2 // StreamUtils.h
3 // libraries/shared/src
4 //
5 // Created by Andrew Meadows on 2014.
6 // Copyright 2014 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_StreamUtils_h
13 #define hifi_StreamUtils_h
14 
15 #include <iostream>
16 
17 #include <QByteArray>
18 #include <QVariantHash>
19 
20 #include <glm/glm.hpp>
21 #include <glm/gtx/quaternion.hpp>
22 
23 class QDataStream;
24 
25 namespace StreamUtil {
26  // dump the buffer, 32 bytes per row, each byte in hex, separated by whitespace
27  void dump(std::ostream& s, const QByteArray& buffer);
28 }
29 
30 std::ostream& operator<<(std::ostream& s, const glm::vec3& v);
31 std::ostream& operator<<(std::ostream& s, const glm::quat& q);
32 std::ostream& operator<<(std::ostream& s, const glm::mat4& m);
33 
34 QDataStream& operator<<(QDataStream& out, const glm::vec3& vector);
35 QDataStream& operator>>(QDataStream& in, glm::vec3& vector);
36 
37 QDataStream& operator<<(QDataStream& out, const glm::quat& quaternion);
38 QDataStream& operator>>(QDataStream& in, glm::quat& quaternion);
39 
40 #ifndef QT_NO_DEBUG_STREAM
41 class QDebug;
42 // Add support for writing these to qDebug().
43 QDebug& operator<<(QDebug& s, const glm::vec2& v);
44 QDebug& operator<<(QDebug& s, const glm::vec3& v);
45 QDebug& operator<<(QDebug& s, const glm::u8vec3& v);
46 QDebug& operator<<(QDebug& s, const glm::vec4& v);
47 QDebug& operator<<(QDebug& s, const glm::quat& q);
48 QDebug& operator<<(QDebug& s, const glm::mat4& m);
49 QDebug& operator<<(QDebug& dbg, const QVariantHash& v);
50 #endif // QT_NO_DEBUG_STREAM
51 
52 #endif // hifi_StreamUtils_h