-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsonhelpers.h
41 lines (35 loc) · 985 Bytes
/
jsonhelpers.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef JSONHELPERS_H
#define JSONHELPERS_H
#include <QJsonArray>
#include <glm/vec3.hpp>
using namespace glm;
/**
* @brief This class contains helper methods to make parsing and generating
QT Json stuff a little less painful.
* @author Koda Koziol
* @date SPRING 2024
*/
class JsonHelpers
{
public:
/**
* @brief Given a QJsonArray with 3 numeric elements representing
x, y, and z in that order, return a vec3.
* @param vec3Array
* @return vec3
* @throws std::invalid_argument if the array is not of size 3
* @author Koda Koziol
* @date SPRING 2024
*/
static vec3 getVec3FromJson(QJsonArray vec3Array);
/**
* @brief Given a vec3, return a QJsonArray with 3 numeric elements
representing x, y, and z in that order.
* @param vec
* @return QJsonArray
* @author Koda Koziol
* @date SPRING 2024
*/
static QJsonArray getJsonFromVec3(vec3 vec);
};
#endif // JSONHELPERS_H