File indexing completed on 2024-12-15 03:44:59

0001 /*
0002     SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_CONSOLE_SAMPLE_H
0008 #define KUSERFEEDBACK_CONSOLE_SAMPLE_H
0009 
0010 #include <QMetaType>
0011 #include <QSharedDataPointer>
0012 #include <QVector>
0013 
0014 class QDateTime;
0015 class QString;
0016 
0017 namespace KUserFeedback {
0018 namespace Console {
0019 
0020 class Product;
0021 class SampleData;
0022 
0023 /** One data sample reported by a client. */
0024 class Sample
0025 {
0026 public:
0027     Sample();
0028     Sample(const Sample&);
0029     ~Sample();
0030     Sample& operator=(const Sample&);
0031 
0032     QDateTime timestamp() const;
0033     QVariant value(const QString &name) const;
0034 
0035     static QVector<Sample> fromJson(const QByteArray &json, const Product &product);
0036     static QByteArray toJson(const QVector<Sample> &samples, const Product &product);
0037 
0038 private:
0039     QSharedDataPointer<SampleData> d;
0040 };
0041 
0042 }
0043 }
0044 
0045 Q_DECLARE_TYPEINFO(KUserFeedback::Console::Sample, Q_MOVABLE_TYPE);
0046 Q_DECLARE_METATYPE(KUserFeedback::Console::Sample)
0047 
0048 #endif // KUSERFEEDBACK_CONSOLE_SAMPLE_H