File indexing completed on 2025-01-05 04:49:48

0001 /*
0002  * SPDX-FileCopyrightText: 2016 Daniel Vrátil <dvratil@kde.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  *
0006  */
0007 #pragma once
0008 
0009 #include <KCalendarCore/Incidence>
0010 #include <QDate>
0011 
0012 namespace CalendarEvents
0013 {
0014 class EventData;
0015 }
0016 class QDateTime;
0017 class QJsonObject;
0018 
0019 class TestDataParser
0020 {
0021 public:
0022     explicit TestDataParser(const QString &testData, bool uniqueEventData = false);
0023     ~TestDataParser();
0024 
0025     [[nodiscard]] QDate rangeStart() const;
0026     [[nodiscard]] QDate rangeEnd() const;
0027     [[nodiscard]] qint64 akonadiId() const;
0028     [[nodiscard]] KCalendarCore::Incidence::Ptr incidence() const;
0029     [[nodiscard]] QList<CalendarEvents::EventData> eventData() const;
0030 
0031     [[nodiscard]] static QStringList allTestData();
0032 
0033 private:
0034     void parse();
0035     QDateTime parseDateTime(const QJsonObject &datetime);
0036 
0037     QString mTestData;
0038     QDate mRangeStart;
0039     QDate mRangeEnd;
0040     qint64 mAkonadiId;
0041     KCalendarCore::Incidence::Ptr mIncidence;
0042     QList<CalendarEvents::EventData> mEventData;
0043     bool mUniqueEventData;
0044 };