diff options
Diffstat (limited to 'tests/hawd/datasetdefinition.h')
-rw-r--r-- | tests/hawd/datasetdefinition.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/tests/hawd/datasetdefinition.h b/tests/hawd/datasetdefinition.h new file mode 100644 index 0000000..0593f39 --- /dev/null +++ b/tests/hawd/datasetdefinition.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Aaron Seigo <aseigo@kde.org> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | */ | ||
19 | |||
20 | #pragma once | ||
21 | |||
22 | #include <QHash> | ||
23 | #include <QJsonObject> | ||
24 | #include <QVariant> | ||
25 | |||
26 | namespace HAWD | ||
27 | { | ||
28 | |||
29 | class DataDefinition | ||
30 | { | ||
31 | public: | ||
32 | DataDefinition(const QString &name = QString(), QMetaType::Type type = QMetaType::Void, const QString &unit = QString(), int min = 0, int max = 0); | ||
33 | DataDefinition(const QJsonObject &object); | ||
34 | |||
35 | QString name() const; | ||
36 | QMetaType::Type type() const; | ||
37 | QString typeString() const; | ||
38 | QString unit() const; | ||
39 | int min() const; | ||
40 | int max() const; | ||
41 | |||
42 | private: | ||
43 | QString m_name; | ||
44 | QMetaType::Type m_type; | ||
45 | QString m_unit; | ||
46 | int m_min; | ||
47 | int m_max; | ||
48 | }; | ||
49 | |||
50 | class DatasetRow | ||
51 | { | ||
52 | public: | ||
53 | DatasetRow(const QHash<QString, DataDefinition> &columns); | ||
54 | void setValue(const QString &column, const QVariant &value); | ||
55 | void annotate(const QString ¬e); | ||
56 | QString toString() const; | ||
57 | |||
58 | private: | ||
59 | QHash<QString, DataDefinition> m_columns; | ||
60 | QHash<QString, QVariant> m_data; | ||
61 | QString m_annotation; | ||
62 | }; | ||
63 | |||
64 | class DatasetDefinition | ||
65 | { | ||
66 | public: | ||
67 | DatasetDefinition(const QString &path); | ||
68 | |||
69 | bool isValid() const; | ||
70 | |||
71 | QString name() const; | ||
72 | QString description() const; | ||
73 | QHash<QString, DataDefinition> columns() const; | ||
74 | |||
75 | private: | ||
76 | bool m_valid; | ||
77 | QString m_name; | ||
78 | QString m_description; | ||
79 | QHash<QString, DataDefinition> m_columns; | ||
80 | }; | ||
81 | |||
82 | } // namespace HAWD | ||
83 | |||