Akonadi::Tag

Search for usage in LXR

#include <tag.h>

Public Types

enum  CreateOption { AddIfMissing, DontCreate }
 
using Id = qint64
 
using List = QList< Tag >
 

Public Member Functions

 Tag (const QString &name)
 
 Tag (const Tag &)
 
 Tag (Id id)
 
 Tag (Tag &&) noexcept
 
void addAttribute (Attribute *attribute)
 
template<typename T >
const T * attribute () const
 
Attributeattribute (const QByteArray &name)
 
const Attributeattribute (const QByteArray &name) const
 
template<typename T >
T * attribute (CreateOption option=DontCreate)
 
Attribute::List attributes () const
 
void clearAttributes ()
 
QByteArray gid () const
 
template<typename T >
bool hasAttribute () const
 
bool hasAttribute (const QByteArray &name) 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
 
template<typename T >
void removeAttribute ()
 
void removeAttribute (const QByteArray &name)
 
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 25 of file tag.h.

Member Enumeration Documentation

◆ CreateOption

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 114 of file tag.h.

Constructor & Destructor Documentation

◆ Tag()

Tag::Tag ( const QString name)
explicit

Creates a PLAIN tag.

Definition at line 36 of file tag.cpp.

Member Function Documentation

◆ addAttribute()

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.

◆ attribute() [1/3]

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

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

Definition at line 225 of file tag.h.

◆ attribute() [2/3]

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.

◆ attribute() [3/3]

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 206 of file tag.h.

◆ attributes()

Attribute::List Tag::attributes ( ) const

Returns a list of all attributes of the entity.

Definition at line 113 of file tag.cpp.

◆ clearAttributes()

void Tag::clearAttributes ( )

Removes and deletes all attributes of the entity.

Definition at line 118 of file tag.cpp.

◆ genericTag()

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.

◆ hasAttribute() [1/2]

template<typename T >
bool Akonadi::Tag::hasAttribute
inline

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

Definition at line 246 of file tag.h.

◆ hasAttribute() [2/2]

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.

◆ id()

Tag::Id Tag::id ( ) const

Returns the unique identifier of the tag.

Definition at line 139 of file tag.cpp.

◆ isImmutable()

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.

◆ removeAttribute() [1/2]

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

Removes and deletes the attribute of the requested type.

Definition at line 239 of file tag.h.

◆ removeAttribute() [2/2]

void Tag::removeAttribute ( const QByteArray name)

Removes and deletes the attribute of the given type name.

Definition at line 103 of file tag.cpp.

◆ setId()

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

Sets the unique identifier of the tag.

Definition at line 134 of file tag.cpp.

◆ url()

QUrl Tag::url ( ) const

Returns the url of the tag.

Definition at line 87 of file tag.cpp.

Member Data Documentation

◆ GENERIC

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 49 of file tag.h.

◆ PLAIN

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 39 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-2023 The KDE developers.
Generated on Thu Nov 30 2023 04:04:23 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.