akonadi
#include <attributeentity.h>

Public Types | |
enum | CreateOption { AddIfMissing } |
Public Member Functions | |
AttributeEntity (const AttributeEntity &other) | |
void | addAttribute (Attribute *attribute) |
template<typename T > | |
T * | attribute () const |
Attribute * | attribute (const QByteArray &name) const |
template<typename T > | |
T * | attribute (CreateOption option) |
Attribute::List | attributes () const |
void | clearAttributes () |
template<typename T > | |
bool | hasAttribute () const |
bool | hasAttribute (const QByteArray &name) const |
virtual AttributeEntity & | operator= (const AttributeEntity &other) |
template<typename T > | |
void | removeAttribute () |
void | removeAttribute (const QByteArray &name) |
Detailed Description
Parent class for entities that can have attributes.
This is supposed to eventually share the code between Akonadi::Tag and Akonadi::Entity.
In the current form using this in Akonadi::Entity would break the implicit sharing of it's private class, so AttributeEntity::Private would need to become a parent class of EntityPrivate and use the same clone() calls etc. An even better solution is probably ot make AttributeEntity a private member of Entity, with all Attribute related member functions forwarding to this class.
Definition at line 40 of file attributeentity.h.
Member Enumeration Documentation
◆ CreateOption
Describes the options that can be passed to access attributes.
Enumerator | |
---|---|
AddIfMissing | Creates the attribute if it is missing. |
Definition at line 91 of file attributeentity.h.
Constructor & Destructor Documentation
◆ AttributeEntity() [1/2]
AttributeEntity::AttributeEntity | ( | ) |
Definition at line 47 of file attributeentity.cpp.
◆ AttributeEntity() [2/2]
AttributeEntity::AttributeEntity | ( | const AttributeEntity & | other | ) |
Definition at line 53 of file attributeentity.cpp.
◆ ~AttributeEntity()
|
virtual |
Definition at line 59 of file attributeentity.cpp.
Member Function Documentation
◆ addAttribute()
void AttributeEntity::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
-
attribute The new attribute.
- Note
- The entity takes the ownership of the attribute.
Definition at line 74 of file attributeentity.cpp.
◆ attribute() [1/3]
|
inline |
Returns the attribute of the requested type or 0 if it is not available.
Definition at line 124 of file attributeentity.h.
◆ attribute() [2/3]
Attribute * AttributeEntity::attribute | ( | const QByteArray & | name | ) | const |
Returns the attribute of the given type name
if available, 0 otherwise.
Definition at line 113 of file attributeentity.cpp.
◆ attribute() [3/3]
|
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
-
option The create options.
Definition at line 102 of file attributeentity.h.
◆ attributes()
Attribute::List AttributeEntity::attributes | ( | ) | const |
Returns a list of all attributes of the entity.
Definition at line 99 of file attributeentity.cpp.
◆ clearAttributes()
void Akonadi::AttributeEntity::clearAttributes | ( | ) |
Removes and deletes all attributes of the entity.
Definition at line 104 of file attributeentity.cpp.
◆ hasAttribute() [1/2]
|
inline |
Returns whether the entity has an attribute of the requested type.
Definition at line 151 of file attributeentity.h.
◆ hasAttribute() [2/2]
bool AttributeEntity::hasAttribute | ( | const QByteArray & | name | ) | const |
Returns true
if the entity has an attribute of the given type name
, false otherwise.
Definition at line 94 of file attributeentity.cpp.
◆ operator=()
|
virtual |
Definition at line 64 of file attributeentity.cpp.
◆ removeAttribute() [1/2]
|
inline |
Removes and deletes the attribute of the requested type.
Definition at line 142 of file attributeentity.h.
◆ removeAttribute() [2/2]
void AttributeEntity::removeAttribute | ( | const QByteArray & | name | ) |
Removes and deletes the attribute of the given type name
.
Definition at line 88 of file attributeentity.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.