Akonadi::Tag Class
class Akonadi::Tag| Header: | #include <Akonadi/Tag> |
| CMake: | find_package(KPim6 REQUIRED COMPONENTS AkonadiCore)target_link_libraries(mytarget PRIVATE KPim6::AkonadiCore) |
Public Types
| enum | CreateOption { AddIfMissing, DontCreate } |
Public Functions
| Tag(const QString &name) | |
| void | addAttribute(Akonadi::Attribute *attribute) |
| const T * | attribute() const |
| T * | attribute(Akonadi::Tag::CreateOption option = DontCreate) |
| const Akonadi::Attribute * | attribute(const QByteArray &name) const |
| Akonadi::Attribute::List | attributes() const |
| void | clearAttributes() |
| bool | hasAttribute() const |
| bool | hasAttribute(const QByteArray &name) const |
| Akonadi::Tag::Id | id() const |
| bool | isImmutable() const |
| void | removeAttribute() |
| void | removeAttribute(const QByteArray &name) |
| void | setId(Akonadi::Tag::Id identifier) |
| QUrl | url() const |
Static Public Members
| const char[] | GENERIC |
| const char[] | PLAIN |
| Akonadi::Tag | genericTag(const QString &name) |
Detailed Description
An Akonadi Tag.
Member Type Documentation
enum Tag::CreateOption
Describes the options that can be passed to access attributes.
Member Function Documentation
[explicit] Tag::Tag(const QString &name)
Creates a PLAIN tag
void Tag::addAttribute(Akonadi::Attribute *attribute)
Adds an attribute to the entity.
If an attribute of the same type name already exists, it is deleted and replaced with the new one.
attribute The new attribute.
Note: The entity takes the ownership of the attribute.
template <typename T> const T *Tag::attribute() const
Returns the attribute of the requested type or 0 if it is not available.
template <typename T> T *Tag::attribute(Akonadi::Tag::CreateOption option = DontCreate)
Returns the attribute of the requested type. If the entity has no attribute of that type yet, a new one is created and added to the entity.
option The create options.
const Akonadi::Attribute *Tag::attribute(const QByteArray &name) const
Returns the attribute of the given type name if available, 0 otherwise.
Akonadi::Attribute::List Tag::attributes() const
Returns a list of all attributes of the entity.
void Tag::clearAttributes()
Removes and deletes all attributes of the entity.
[static] Akonadi::Tag Tag::genericTag(const QString &name)
Returns a GENERIC tag with the given name and a valid gid
template <typename T> bool Tag::hasAttribute() const
Returns whether the entity has an attribute of the requested type.
bool Tag::hasAttribute(const QByteArray &name) const
Returns \ true if the entity has an attribute of the given type name, false otherwise.
Akonadi::Tag::Id Tag::id() const
Returns the unique identifier of the tag.
See also setId().
bool Tag::isImmutable() const
Returns true if the tag is immutable (cannot be modified after creation). Note that the immutability does not affect the attributes.
template <typename T> void Tag::removeAttribute()
Removes and deletes the attribute of the requested type.
void Tag::removeAttribute(const QByteArray &name)
Removes and deletes the attribute of the given type name.
void Tag::setId(Akonadi::Tag::Id identifier)
Sets the unique identifier of the tag.
See also id().
QUrl Tag::url() const
Returns the url of the tag.
Member Variable Documentation
const char[] Tag::GENERIC
The GENERIC type has the following properties: * mutable * gid is RFC 4122 compatible * no hierarchy (no parent)
GENERIC tags are general purpose tags, that are used, if you can change tag name.
const char[] Tag::PLAIN
The PLAIN type has the following properties: * gid == displayName * immutable * no hierarchy (no parent)
PLAIN tags are general purpose tags that are easy to map by backends.