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_AGGREGATIONELEMENT_H 0008 #define KUSERFEEDBACK_CONSOLE_AGGREGATIONELEMENT_H 0009 0010 #include "schemaentry.h" 0011 #include "schemaentryelement.h" 0012 0013 class QJsonArray; 0014 class QJsonObject; 0015 0016 namespace KUserFeedback { 0017 namespace Console { 0018 0019 class Product; 0020 0021 class AggregationElement 0022 { 0023 public: 0024 AggregationElement(); 0025 ~AggregationElement(); 0026 0027 bool operator==(const AggregationElement &other) const; 0028 0029 enum Type { 0030 Value, 0031 Size 0032 }; 0033 Type type() const; 0034 void setType(Type t); 0035 0036 bool isValid() const; 0037 0038 SchemaEntry schemaEntry() const; 0039 void setSchemaEntry(const SchemaEntry &entry); 0040 0041 SchemaEntryElement schemaEntryElement() const; 0042 void setSchemaEntryElement(const SchemaEntryElement &element); 0043 0044 QString displayString() const; 0045 0046 QJsonObject toJsonObject() const; 0047 static QVector<AggregationElement> fromJson(const Product &product, const QJsonArray &a); 0048 0049 private: 0050 SchemaEntry m_entry; 0051 SchemaEntryElement m_element; 0052 Type m_type = Value; 0053 }; 0054 0055 } 0056 } 0057 0058 Q_DECLARE_TYPEINFO(KUserFeedback::Console::AggregationElement, Q_MOVABLE_TYPE); 0059 Q_DECLARE_METATYPE(KUserFeedback::Console::AggregationElement) 0060 0061 #endif // KUSERFEEDBACK_CONSOLE_AGGREGATIONELEMENT_H