akonadi
#include <attributeentity.h>
Public Types | |
enum | CreateOption { AddIfMissing } |
Public Member Functions | |
AttributeEntity (const AttributeEntity &other) | |
void | addAttribute (Attribute *attribute) |
Attribute * | attribute (const QByteArray &name) const |
template<typename T > | |
T * | attribute (CreateOption option) |
template<typename T > | |
T * | attribute () const |
Attribute::List | attributes () const |
void | clearAttributes () |
bool | hasAttribute (const QByteArray &name) const |
template<typename T > | |
bool | hasAttribute () const |
virtual AttributeEntity & | operator= (const AttributeEntity &other) |
void | removeAttribute (const QByteArray &name) |
template<typename T > | |
void | removeAttribute () |
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
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.
Member Function Documentation
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 * 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.
|
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.
|
inline |
Returns the attribute of the requested type or 0 if it is not available.
Definition at line 124 of file attributeentity.h.
Attribute::List AttributeEntity::attributes | ( | ) | const |
Returns a list of all attributes of the entity.
Definition at line 99 of file attributeentity.cpp.
void Akonadi::AttributeEntity::clearAttributes | ( | ) |
Removes and deletes all attributes of the entity.
Definition at line 104 of file attributeentity.cpp.
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.
|
inline |
Returns whether the entity has an attribute of the requested type.
Definition at line 151 of file attributeentity.h.
void AttributeEntity::removeAttribute | ( | const QByteArray & | name | ) |
Removes and deletes the attribute of the given type name
.
Definition at line 88 of file attributeentity.cpp.
|
inline |
Removes and deletes the attribute of the requested type.
Definition at line 142 of file attributeentity.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:04 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.