File indexing completed on 2024-11-10 04:40:28
0001 /* 0002 SPDX-FileCopyrightText: 2010 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "akonadicore_export.h" 0010 #include "attribute.h" 0011 0012 #include <memory> 0013 0014 namespace Akonadi 0015 { 0016 class IndexPolicyAttributePrivate; 0017 0018 /** 0019 * @short An attribute to specify how a collection should be indexed for searching. 0020 * 0021 * This attribute can be attached to any collection and should be honored by indexing 0022 * agents. 0023 * 0024 * @since 4.6 0025 */ 0026 class AKONADICORE_EXPORT IndexPolicyAttribute : public Akonadi::Attribute 0027 { 0028 public: 0029 /** 0030 * Creates a new index policy attribute. 0031 */ 0032 IndexPolicyAttribute(); 0033 0034 /** 0035 * Destroys the index policy attribute. 0036 */ 0037 ~IndexPolicyAttribute() override; 0038 0039 /** 0040 * Returns whether this collection is supposed to be indexed at all. 0041 */ 0042 [[nodiscard]] bool indexingEnabled() const; 0043 0044 /** 0045 * Sets whether this collection should be indexed at all. 0046 * @param enable @c true to enable indexing, @c false to exclude this collection from indexing 0047 */ 0048 void setIndexingEnabled(bool enable); 0049 0050 /// @cond PRIVATE 0051 QByteArray type() const override; 0052 Attribute *clone() const override; 0053 QByteArray serialized() const override; 0054 void deserialize(const QByteArray &data) override; 0055 /// @endcond 0056 0057 private: 0058 /// @cond PRIVATE 0059 const std::unique_ptr<IndexPolicyAttributePrivate> d; 0060 /// @endcond 0061 }; 0062 0063 } // namespace Akonadi