File indexing completed on 2024-12-01 04:35:32
0001 /* 0002 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "discussion.h" 0010 #include "libruqola_private_export.h" 0011 #include <QDebug> 0012 #include <QVector> 0013 0014 class LIBRUQOLACORE_TESTS_EXPORT Discussions 0015 { 0016 public: 0017 Discussions(); 0018 0019 [[nodiscard]] QVector<Discussion> discussions() const; 0020 void setDiscussions(const QVector<Discussion> &discussions); 0021 0022 void parseDiscussions(const QJsonObject &array); 0023 0024 void parseMoreDiscussions(const QJsonObject &discussionsObj); 0025 0026 [[nodiscard]] bool isEmpty() const; 0027 void clear(); 0028 [[nodiscard]] int count() const; 0029 [[nodiscard]] Discussion at(int index) const; 0030 [[nodiscard]] int discussionsCount() const; 0031 void setDiscussionsCount(int discussionsCount); 0032 0033 [[nodiscard]] int offset() const; 0034 void setOffset(int offset); 0035 0036 [[nodiscard]] int total() const; 0037 void setTotal(int total); 0038 0039 void append(const Discussion &discussion); 0040 0041 private: 0042 void parseDiscussionsObj(const QJsonObject &discussionsObj); 0043 QVector<Discussion> mDiscussion; 0044 int mDiscussionsCount = 0; 0045 int mOffset = 0; 0046 int mTotal = 0; 0047 }; 0048 Q_DECLARE_METATYPE(Discussions) 0049 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const Discussions &t);