diff options
author | Roman Plášil <me@rplasil.name> | 2017-08-16 13:56:13 +0800 |
---|---|---|
committer | Roman Plášil <me@rplasil.name> | 2017-08-16 14:09:54 +0800 |
commit | 6ae8e3d78b5c4a75ca7d5ca88af730071047d148 (patch) | |
tree | d295ad7bff2fcf5ac19f0f35ebe5bd355b928dca /jobs/syncjob.h | |
parent | c1929dc22c87ac61e5369cb752e6ddd0ef6a79bf (diff) | |
download | libquotient-6ae8e3d78b5c4a75ca7d5ca88af730071047d148.tar.gz libquotient-6ae8e3d78b5c4a75ca7d5ca88af730071047d148.zip |
Implement saving save to enable incremental sync even after shutdown
Diffstat (limited to 'jobs/syncjob.h')
-rw-r--r-- | jobs/syncjob.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/jobs/syncjob.h b/jobs/syncjob.h index 07824e23..9dc221b5 100644 --- a/jobs/syncjob.h +++ b/jobs/syncjob.h @@ -67,7 +67,18 @@ Q_DECLARE_TYPEINFO(QMatrixClient::SyncRoomData, Q_MOVABLE_TYPE); namespace QMatrixClient { // QVector cannot work with non-copiable objects, std::vector can. - using SyncData = std::vector<SyncRoomData>; + using SyncDataList = std::vector<SyncRoomData>; + + class SyncData { + public: + void parseJson(const QJsonDocument &data); + SyncDataList&& takeRoomData(); + QString nextBatch() const; + + private: + QString nextBatch_; + SyncDataList roomData; + }; class SyncJob: public BaseJob { @@ -77,14 +88,12 @@ namespace QMatrixClient int timeout = -1, const QString& presence = {}); virtual ~SyncJob(); - SyncData&& takeRoomData(); - QString nextBatch() const; + SyncData *data() const { return d; } protected: Status parseJson(const QJsonDocument& data) override; private: - class Private; - Private* d; + SyncData* d; }; } // namespace QMatrixClient |