[ekiga] Used boost::ref with several helpers



commit af4654799e6b97a9b8507062d21907eb50921f59
Author: Julien Puydt <jpuydt gnome org>
Date:   Sun Jun 6 17:05:16 2010 +0200

    Used boost::ref with several helpers
    
    It makes the helper less copied, hence less memory use.

 lib/engine/components/local-roster/local-heap.cpp |   20 ++++++++++----------
 plugins/evolution/evolution-book.cpp              |    8 ++++----
 plugins/evolution/evolution-source.cpp            |    4 ++--
 plugins/loudmouth/loudmouth-dialect.cpp           |    4 ++--
 4 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/lib/engine/components/local-roster/local-heap.cpp b/lib/engine/components/local-roster/local-heap.cpp
index 309fd0b..a5089f2 100644
--- a/lib/engine/components/local-roster/local-heap.cpp
+++ b/lib/engine/components/local-roster/local-heap.cpp
@@ -139,7 +139,7 @@ struct has_presentity_with_uri_helper
 
   bool found;
 
-  bool test (Ekiga::PresentityPtr pres)
+  bool operator() (Ekiga::PresentityPtr pres)
   {
     Local::PresentityPtr presentity = boost::dynamic_pointer_cast<Local::Presentity> (pres);
     if (presentity && presentity->get_uri () == uri) {
@@ -156,7 +156,7 @@ Local::Heap::has_presentity_with_uri (const std::string uri)
 {
   has_presentity_with_uri_helper helper(uri);
 
-  visit_presentities (boost::bind (&has_presentity_with_uri_helper::test, helper, _1));
+  visit_presentities (boost::ref (helper));
 
   return helper.found;
 }
@@ -165,7 +165,7 @@ struct existing_groups_helper
 {
   std::set<std::string> groups;
 
-  bool test (Ekiga::PresentityPtr pres)
+  bool operator() (Ekiga::PresentityPtr pres)
   {
     Local::PresentityPtr presentity = boost::dynamic_pointer_cast<Local::Presentity> (pres);
 
@@ -189,7 +189,7 @@ Local::Heap::existing_groups ()
   {
     existing_groups_helper helper;
 
-    visit_presentities (boost::bind (&existing_groups_helper::test, helper, _1));
+    visit_presentities (boost::ref (helper));
     result = helper.groups;
   }
 
@@ -261,7 +261,7 @@ struct push_presence_helper
 						      presence(presence_)
   {}
 
-  bool test (Ekiga::PresentityPtr pres_)
+  bool operator() (Ekiga::PresentityPtr pres_)
   {
     Local::PresentityPtr presentity = boost::dynamic_pointer_cast<Local::Presentity> (pres_);
     if (presentity && presentity->get_uri () == uri) {
@@ -282,7 +282,7 @@ Local::Heap::push_presence (const std::string uri,
 {
   push_presence_helper helper(uri, presence);
 
-  visit_presentities (boost::bind (&push_presence_helper::test, helper, _1));
+  visit_presentities (boost::ref (helper));
 }
 
 struct push_status_helper
@@ -292,7 +292,7 @@ struct push_status_helper
 						  status(status_)
   {}
 
-  bool test (Ekiga::PresentityPtr pres_)
+  bool operator() (Ekiga::PresentityPtr pres_)
   {
     Local::PresentityPtr presentity = boost::dynamic_pointer_cast<Local::Presentity> (pres_);
     if (presentity && presentity->get_uri () == uri) {
@@ -313,7 +313,7 @@ Local::Heap::push_status (const std::string uri,
 {
   push_status_helper helper(uri, status);
 
-  visit_presentities (boost::bind (&push_status_helper::test, helper, _1));
+  visit_presentities (boost::ref (helper));
 }
 
 
@@ -440,7 +440,7 @@ struct rename_group_form_submitted_helper
   const std::string old_name;
   const std::string new_name;
 
-  bool rename_group (Ekiga::PresentityPtr pres)
+  bool operator() (Ekiga::PresentityPtr pres)
   {
     Local::PresentityPtr presentity = boost::dynamic_pointer_cast<Local::Presentity> (pres);
     if (presentity)
@@ -462,7 +462,7 @@ Local::Heap::rename_group_form_submitted (std::string old_name,
   if ( !new_name.empty () && new_name != old_name) {
 
     rename_group_form_submitted_helper helper (old_name, new_name);
-    visit_presentities (boost::bind (&rename_group_form_submitted_helper::rename_group, helper, _1));
+    visit_presentities (boost::ref (helper));
   }
 }
 
diff --git a/plugins/evolution/evolution-book.cpp b/plugins/evolution/evolution-book.cpp
index a824905..df0a376 100644
--- a/plugins/evolution/evolution-book.cpp
+++ b/plugins/evolution/evolution-book.cpp
@@ -105,7 +105,7 @@ public:
     }
   }
 
-  bool test (Ekiga::ContactPtr contact_)
+  bool operator() (Ekiga::ContactPtr contact_)
   {
     Evolution::ContactPtr contact = boost::dynamic_pointer_cast<Evolution::Contact> (contact_);
     bool result = true;
@@ -135,7 +135,7 @@ Evolution::Book::on_view_contacts_removed (GList *ids)
 {
   contacts_removed_helper helper (ids);
 
-  visit_contacts (boost::bind (&contacts_removed_helper::test, helper, _1));
+  visit_contacts (boost::ref (helper));
 }
 
 static void
@@ -155,7 +155,7 @@ public:
     id = (const gchar*)e_contact_get_const (econtact, E_CONTACT_UID);
   }
 
-  bool test (Ekiga::ContactPtr contact_)
+  bool operator() (Ekiga::ContactPtr contact_)
   {
     Evolution::ContactPtr contact = boost::dynamic_pointer_cast<Evolution::Contact> (contact_);
     bool result = true;
@@ -181,7 +181,7 @@ Evolution::Book::on_view_contacts_changed (GList *econtacts)
 
     contact_updated_helper helper (E_CONTACT (econtacts->data));
 
-    visit_contacts (boost::bind (&contact_updated_helper::test, helper, _1));
+    visit_contacts (boost::ref (helper));
   }
 }
 
diff --git a/plugins/evolution/evolution-source.cpp b/plugins/evolution/evolution-source.cpp
index aa439c5..618c31f 100644
--- a/plugins/evolution/evolution-source.cpp
+++ b/plugins/evolution/evolution-source.cpp
@@ -110,7 +110,7 @@ public :
   inline void ready ()
   { found = false; }
 
-  bool test (Ekiga::BookPtr book_)
+  bool operator() (Ekiga::BookPtr book_)
   {
     Evolution::BookPtr book = boost::dynamic_pointer_cast<Evolution::Book> (book_);
     if (book) {
@@ -145,7 +145,7 @@ Evolution::Source::remove_group (ESourceGroup *group)
   do {
 
     helper.ready ();
-    visit_books (boost::bind (&remove_helper::test, helper, _1));
+    visit_books (boost::ref (helper));
 
   } while (helper.has_found ());
 }
diff --git a/plugins/loudmouth/loudmouth-dialect.cpp b/plugins/loudmouth/loudmouth-dialect.cpp
index 50742f9..2cb1499 100644
--- a/plugins/loudmouth/loudmouth-dialect.cpp
+++ b/plugins/loudmouth/loudmouth-dialect.cpp
@@ -78,7 +78,7 @@ struct open_chat_helper
     presentity(presentity_)
   { }
 
-  bool test (Ekiga::SimpleChatPtr chat_) const
+  bool operator() (Ekiga::SimpleChatPtr chat_) const
   {
     LM::SimpleChatPtr chat = boost::dynamic_pointer_cast<LM::SimpleChat> (chat_);
     bool go_on = true;
@@ -106,7 +106,7 @@ LM::Dialect::open_chat (PresentityPtr presentity)
   } else {
 
     open_chat_helper helper(presentity);
-    visit_simple_chats (boost::bind (&open_chat_helper::test, helper, _1));
+    visit_simple_chats (boost::ref (helper));
   }
 }
 



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