File indexing completed on 2024-11-10 04:40:28

0001 /*
0002     SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
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 <QByteArray>
0013 
0014 #include <memory>
0015 
0016 namespace Akonadi
0017 {
0018 class SpecialCollectionAttributePrivate;
0019 
0020 /**
0021  * @short An Attribute that stores the special collection type of a collection.
0022  *
0023  * All collections registered with SpecialCollections must have this attribute set.
0024  *
0025  * @author Constantin Berzan <exit3219@gmail.com>
0026  * @since 4.4
0027  */
0028 class AKONADICORE_EXPORT SpecialCollectionAttribute : public Akonadi::Attribute
0029 {
0030 public:
0031     /**
0032      * Creates a new special collection attribute.
0033      */
0034     explicit SpecialCollectionAttribute(const QByteArray &type = QByteArray());
0035 
0036     /**
0037      * Destroys the special collection attribute.
0038      */
0039     ~SpecialCollectionAttribute() override;
0040 
0041     /**
0042      * Sets the special collections @p type of the collection.
0043      */
0044     void setCollectionType(const QByteArray &type);
0045 
0046     /**
0047      * Returns the special collections type of the collection.
0048      */
0049     [[nodiscard]] QByteArray collectionType() const;
0050 
0051     /* reimpl */
0052     SpecialCollectionAttribute *clone() const override;
0053     QByteArray type() const override;
0054     QByteArray serialized() const override;
0055     void deserialize(const QByteArray &data) override;
0056 
0057 private:
0058     /// @cond PRIVATE
0059     const std::unique_ptr<SpecialCollectionAttributePrivate> d;
0060     /// @endcond
0061 };
0062 
0063 } // namespace Akonadi