File indexing completed on 2024-09-15 04:47:08

0001 /*
0002  * Copyright (C) 2014 Aaron Seigo <aseigo@kde.org>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) version 3, or any
0008  * later version accepted by the membership of KDE e.V. (or its
0009  * successor approved by the membership of KDE e.V.), which shall
0010  * act as a proxy defined in Section 6 of version 3 of the license.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General Public
0018  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0019  */
0020 
0021 #pragma once
0022 
0023 #include <QHash>
0024 #include <QJsonObject>
0025 #include <QVariant>
0026 
0027 #include "hawd_export.h"
0028 
0029 namespace HAWD
0030 {
0031 
0032 class HAWD_EXPORT DataDefinition
0033 {
0034 public:
0035     DataDefinition(const QString &name = QString(), QMetaType::Type type = QMetaType::Void, const QString &unit = QString(), int min = 0, int max = 0);
0036     DataDefinition(const QJsonObject &object);
0037 
0038     QString name() const;
0039     QMetaType::Type type() const;
0040     QString typeString() const;
0041     QString unit() const;
0042     int min() const;
0043     int max() const;
0044 
0045 private:
0046     QString m_name;
0047     QMetaType::Type m_type;
0048     QString m_unit;
0049     int m_min;
0050     int m_max;
0051 };
0052 
0053 class HAWD_EXPORT DatasetDefinition
0054 {
0055 public:
0056     DatasetDefinition(const QString &path);
0057 
0058     bool isValid() const;
0059 
0060     QString lastError() const;
0061     QString name() const;
0062     QString description() const;
0063     QList<QPair<QString, DataDefinition> > columns() const;
0064 
0065 private:
0066     bool m_valid;
0067     QString m_name;
0068     QString m_description;
0069     QString m_lastError;
0070     QList<QPair<QString, DataDefinition> > m_columns;
0071 };
0072 
0073 } // namespace HAWD
0074