22#include "collection.h"
33static void assignEntityPrivate(QSharedDataPointer<EntityPrivate> &one,
const QSharedDataPointer<EntityPrivate> &other)
49 QSharedDataPointer<EntityPrivate> temp = other;
55 assignEntityPrivate(d_ptr, other.d_ptr);
79 d_ptr->mRemoteId =
id;
84 return d_ptr->mRemoteId;
89 d_ptr->mRemoteRevision = revision;
94 return d_ptr->mRemoteRevision;
99 return (d_ptr->mId >= 0);
105 return (!
isValid() && !other.
isValid()) || (d_ptr->mId == other.d_ptr->mId);
110 return (
isValid() || other.
isValid()) && (d_ptr->mId != other.d_ptr->mId);
115 if (
this != &other) {
116 assignEntityPrivate(d_ptr, other.d_ptr);
124 return d_ptr->mId < other.d_ptr->mId;
130 Attribute *existing = d_ptr->mAttributes.value(attr->
type());
132 if (attr == existing) {
135 d_ptr->mAttributes.remove(attr->
type());
138 d_ptr->mAttributes.insert(attr->
type(), attr);
139 d_ptr->mDeletedAttributes.remove(attr->
type());
144 d_ptr->mDeletedAttributes.insert(type);
145 delete d_ptr->mAttributes.take(type);
150 return d_ptr->mAttributes.contains(type);
155 return d_ptr->mAttributes.values();
160 foreach (
Attribute *attr, d_ptr->mAttributes) {
161 d_ptr->mDeletedAttributes.insert(attr->
type());
164 d_ptr->mAttributes.clear();
169 return d_ptr->mAttributes.value(type);
174 return qHash(entity.
id());
179 if (!d_ptr->mParent) {
182 return *(d_ptr->mParent);
187 if (!d_ptr->mParent) {
188 return *(s_defaultParentCollection);
190 return *(d_ptr->mParent);
196 delete d_ptr->mParent;
200AKONADI_DEFINE_PRIVATE(
Entity)
Provides interface for custom attributes for Entity.
QList< Attribute * > List
Describes a list of attributes.
virtual QByteArray type() const =0
Returns the type of the attribute.
Represents a collection of PIM items.
The base class for Item and Collection.
QString remoteId() const
Returns the remote id of the entity.
bool operator<(const Entity &other) const
QString remoteRevision() const
Returns the remote revision of the entity.
void clearAttributes()
Removes and deletes all attributes of the entity.
Collection parentCollection() const
Returns the parent collection of this object.
Attribute::List attributes() const
Returns a list of all attributes of the entity.
bool isValid() const
Returns whether the entity is valid.
Entity(const Entity &other)
Creates an entity from an other entity.
void setId(Id identifier)
Sets the unique identifier of the entity.
void removeAttribute()
Removes and deletes the attribute of the requested type.
T * attribute() const
Returns the attribute of the requested type or 0 if it is not available.
bool operator==(const Entity &other) const
Returns whether the entity's id equals the id of the other entity.
void setParentCollection(const Collection &parent)
Set the parent collection of this object.
Id id() const
Returns the unique identifier of the entity.
bool operator!=(const Entity &other) const
Returns whether the entity's id does not equal the id of the other entity.
void setRemoteRevision(const QString &revision)
Sets the remote revision of the entity.
~Entity()
Destroys the entity.
bool hasAttribute() const
Returns whether the entity has an attribute of the requested type.
qint64 Id
Describes the unique id type.
void addAttribute(Attribute *attribute)
Adds an attribute to the entity.
void setRemoteId(const QString &id)
Sets the remote id of the entity.
FreeBusyManager::Singleton.