• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • akonadi
entity_p.h
1/*
2 Copyright (c) 2008 Tobias Koenig <tokoe@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef ENTITY_P_H
21#define ENTITY_P_H
22
23#include "entity.h"
24#include "collection.h"
25
26#include <QtCore/QSet>
27#include <QtCore/QSharedData>
28#include <QtCore/QString>
29
30#define AKONADI_DEFINE_PRIVATE( Class ) \
31Class##Private *Class ::d_func() { return reinterpret_cast<Class##Private *>( d_ptr.data() ); } \
32const Class##Private *Class ::d_func() const { return reinterpret_cast<const Class##Private *>( d_ptr.data() ); }
33
34namespace Akonadi {
35
39class EntityPrivate : public QSharedData
40{
41public:
42 explicit EntityPrivate(Entity::Id id = -1)
43 : mId(id)
44 , mParent(0)
45 {
46 }
47
48 virtual ~EntityPrivate()
49 {
50 qDeleteAll(mAttributes);
51 delete mParent;
52 }
53
54 EntityPrivate(const EntityPrivate &other)
55 : QSharedData(other)
56 , mParent(0)
57 {
58 mId = other.mId;
59 mRemoteId = other.mRemoteId;
60 mRemoteRevision = other.mRemoteRevision;
61 foreach (Attribute *attr, other.mAttributes) {
62 mAttributes.insert(attr->type(), attr->clone());
63 }
64 mDeletedAttributes = other.mDeletedAttributes;
65 if (other.mParent) {
66 mParent = new Collection(*(other.mParent));
67 }
68 }
69
70 virtual void resetChangeLog()
71 {
72 mDeletedAttributes.clear();
73 }
74
75 virtual EntityPrivate *clone() const = 0;
76
77 Entity::Id mId;
78 QString mRemoteId;
79 QString mRemoteRevision;
80 QHash<QByteArray, Attribute *> mAttributes;
81 QSet<QByteArray> mDeletedAttributes;
82 mutable Collection *mParent;
83};
84
85}
86
94template <>
95Q_INLINE_TEMPLATE Akonadi::EntityPrivate *QSharedDataPointer<Akonadi::EntityPrivate>::clone()
96{
97 return d->clone();
98}
99
100#endif
Akonadi::Attribute
Provides interface for custom attributes for Entity.
Definition attribute.h:139
Akonadi::Attribute::clone
virtual Attribute * clone() const =0
Creates a copy of this attribute.
Akonadi::Attribute::type
virtual QByteArray type() const =0
Returns the type of the attribute.
Akonadi::Collection
Represents a collection of PIM items.
Definition collection.h:76
Akonadi::EntityPrivate
Definition entity_p.h:40
Akonadi::Entity::Id
qint64 Id
Describes the unique id type.
Definition entity.h:65
Akonadi
FreeBusyManager::Singleton.
Definition actionstatemanager_p.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal