[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepimlibs/akonadi
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2008-03-21 21:57:38
Message-ID: 1206136658.974911.20365.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 788587 by tokoe:

* Made ctors protected
* Add d_func() methods


 M  +13 -8     entity.cpp  
 M  +31 -17    entity.h  


--- trunk/KDE/kdepimlibs/akonadi/entity.cpp #788586:788587
@@ -24,22 +24,22 @@
 using namespace Akonadi;
 
 Entity::Entity()
-  : d( new EntityPrivate )
+  : d_ptr( new EntityPrivate )
 {
 }
 
 Entity::Entity( Id id )
-  : d( new EntityPrivate( id ) )
+  : d_ptr( new EntityPrivate( id ) )
 {
 }
 
 Entity::Entity( const Entity &other )
-  : d( other.d )
+  : d_ptr( other.d_ptr )
 {
 }
 
 Entity::Entity( EntityPrivate *dd )
-  : d( dd )
+  : d_ptr( dd )
 {
 }
 
@@ -49,23 +49,28 @@
 
 Entity::Id Entity::id() const
 {
-  return d->mId;
+  return d_ptr->mId;
 }
 
 void Entity::setRemoteId( const QString& id )
 {
-  d->mRemoteId = id;
+  d_ptr->mRemoteId = id;
 }
 
 QString Entity::remoteId() const
 {
-  return d->mRemoteId;
+  return d_ptr->mRemoteId;
 }
 
 Entity& Entity::operator=( const Entity &other )
 {
   if ( this != &other )
-    d = other.d;
+    d_ptr = other.d_ptr;
 
   return *this;
 }
+
+uint qHash( const Akonadi::Entity &entity )
+{
+  return qHash( entity.id() );
+}
--- trunk/KDE/kdepimlibs/akonadi/entity.h #788586:788587
@@ -20,9 +20,21 @@
 #ifndef AKONADI_ENTITY_H
 #define AKONADI_ENTITY_H
 
+#include "akonadi_export.h"
+
+namespace Akonadi {
+class Entity;
+}
+
+AKONADI_EXPORT uint qHash( const Akonadi::Entity& );
+
+#include <QtCore/QHash>
 #include <QtCore/QSharedDataPointer>
 
-#include "akonadi_export.h"
+#define AKONADI_DECLARE_PRIVATE( Class ) \
+    inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>( \
d_ptr.data() ); } \ +    inline const Class##Private* d_func() const { return \
reinterpret_cast<const Class##Private *>( d_ptr.data() ); } \ +    friend class \
Class##Private;  
 namespace Akonadi {
 
@@ -37,21 +49,6 @@
     typedef qint64 Id;
 
     /**
-     * Creates an invalid entity.
-     */
-    Entity();
-
-    /**
-     * Creates an entity with the given unique @p id.
-     */
-    Entity( Id id );
-
-    /**
-     * Creates an entity from an @p other entity.
-     */
-    Entity( const Entity &other );
-
-    /**
      * Destroys the entity.
      */
     ~Entity();
@@ -77,10 +74,27 @@
     Entity& operator=( const Entity &other );
 
   protected:
+    /**
+     * Creates an invalid entity.
+     */
+    Entity();
+
+    /**
+     * Creates an entity with the given unique @p id.
+     */
+    Entity( Id id );
+
+    /**
+     * Creates an entity from an @p other entity.
+     */
+    Entity( const Entity &other );
+
     //@cond PRIVATE
     Entity( EntityPrivate *dd );
-    QSharedDataPointer<EntityPrivate> d;
+    QSharedDataPointer<EntityPrivate> d_ptr;
     //@endcond
+
+    AKONADI_DECLARE_PRIVATE( Entity )
 };
 
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic