File indexing completed on 2024-12-15 03:45:00

0001 /*
0002     SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_CONSOLE_SCHEMAENTRYELEMENT_H
0008 #define KUSERFEEDBACK_CONSOLE_SCHEMAENTRYELEMENT_H
0009 
0010 #include <qobjectdefs.h>
0011 #include <QMetaType>
0012 #include <QSharedDataPointer>
0013 #include <QVector>
0014 
0015 QT_BEGIN_NAMESPACE
0016 class QJsonArray;
0017 class QJsonObject;
0018 QT_END_NAMESPACE
0019 
0020 namespace KUserFeedback {
0021 namespace Console {
0022 
0023 class SchemaEntryElementData;
0024 
0025 /** One element in a SchemaEntry. */
0026 class SchemaEntryElement
0027 {
0028     Q_GADGET
0029 public:
0030     enum Type {
0031         Integer,
0032         Number,
0033         String,
0034         Boolean
0035     };
0036     Q_ENUM(Type)
0037 
0038     SchemaEntryElement();
0039     SchemaEntryElement(const SchemaEntryElement &other);
0040     ~SchemaEntryElement();
0041     SchemaEntryElement& operator=(const SchemaEntryElement &other);
0042 
0043     bool operator==(const SchemaEntryElement &other) const;
0044 
0045     QString name() const;
0046     void setName(const QString& name);
0047 
0048     Type type() const;
0049     void setType(Type type);
0050 
0051     QJsonObject toJsonObject() const;
0052     static QVector<SchemaEntryElement> fromJson(const QJsonArray &array);
0053 
0054 private:
0055     QSharedDataPointer<SchemaEntryElementData> d;
0056 };
0057 }
0058 }
0059 
0060 Q_DECLARE_METATYPE(KUserFeedback::Console::SchemaEntryElement)
0061 Q_DECLARE_METATYPE(KUserFeedback::Console::SchemaEntryElement::Type)
0062 Q_DECLARE_TYPEINFO(KUserFeedback::Console::SchemaEntryElement, Q_MOVABLE_TYPE);
0063 
0064 #endif // KUSERFEEDBACK_CONSOLE_SCHEMAENTRYELEMENT_H