File indexing completed on 2024-11-10 04:32:12

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 "file.h"
0010 #include "libruqola_private_export.h"
0011 #include <QDebug>
0012 #include <QVector>
0013 
0014 class LIBRUQOLACORE_TESTS_EXPORT FileAttachments
0015 {
0016 public:
0017     FileAttachments();
0018 
0019     [[nodiscard]] bool isEmpty() const;
0020     void clear();
0021     [[nodiscard]] int count() const;
0022     [[nodiscard]] File at(int index) const;
0023 
0024     [[nodiscard]] int filesCount() const;
0025     void setFilesCount(int filesCount);
0026 
0027     [[nodiscard]] int offset() const;
0028     void setOffset(int offset);
0029 
0030     [[nodiscard]] int total() const;
0031     void setTotal(int total);
0032 
0033     [[nodiscard]] QVector<File> fileAttachments() const;
0034     void setFileAttachments(const QVector<File> &fileAttachments);
0035 
0036     void parseFileAttachments(const QJsonObject &fileAttachmentsObj);
0037     void parseMoreFileAttachments(const QJsonObject &fileAttachmentsObj);
0038 
0039 private:
0040     void parseFiles(const QJsonObject &fileAttachmentsObj);
0041     QVector<File> mFileAttachments;
0042     int mFilesCount = 0;
0043     int mOffset = 0;
0044     int mTotal = 0;
0045 };
0046 
0047 Q_DECLARE_METATYPE(FileAttachments)
0048 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const FileAttachments &t);