ekiga r5926 - in trunk/lib/engine: addressbook/call-history addressbook/evolution addressbook/ldap addressbook/skel framework presence/avahi presence/local-roster presence/skel



Author: jpuydt
Date: Sun Jan 20 16:00:17 2008
New Revision: 5926
URL: http://svn.gnome.org/viewvc/ekiga?rev=5926&view=rev

Log:
Made the rest of the code follow Lister's modification

Modified:
   trunk/lib/engine/addressbook/call-history/history-book.h
   trunk/lib/engine/addressbook/evolution/evolution-book.h
   trunk/lib/engine/addressbook/ldap/ldap-book.h
   trunk/lib/engine/addressbook/skel/book-impl.h
   trunk/lib/engine/framework/lister.h
   trunk/lib/engine/presence/avahi/avahi-heap.h
   trunk/lib/engine/presence/local-roster/local-heap.h
   trunk/lib/engine/presence/skel/heap-impl.h

Modified: trunk/lib/engine/addressbook/call-history/history-book.h
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-book.h	(original)
+++ trunk/lib/engine/addressbook/call-history/history-book.h	Sun Jan 20 16:00:17 2008
@@ -51,7 +51,7 @@
  */
 
   class Book
-    : public Ekiga::BookImpl<Contact, Ekiga::delete_object_management <Contact> >
+    : public Ekiga::BookImpl<Contact>
   {
   public:
 

Modified: trunk/lib/engine/addressbook/evolution/evolution-book.h
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-book.h	(original)
+++ trunk/lib/engine/addressbook/evolution/evolution-book.h	Sun Jan 20 16:00:17 2008
@@ -57,7 +57,7 @@
  */
 
   class Book:
-    public Ekiga::BookImpl<Contact, Ekiga::delete_object_management<Contact> >
+    public Ekiga::BookImpl<Contact>
   {
   public:
 

Modified: trunk/lib/engine/addressbook/ldap/ldap-book.h
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-book.h	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-book.h	Sun Jan 20 16:00:17 2008
@@ -57,7 +57,7 @@
  */
 
   class Book:
-    public Ekiga::BookImpl<Contact, Ekiga::delete_object_management<Contact> >
+    public Ekiga::BookImpl<Contact>
   {
   public:
 

Modified: trunk/lib/engine/addressbook/skel/book-impl.h
==============================================================================
--- trunk/lib/engine/addressbook/skel/book-impl.h	(original)
+++ trunk/lib/engine/addressbook/skel/book-impl.h	Sun Jan 20 16:00:17 2008
@@ -56,12 +56,6 @@
    * addressbook: it will take care of implementing the external api, you
    * just have to decide when to add and remove contacts.
    *
-   * It also provides basic memory management for Contacts, with the second
-   * (optional) template argument:
-   *  - either no management (the default);
-   *  - or the contact is considered bound to one Ekiga::Book, which will
-   *    trigger its destruction (using delete) when removed from it.
-   *
    * You can remove a Contact from an Ekiga::Book in two ways:
    *  - either by calling the remove_contact method,
    *  - or by emission of the contact's removed signal.
@@ -76,17 +70,16 @@
    *    calling the appropriate api function to delete the contact in your
    *    backend.
    */
-  template<typename ContactType = Contact,
-	   typename ObjectManagementTrait = delete_object_management<ContactType> >
+  template<typename ContactType = Contact>
   class BookImpl:
     public Book,
-    protected Lister<ContactType, ObjectManagementTrait>
+    protected Lister<ContactType>
   {
 
   public:
 
-    typedef typename Lister<ContactType, ObjectManagementTrait>::iterator iterator;
-    typedef typename Lister<ContactType, ObjectManagementTrait>::const_iterator const_iterator;
+    typedef typename Lister<ContactType>::iterator iterator;
+    typedef typename Lister<ContactType>::const_iterator const_iterator;
 
     /** The constructor
      */
@@ -125,8 +118,7 @@
     /** Removes a contact from the Ekiga::Book.
      * @param: The contact to be removed.
      * @return: The Ekiga::Book 'contact_removed' signal is emitted when the contact
-     * has been removed. The ContactManagementTrait associated with the Ekiga::Book
-     * will determine the memory management policy for that contact.
+     * has been removed.
      */
     void remove_contact (ContactType &contact);
 
@@ -151,83 +143,83 @@
 
 /* here begins the code from the template functions */
 
-template<typename ContactType, typename ContactManagementTrait>
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::BookImpl ()
+template<typename ContactType>
+Ekiga::BookImpl<ContactType>::BookImpl ()
 {
   /* this is signal forwarding */
-  Lister<ContactType,ContactManagementTrait>::object_added.connect (contact_added.make_slot ());
-  Lister<ContactType,ContactManagementTrait>::object_removed.connect (contact_removed.make_slot ());
-  Lister<ContactType,ContactManagementTrait>::object_updated.connect (contact_updated.make_slot ());
+  Lister<ContactType>::object_added.connect (contact_added.make_slot ());
+  Lister<ContactType>::object_removed.connect (contact_removed.make_slot ());
+  Lister<ContactType>::object_updated.connect (contact_updated.make_slot ());
 }
 
 
-template<typename ContactType, typename ContactManagementTrait>
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::~BookImpl ()
+template<typename ContactType>
+Ekiga::BookImpl<ContactType>::~BookImpl ()
 {
 }
 
 
-template<typename ContactType, typename ContactManagementTrait>
+template<typename ContactType>
 void
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::visit_contacts (sigc::slot<void, Contact &> visitor)
+Ekiga::BookImpl<ContactType>::visit_contacts (sigc::slot<void, Contact &> visitor)
 {
   for (iterator iter = begin (); iter != end (); iter++)
     visitor (*iter);
 }
 
 
-template<typename ContactType, typename ContactManagementTrait>
-typename Ekiga::BookImpl<ContactType, ContactManagementTrait>::iterator
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::begin ()
+template<typename ContactType>
+typename Ekiga::BookImpl<ContactType>::iterator
+Ekiga::BookImpl<ContactType>::begin ()
 {
-  return Lister<ContactType, ContactManagementTrait>::begin ();
+  return Lister<ContactType>::begin ();
 }
 
 
-template<typename ContactType, typename ContactManagementTrait>
-typename Ekiga::BookImpl<ContactType, ContactManagementTrait>::iterator
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::end ()
+template<typename ContactType>
+typename Ekiga::BookImpl<ContactType>::iterator
+Ekiga::BookImpl<ContactType>::end ()
 {
-  return Lister<ContactType, ContactManagementTrait>::end ();
+  return Lister<ContactType>::end ();
 }
 
 
-template<typename ContactType, typename ContactManagementTrait>
-typename Ekiga::BookImpl<ContactType, ContactManagementTrait>::const_iterator
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::begin () const
+template<typename ContactType>
+typename Ekiga::BookImpl<ContactType>::const_iterator
+Ekiga::BookImpl<ContactType>::begin () const
 {
-  return Lister<ContactType, ContactManagementTrait>::begin ();
+  return Lister<ContactType>::begin ();
 }
 
 
-template<typename ContactType, typename ContactManagementTrait>
-typename Ekiga::BookImpl<ContactType, ContactManagementTrait>::const_iterator
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::end () const
+template<typename ContactType>
+typename Ekiga::BookImpl<ContactType>::const_iterator
+Ekiga::BookImpl<ContactType>::end () const
 {
-  return Lister<ContactType, ContactManagementTrait>::end ();
+  return Lister<ContactType>::end ();
 }
 
 
-template<typename ContactType, typename ContactManagementTrait>
+template<typename ContactType>
 void
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::add_contact (ContactType &contact)
+Ekiga::BookImpl<ContactType>::add_contact (ContactType &contact)
 {
   contact.questions.add_handler (questions.make_slot ());
   add_object (contact);
 }
 
 
-template<typename ContactType, typename ContactManagementTrait>
+template<typename ContactType>
 void
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::remove_contact (ContactType &contact)
+Ekiga::BookImpl<ContactType>::remove_contact (ContactType &contact)
 {
   remove_object (contact);
 }
 
 
-template<typename ContactType, typename ContactManagementTrait>
+template<typename ContactType>
 std::string
-Ekiga::BookImpl<ContactType, ContactManagementTrait>::get_status ()
+Ekiga::BookImpl<ContactType>::get_status ()
 {
   return status;
 }

Modified: trunk/lib/engine/framework/lister.h
==============================================================================
--- trunk/lib/engine/framework/lister.h	(original)
+++ trunk/lib/engine/framework/lister.h	Sun Jan 20 16:00:17 2008
@@ -43,28 +43,12 @@
 
 namespace Ekiga
 {
-
-  template<typename ObjectType>
-  struct delete_object_management
-  {
-    static void announced_release (ObjectType &object);
-
-    static void release (ObjectType &object);
-
-  };
-
   /** Ekiga::Lister
    *
    * This class is there to help write a dynamic object lister, that is an
-   * object which will more or less 'own' objects which will emit "updated"
+   * object which will own objects which will emit "updated"
    * and "removed" signals.
    *
-   * The more or less means that it supports different memory management
-   * traits using the second (optional) template argument:
-   *  - either no management (the default);
-   *  - or the object is considered fully owned, which will trigger its
-   *    destruction (using delete) when removed.
-   *
    * You can remove an object from an Ekiga::Lister in two ways:
    *  - either by calling the remove_object method,
    *  - or by emission of the object's removed signal.
@@ -79,8 +63,7 @@
    *    calling the appropriate api function to delete the object in your
    *    backend.
    */
-  template<typename ObjectType,
-	   typename ObjectManagementTrait = delete_object_management<ObjectType> >
+  template<typename ObjectType>
   class Lister
   {
 
@@ -132,9 +115,7 @@
     /** Removes an object from the Ekiga::Lister.
      * @param: The object to be removed.
      * @return: The Ekiga::Lister 'object_removed' signal is emitted when
-     * the object has been removed. The ObjectManagementTrait associated
-     * with the Ekiga::Lister will determine the memory management policy
-     * for that object.
+     * the object has been removed.
      */
     void remove_object (ObjectType &object);
 
@@ -157,8 +138,7 @@
 
     /** Disconnects the signals for the object, emits the 'object_removed'
      * signal on the Ekiga::Lister and takes care of the release of that
-     * object following the policy of the ObjectManagementTrait associated
-     * with the Ekiga::Lister.
+     * object.
      * @param: The object to remove.
      */
     void common_removal_steps (ObjectType &object);
@@ -175,8 +155,7 @@
     /** This callback is triggered when the 'removed' signal is emitted on
      * an object.
      * Emits the Ekiga::Lister 'object_removed' signal for that object and
-     * takes care of the deletion of the object or not following the
-     * ObjectManagementTrait associated with the Ekiga::Lister.
+     * takes care of the deletion of the object.
      * @param: The removed object.
      */
     void on_object_removed (ObjectType *object);
@@ -190,25 +169,9 @@
 
 /* here begins the code from the template functions */
 
-template<typename ObjectType>
-void
-Ekiga::delete_object_management<ObjectType>::announced_release (ObjectType &object)
-{
-  object.removed.emit ();
-  release (object);
-}
-
 
 template<typename ObjectType>
-void
-Ekiga::delete_object_management<ObjectType>::release (ObjectType &object)
-{
-  delete &object;
-}
-
-
-template<typename ObjectType, typename ObjectManagementTrait>
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::~Lister ()
+Ekiga::Lister<ObjectType>::~Lister ()
 {
   iterator iter = begin ();
 
@@ -220,41 +183,41 @@
 }
 
 
-template<typename ObjectType, typename ObjectManagementTrait>
-typename Ekiga::Lister<ObjectType, ObjectManagementTrait>::const_iterator
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::begin () const
+template<typename ObjectType>
+typename Ekiga::Lister<ObjectType>::const_iterator
+Ekiga::Lister<ObjectType>::begin () const
 {
   return const_iterator (connections.begin ());
 }
 
 
-template<typename ObjectType, typename ObjectManagementTrait>
-typename Ekiga::Lister<ObjectType, ObjectManagementTrait>::iterator
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::begin ()
+template<typename ObjectType>
+typename Ekiga::Lister<ObjectType>::iterator
+Ekiga::Lister<ObjectType>::begin ()
 {
   return iterator (connections.begin ());
 }
 
 
-template<typename ObjectType, typename ObjectManagementTrait>
-typename Ekiga::Lister<ObjectType, ObjectManagementTrait>::const_iterator
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::end () const
+template<typename ObjectType>
+typename Ekiga::Lister<ObjectType>::const_iterator
+Ekiga::Lister<ObjectType>::end () const
 {
   return const_iterator (connections.end ());
 }
 
 
-template<typename ObjectType, typename ObjectManagementTrait>
-typename Ekiga::Lister<ObjectType, ObjectManagementTrait>::iterator
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::end ()
+template<typename ObjectType>
+typename Ekiga::Lister<ObjectType>::iterator
+Ekiga::Lister<ObjectType>::end ()
 {
   return iterator (connections.end ());
 }
 
 
-template<typename ObjectType, typename ObjectManagementTrait>
+template<typename ObjectType>
 void
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::add_object (ObjectType &object)
+Ekiga::Lister<ObjectType>::add_object (ObjectType &object)
 {
   sigc::connection conn;
 
@@ -266,24 +229,25 @@
 }
 
 
-template<typename ObjectType, typename ObjectManagementTrait>
+template<typename ObjectType>
 void
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::remove_object (ObjectType &object)
+Ekiga::Lister<ObjectType>::remove_object (ObjectType &object)
 {
   common_removal_steps (object);
-  ObjectManagementTrait::announced_release (object);
+  object.removed.emit ();
+  delete &object;
 }
 
-template<typename ObjectType, typename ObjectManagementTrait>
+template<typename ObjectType>
 void
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::add_connection (ObjectType &object, sigc::connection conn)
+Ekiga::Lister<ObjectType>::add_connection (ObjectType &object, sigc::connection conn)
 {
   connections[&object].push_front (conn);
 }
 
-template<typename ObjectType, typename ObjectManagementTrait>
+template<typename ObjectType>
 void
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::common_removal_steps (ObjectType &object)
+Ekiga::Lister<ObjectType>::common_removal_steps (ObjectType &object)
 {
   connection_set conns = connections[&object];
   for (connection_set::iterator iter = conns.begin ();
@@ -295,20 +259,20 @@
 }
 
 
-template<typename ObjectType, typename ObjectManagementTrait>
+template<typename ObjectType>
 void
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::on_object_updated (ObjectType *object)
+Ekiga::Lister<ObjectType>::on_object_updated (ObjectType *object)
 {
   object_updated.emit (*object);
 }
 
 
-template<typename ObjectType, typename ObjectManagementTrait>
+template<typename ObjectType>
 void
-Ekiga::Lister<ObjectType, ObjectManagementTrait>::on_object_removed (ObjectType *object)
+Ekiga::Lister<ObjectType>::on_object_removed (ObjectType *object)
 {
   common_removal_steps (*object);
-  ObjectManagementTrait::release (*object);
+  delete object;
 }
 
 #endif

Modified: trunk/lib/engine/presence/avahi/avahi-heap.h
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-heap.h	(original)
+++ trunk/lib/engine/presence/avahi/avahi-heap.h	Sun Jan 20 16:00:17 2008
@@ -57,7 +57,7 @@
  * @{
  */
 
-  class Heap: public Ekiga::HeapImpl<Presentity,Ekiga::delete_object_management<Presentity> >
+  class Heap: public Ekiga::HeapImpl<Presentity>
   {
   public:
 

Modified: trunk/lib/engine/presence/local-roster/local-heap.h
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-heap.h	(original)
+++ trunk/lib/engine/presence/local-roster/local-heap.h	Sun Jan 20 16:00:17 2008
@@ -64,7 +64,7 @@
    * When required, the Heap content is being saved in a GmConf entry.
    * Alternatively, it could be saved elsewhere.
    */
-  class Heap : public Ekiga::HeapImpl<Presentity, Ekiga::delete_object_management <Presentity> >
+  class Heap : public Ekiga::HeapImpl<Presentity>
   {
   public:
 

Modified: trunk/lib/engine/presence/skel/heap-impl.h
==============================================================================
--- trunk/lib/engine/presence/skel/heap-impl.h	(original)
+++ trunk/lib/engine/presence/skel/heap-impl.h	Sun Jan 20 16:00:17 2008
@@ -54,14 +54,6 @@
    * heap: it will take care of implementing the external api, you
    * just have to decide when to add and remove presentities.
    *
-   * It also provides basic memory management for presentities, with the second
-   * (optional) template argument:
-   *  - either no management (the default);
-   *  - or the presentity is considered bound to one heap, which will trigger
-   *    its destruction (using delete) when removed from it, which can happen
-   *    in two ways: either by calling the remove_presentity method, or by
-   *    emission of the presentity's removed signal.
-   *
    * Notice that this class won't take care of removing the presentity from a
    * backend -- only from the heap. If you want the presentity <b>deleted</b>
    * then you probably should have an organization like:
@@ -71,17 +63,16 @@
    *    calling the appropriate api function to delete the presentity in your
    *    backend.
    */
-  template<typename PresentityType = Presentity,
-	   typename ObjectManagementTrait = delete_object_management<PresentityType> >
+  template<typename PresentityType = Presentity>
   class HeapImpl:
     public Heap,
-    protected Lister<PresentityType, ObjectManagementTrait>
+    protected Lister<PresentityType>
   {
 
   public:
 
-    typedef typename Lister<PresentityType, ObjectManagementTrait>::iterator iterator;
-    typedef typename Lister<PresentityType, ObjectManagementTrait>::const_iterator const_iterator;
+    typedef typename Lister<PresentityType>::iterator iterator;
+    typedef typename Lister<PresentityType>::const_iterator const_iterator;
 
     HeapImpl ();
 
@@ -111,68 +102,68 @@
 };
 
 /* here are the implementations of the template methods */
-template<typename PresentityType, typename PresentityManagementTrait>
-Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::HeapImpl ()
+template<typename PresentityType>
+Ekiga::HeapImpl<PresentityType>::HeapImpl ()
 {
   /* this is signal forwarding */
-  Lister<PresentityType,PresentityManagementTrait>::object_added.connect (presentity_added.make_slot ());
-  Lister<PresentityType,PresentityManagementTrait>::object_removed.connect (presentity_removed.make_slot ());
-  Lister<PresentityType,PresentityManagementTrait>::object_updated.connect (presentity_updated.make_slot ());
+  Lister<PresentityType>::object_added.connect (presentity_added.make_slot ());
+  Lister<PresentityType>::object_removed.connect (presentity_removed.make_slot ());
+  Lister<PresentityType>::object_updated.connect (presentity_updated.make_slot ());
 }
 
 
-template<typename PresentityType, typename PresentityManagementTrait>
-Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::~HeapImpl ()
+template<typename PresentityType>
+Ekiga::HeapImpl<PresentityType>::~HeapImpl ()
 {
 }
 
-template<typename PresentityType, typename PresentityManagementTrait>
+template<typename PresentityType>
 void
-Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::visit_presentities (sigc::slot<void, Presentity &> visitor)
+Ekiga::HeapImpl<PresentityType>::visit_presentities (sigc::slot<void, Presentity &> visitor)
 {
   for (iterator iter = begin (); iter != end (); iter++)
     visitor (*iter);
 }
 
-template<typename PresentityType, typename PresentityManagementTrait>
-typename Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::iterator
-Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::begin ()
+template<typename PresentityType>
+typename Ekiga::HeapImpl<PresentityType>::iterator
+Ekiga::HeapImpl<PresentityType>::begin ()
 {
-  return Lister<PresentityType, PresentityManagementTrait>::begin ();
+  return Lister<PresentityType>::begin ();
 }
 
-template<typename PresentityType, typename PresentityManagementTrait>
-typename Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::iterator
-Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::end ()
+template<typename PresentityType>
+typename Ekiga::HeapImpl<PresentityType>::iterator
+Ekiga::HeapImpl<PresentityType>::end ()
 {
-  return Lister<PresentityType, PresentityManagementTrait>::end ();
+  return Lister<PresentityType>::end ();
 }
 
-template<typename PresentityType, typename PresentityManagementTrait>
-typename Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::const_iterator
-Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::begin () const
+template<typename PresentityType>
+typename Ekiga::HeapImpl<PresentityType>::const_iterator
+Ekiga::HeapImpl<PresentityType>::begin () const
 {
-  return Lister<PresentityType, PresentityManagementTrait>::begin ();
+  return Lister<PresentityType>::begin ();
 }
 
-template<typename PresentityType, typename PresentityManagementTrait>
-typename Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::const_iterator
-Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::end () const
+template<typename PresentityType>
+typename Ekiga::HeapImpl<PresentityType>::const_iterator
+Ekiga::HeapImpl<PresentityType>::end () const
 {
-  return Lister<PresentityType, PresentityManagementTrait>::end ();
+  return Lister<PresentityType>::end ();
 }
 
-template<typename PresentityType, typename PresentityManagementTrait>
+template<typename PresentityType>
 void
-Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::add_presentity (PresentityType &presentity)
+Ekiga::HeapImpl<PresentityType>::add_presentity (PresentityType &presentity)
 {
   presentity.questions.add_handler (questions.make_slot ());
   add_object (presentity);
 }
 
-template<typename PresentityType, typename PresentityManagementTrait>
+template<typename PresentityType>
 void
-Ekiga::HeapImpl<PresentityType, PresentityManagementTrait>::remove_presentity (PresentityType &presentity)
+Ekiga::HeapImpl<PresentityType>::remove_presentity (PresentityType &presentity)
 {
   remove_object (presentity);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]