File indexing completed on 2024-05-26 05:14:33

0001 /*
0002     SPDX-FileCopyrightText: 2017 Daniel Vrátil <dvratil@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QSet>
0010 
0011 #include "private/protocol_p.h"
0012 
0013 #include <memory>
0014 
0015 class QByteArray;
0016 
0017 namespace Akonadi
0018 {
0019 namespace Server
0020 {
0021 class AggregatedCollectionFetchScopePrivate;
0022 class AggregatedCollectionFetchScope
0023 {
0024 public:
0025     explicit AggregatedCollectionFetchScope();
0026     ~AggregatedCollectionFetchScope();
0027 
0028     void apply(const Protocol::CollectionFetchScope &oldScope, const Protocol::CollectionFetchScope &newScope);
0029 
0030     QSet<QByteArray> attributes() const;
0031 
0032     bool fetchIdOnly() const;
0033     bool fetchStatistics() const;
0034 
0035     void addSubscriber();
0036     void removeSubscriber();
0037 
0038 private:
0039     std::unique_ptr<AggregatedCollectionFetchScopePrivate> const d_ptr;
0040     Q_DECLARE_PRIVATE(AggregatedCollectionFetchScope)
0041 };
0042 
0043 class AggregatedItemFetchScopePrivate;
0044 class AggregatedItemFetchScope
0045 {
0046 public:
0047     explicit AggregatedItemFetchScope();
0048     ~AggregatedItemFetchScope();
0049 
0050     void apply(const Protocol::ItemFetchScope &oldScope, const Protocol::ItemFetchScope &newScope);
0051     Protocol::ItemFetchScope toFetchScope() const;
0052 
0053     QSet<QByteArray> requestedParts() const;
0054 
0055     Protocol::ItemFetchScope::AncestorDepth ancestorDepth() const;
0056     void updateAncestorDepth(Protocol::ItemFetchScope::AncestorDepth oldDepth, Protocol::ItemFetchScope::AncestorDepth newDepth);
0057 
0058     bool cacheOnly() const;
0059     bool fullPayload() const;
0060     bool allAttributes() const;
0061     bool fetchSize() const;
0062     bool fetchMTime() const;
0063     bool fetchRemoteRevision() const;
0064     bool ignoreErrors() const;
0065     bool fetchFlags() const;
0066     bool fetchRemoteId() const;
0067     bool fetchGID() const;
0068     bool fetchTags() const;
0069     bool fetchRelations() const;
0070     bool fetchVirtualReferences() const;
0071 
0072     void addSubscriber();
0073     void removeSubscriber();
0074 
0075 private:
0076     std::unique_ptr<AggregatedItemFetchScopePrivate> const d_ptr;
0077     Q_DECLARE_PRIVATE(AggregatedItemFetchScope)
0078 };
0079 
0080 class AggregatedTagFetchScopePrivate;
0081 class AggregatedTagFetchScope
0082 {
0083 public:
0084     explicit AggregatedTagFetchScope();
0085     ~AggregatedTagFetchScope();
0086 
0087     void apply(const Protocol::TagFetchScope &oldScope, const Protocol::TagFetchScope &newScope);
0088     Protocol::TagFetchScope toFetchScope() const;
0089 
0090     QSet<QByteArray> attributes() const;
0091 
0092     void addSubscriber();
0093     void removeSubscriber();
0094 
0095     bool fetchIdOnly() const;
0096     bool fetchRemoteId() const;
0097     bool fetchAllAttributes() const;
0098 
0099 private:
0100     std::unique_ptr<AggregatedTagFetchScopePrivate> const d_ptr;
0101     Q_DECLARE_PRIVATE(AggregatedTagFetchScope)
0102 };
0103 
0104 } // namespace Server
0105 } // namespace Akonadi