File indexing completed on 2024-10-06 04:34:02

0001 /*
0002    SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include "reaction.h"
0011 #include <QVector>
0012 class EmojiManager;
0013 class LIBRUQOLACORE_EXPORT Reactions
0014 {
0015 public:
0016     Reactions();
0017 
0018     void setReactions(const QVector<Reaction> &reactions);
0019     [[nodiscard]] QVector<Reaction> reactions() const;
0020 
0021     void parseReactions(const QJsonObject &array, EmojiManager *emojiManager = nullptr);
0022 
0023     [[nodiscard]] bool operator==(const Reactions &other) const;
0024 
0025     [[nodiscard]] static QJsonObject serialize(const Reactions &reactions);
0026     [[nodiscard]] static Reactions deserialize(const QJsonObject &o, EmojiManager *emojiManager = nullptr);
0027 
0028     [[nodiscard]] bool isEmpty() const;
0029 
0030 private:
0031     QVector<Reaction> mReactions;
0032 };
0033 Q_DECLARE_METATYPE(Reactions)
0034 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const Reactions &t);