9#include "akonadicore_export.h"
13#include <QSharedPointer>
25class AKONADICORE_EXPORT Tag
56 explicit Tag(
const QString &name);
64 Tag &operator=(const Tag &);
65 Tag &operator=(Tag &&) noexcept;
67 bool operator==(const Tag &) const;
68 bool operator!=(const Tag &) const;
70 static Tag fromUrl(const
QUrl &
url);
127 inline T *attribute(CreateOption option = DontCreate);
133 inline const T *attribute()
const;
139 inline void removeAttribute();
145 inline bool hasAttribute()
const;
155 void setId(Id identifier);
171 void setName(
const QString &name);
174 void setParent(
const Tag &parent);
177 bool isValid()
const;
183 bool isImmutable()
const;
192 void markAttributeModified(
const QByteArray &type);
197 friend class ProtocolHelper;
203AKONADICORE_EXPORT
size_t qHash(
const Akonadi::Tag &,
size_t sed = 0) noexcept;
209 markAttributeModified(type);
211 T *attr =
dynamic_cast<T *
>(
attribute(type));
212 if (checkAttribute(attr, type)) {
229 const T *attr =
dynamic_cast<const T *
>(
attribute(type));
230 if (checkAttribute(attr, type)) {
257Q_DECLARE_METATYPE(Akonadi::Tag::List)
Provides interface for custom attributes for Entity.
Job that fetches tags from the Akonadi storage.
Job that modifies a tag in the Akonadi storage.
void removeAttribute()
Removes and deletes the attribute of the requested type.
static const char GENERIC[]
The GENERIC type has the following properties:
void addAttribute(Attribute *attribute)
Adds an attribute to the entity.
CreateOption
Describes the options that can be passed to access attributes.
@ AddIfMissing
Creates the attribute if it is missing.
@ DontCreate
Does not create an attribute if it is missing (default)
const T * attribute() const
Returns the attribute of the requested type or 0 if it is not available.
static const char PLAIN[]
The PLAIN type has the following properties:
const Attribute * attribute(const QByteArray &name) const
Returns the attribute of the given type name if available, 0 otherwise.
bool hasAttribute(const QByteArray &name) const
Returns true if the entity has an attribute of the given type name, false otherwise.
void clearAttributes()
Removes and deletes all attributes of the entity.
Attribute::List attributes() const
Returns a list of all attributes of the entity.
QUrl url() const
Returns the url of the tag.
bool hasAttribute() const
Returns whether the entity has an attribute of the requested type.
void removeAttribute(const QByteArray &name)
Removes and deletes the attribute of the given type name.
Helper integration between Akonadi and Qt.