Akonadi::Tag

#include <tag.h>

Public Types

enum  CreateOption { AddIfMissing, DontCreate }
 
typedef qint64 Id
 
typedef QVector< TagList
 

Public Member Functions

 Tag (Id id)
 
 Tag (const QString &name)
 
 Tag (const Tag &)
 
 Tag (Tag &&) noexcept
 
void addAttribute (Attribute *attribute)
 
const Attributeattribute (const QByteArray &name) const
 
Attributeattribute (const QByteArray &name)
 
template<typename T >
T * attribute (CreateOption option=DontCreate)
 
template<typename T >
const T * attribute () const
 
Attribute::List attributes () const
 
void clearAttributes ()
 
QByteArray gid () const
 
bool hasAttribute (const QByteArray &name) const
 
template<typename T >
bool hasAttribute () const
 
Id id () const
 
bool isImmutable () const
 
bool isValid () const
 
QString name () const
 
bool operator!= (const Tag &) const
 
Tagoperator= (const Tag &)
 
Tagoperator= (Tag &&) noexcept
 
bool operator== (const Tag &) const
 
Tag parent () const
 
QByteArray remoteId () const
 
void removeAttribute (const QByteArray &name)
 
template<typename T >
void removeAttribute ()
 
void setGid (const QByteArray &gid)
 
void setId (Id identifier)
 
void setName (const QString &name)
 
void setParent (const Tag &parent)
 
void setRemoteId (const QByteArray &remoteId)
 
void setType (const QByteArray &type)
 
QByteArray type () const
 
QUrl url () const
 

Static Public Member Functions

static Tag fromUrl (const QUrl &url)
 
static Tag genericTag (const QString &name)
 

Static Public Attributes

static const char GENERIC [] = "GENERIC"
 
static const char PLAIN [] = "PLAIN"
 

Detailed Description

An Akonadi Tag.

Definition at line 26 of file tag.h.

Member Enumeration Documentation

Describes the options that can be passed to access attributes.

Enumerator
AddIfMissing 

Creates the attribute if it is missing.

DontCreate 

Does not create an attribute if it is missing (default)

Definition at line 115 of file tag.h.

Constructor & Destructor Documentation

Tag::Tag ( const QString name)
explicit

Creates a PLAIN tag.

Definition at line 36 of file tag.cpp.

Member Function Documentation

void Tag::addAttribute ( 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.

Parameters
attributeThe new attribute.
Note
The entity takes the ownership of the attribute.

Definition at line 98 of file tag.cpp.

const Attribute * Tag::attribute ( const QByteArray name) const

Returns the attribute of the given type name if available, 0 otherwise.

Definition at line 123 of file tag.cpp.

template<typename T >
T * Akonadi::Tag::attribute ( CreateOption  option = DontCreate)
inline

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.

Parameters
optionThe create options.

Definition at line 207 of file tag.h.

template<typename T >
const T * Akonadi::Tag::attribute ( ) const
inline

Returns the attribute of the requested type or 0 if it is not available.

Definition at line 226 of file tag.h.

Attribute::List Tag::attributes ( ) const

Returns a list of all attributes of the entity.

Definition at line 113 of file tag.cpp.

void Tag::clearAttributes ( )

Removes and deletes all attributes of the entity.

Definition at line 118 of file tag.cpp.

Tag Tag::genericTag ( const QString name)
static

Returns a GENERIC tag with the given name and a valid gid.

Definition at line 219 of file tag.cpp.

bool Tag::hasAttribute ( const QByteArray name) const

Returns true if the entity has an attribute of the given type name, false otherwise.

Definition at line 108 of file tag.cpp.

template<typename T >
bool Akonadi::Tag::hasAttribute ( ) const
inline

Returns whether the entity has an attribute of the requested type.

Definition at line 247 of file tag.h.

Tag::Id Tag::id ( ) const

Returns the unique identifier of the tag.

Definition at line 139 of file tag.cpp.

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.

Definition at line 207 of file tag.cpp.

void Tag::removeAttribute ( const QByteArray name)

Removes and deletes the attribute of the given type name.

Definition at line 103 of file tag.cpp.

template<typename T >
void Akonadi::Tag::removeAttribute ( )
inline

Removes and deletes the attribute of the requested type.

Definition at line 240 of file tag.h.

void Tag::setId ( Tag::Id  identifier)

Sets the unique identifier of the tag.

Definition at line 134 of file tag.cpp.

QUrl Tag::url ( ) const

Returns the url of the tag.

Definition at line 87 of file tag.cpp.

Member Data Documentation

const char Akonadi::Tag::GENERIC = "GENERIC"
static

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.

Definition at line 50 of file tag.h.

const char Akonadi::Tag::PLAIN = "PLAIN"
static

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.

Definition at line 40 of file tag.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 23:17:34 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.