added stream operators to Vertex

Fri, 23 Mar 2018 21:36:37 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 23 Mar 2018 21:36:37 +0200
changeset 1314
d94cf95608ac
parent 1313
4baed9f54de3
child 1315
23d48a709ffc

added stream operators to Vertex

src/basics.cpp file | annotate | diff | comparison | revisions
src/basics.h file | annotate | diff | comparison | revisions
src/main.cpp file | annotate | diff | comparison | revisions
--- a/src/basics.cpp	Fri Mar 23 21:30:24 2018 +0200
+++ b/src/basics.cpp	Fri Mar 23 21:36:37 2018 +0200
@@ -192,6 +192,16 @@
 	};
 }
 
+QDataStream& operator<<(QDataStream& out, const Vertex& vertex)
+{
+	return out << vertex.x << vertex.y << vertex.z;
+}
+
+QDataStream& operator>>(QDataStream& in, Vertex& vertex)
+{
+	return in >> vertex.x >> vertex.y >> vertex.z;
+}
+
 // =============================================================================
 //
 BoundingBox::BoundingBox()
--- a/src/basics.h	Fri Mar 23 21:30:24 2018 +0200
+++ b/src/basics.h	Fri Mar 23 21:36:37 2018 +0200
@@ -131,6 +131,9 @@
 
 Q_DECLARE_METATYPE (Vertex)
 uint qHash(const Vertex& key);
+QDataStream& operator<<(QDataStream& out, const Vertex& vertex);
+QDataStream& operator>>(QDataStream& in, Vertex& vertex);
+
 
 static inline qreal abs(const QVector3D &vector)
 {
--- a/src/main.cpp	Fri Mar 23 21:30:24 2018 +0200
+++ b/src/main.cpp	Fri Mar 23 21:36:37 2018 +0200
@@ -33,6 +33,8 @@
 	qRegisterMetaType<Libraries>("Libraries");
 	qRegisterMetaTypeStreamOperators<Library>("Library");
 	qRegisterMetaTypeStreamOperators<Libraries>("Libraries");
+	qRegisterMetaType<Vertex>("Vertex");
+	qRegisterMetaTypeStreamOperators<Vertex>("Vertex");
 
 	static Configuration configObject;
 	config = &configObject;

mercurial