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 Typedef Documentation

◆ Id

using Akonadi::Tag::Id = qint64

Definition at line 29 of file tag.h.

◆ List

Definition at line 28 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() [1/3]

Tag::Tag ( )

Definition at line 25 of file tag.cpp.

◆ Tag() [2/3]

Tag::Tag ( Tag::Id id)
explicit

Definition at line 30 of file tag.cpp.

◆ Tag() [3/3]

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/4]

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

◆ attribute() [2/4]

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

Definition at line 128 of file tag.cpp.

◆ attribute() [3/4]

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() [4/4]

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.

◆ fromUrl()

Tag Tag::fromUrl ( const QUrl & url)
static

Definition at line 71 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.

◆ gid()

QByteArray Tag::gid ( ) const

Definition at line 149 of file tag.cpp.

◆ hasAttribute() [1/2]

template<typename T >
bool Akonadi::Tag::hasAttribute ( ) const
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.

◆ isValid()

bool Tag::isValid ( ) const

Definition at line 202 of file tag.cpp.

◆ name()

QString Tag::name ( ) const

Definition at line 172 of file tag.cpp.

◆ operator!=()

bool Tag::operator!= ( const Tag & other) const

Definition at line 66 of file tag.cpp.

◆ operator==()

bool Tag::operator== ( const Tag & other) const

Definition at line 50 of file tag.cpp.

◆ parent()

Tag Tag::parent ( ) const

Definition at line 184 of file tag.cpp.

◆ remoteId()

QByteArray Tag::remoteId ( ) const

Definition at line 159 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.

◆ setGid()

void Tag::setGid ( const QByteArray & gid)

Definition at line 144 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.

◆ setName()

void Tag::setName ( const QString & name)

Definition at line 164 of file tag.cpp.

◆ setParent()

void Tag::setParent ( const Tag & parent)

Definition at line 179 of file tag.cpp.

◆ setRemoteId()

void Tag::setRemoteId ( const QByteArray & remoteId)

Definition at line 154 of file tag.cpp.

◆ setType()

void Tag::setType ( const QByteArray & type)

Definition at line 192 of file tag.cpp.

◆ type()

QByteArray Tag::type ( ) const

Definition at line 197 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-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.