File indexing completed on 2024-03-03 15:46:59

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "deviceinfo.h"
0010 #include "libruqolacore_export.h"
0011 #include <QDebug>
0012 #include <QString>
0013 #include <QVector>
0014 
0015 class LIBRUQOLACORE_EXPORT DeviceInfos
0016 {
0017 public:
0018     DeviceInfos();
0019 
0020     [[nodiscard]] int offset() const;
0021     void setOffset(int newOffset);
0022 
0023     [[nodiscard]] int total() const;
0024     void setTotal(int newTotal);
0025 
0026     [[nodiscard]] int deviceInfosCount() const;
0027     void setDeviceInfosCount(int newDeviceInfosCount);
0028 
0029     [[nodiscard]] const QVector<DeviceInfo> &deviceInfosList() const;
0030     void setDeviceInfosList(const QVector<DeviceInfo> &newDeviceInfosList);
0031 
0032     [[nodiscard]] bool isEmpty() const;
0033     void clear();
0034     [[nodiscard]] int count() const;
0035     [[nodiscard]] DeviceInfo at(int index) const;
0036 
0037     void parseDeviceInfos(const QJsonObject &discussionsObj);
0038     void parseMoreDeviceInfos(const QJsonObject &deviceInfosObj);
0039 
0040     DeviceInfo takeAt(int index);
0041 
0042 private:
0043     LIBRUQOLACORE_NO_EXPORT void parseDeviceInfosObj(const QJsonObject &discussionsObj);
0044     QVector<DeviceInfo> mDeviceInfosList;
0045     int mDeviceInfosCount = 0;
0046     int mOffset = 0;
0047     int mTotal = 0;
0048 };
0049 Q_DECLARE_METATYPE(DeviceInfos)
0050 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const DeviceInfos &t);