[Orxonox-commit 2712] r7417 - in code/trunk/src: libraries/util modules/notifications orxonox/interfaces

rgrieder at orxonox.net rgrieder at orxonox.net
Sat Sep 11 20:30:17 CEST 2010


Author: rgrieder
Date: 2010-09-11 20:30:17 +0200 (Sat, 11 Sep 2010)
New Revision: 7417

Modified:
   code/trunk/src/libraries/util/StringUtils.h
   code/trunk/src/modules/notifications/NotificationManager.cc
   code/trunk/src/modules/notifications/NotificationQueue.cc
   code/trunk/src/modules/notifications/NotificationQueue.h
   code/trunk/src/orxonox/interfaces/NotificationListener.h
Log:
Removed StringCompare again.

Modified: code/trunk/src/libraries/util/StringUtils.h
===================================================================
--- code/trunk/src/libraries/util/StringUtils.h	2010-09-11 18:27:21 UTC (rev 7416)
+++ code/trunk/src/libraries/util/StringUtils.h	2010-09-11 18:30:17 UTC (rev 7417)
@@ -47,13 +47,6 @@
 {
     extern _UtilExport std::string BLANKSTRING;
 
-    //!< Struct that can be used as a comparison object for strings in stl containers.
-    _UtilExport struct StringCompare
-    {
-        bool operator() (const std::string& lhs, const std::string& rhs) const
-            { return lhs.compare(rhs) < 0; }
-    };
-
     _UtilExport std::string getUniqueNumberString();
 
     _UtilExport void         strip(std::string* str);

Modified: code/trunk/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.cc	2010-09-11 18:27:21 UTC (rev 7416)
+++ code/trunk/src/modules/notifications/NotificationManager.cc	2010-09-11 18:30:17 UTC (rev 7417)
@@ -128,7 +128,7 @@
         // Insert the Notification in all NotificationListeners that have its sender as target.
         for(std::map<NotificationListener*, unsigned int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) // Iterate through all NotificationListeners.
         {
-            std::set<std::string, StringCompare> set = it->first->getTargetsSet();
+            const std::set<std::string>& set = it->first->getTargetsSet();
             bool bAll = set.find(NotificationManager::ALL) != set.end();
             // If either the Notification has as sender 'all', the NotificationListener displays all Notifications or the NotificationListener has the sender of the Notification as target.
             if(all || bAll || set.find(notification->getSender()) != set.end())
@@ -209,7 +209,7 @@
 
         this->listenerList_[listener] = index; // Add the NotificationListener to the list of NotificationListeners.
 
-        std::set<std::string, StringCompare> set = listener->getTargetsSet();
+        const std::set<std::string>& set = listener->getTargetsSet();
 
         // If all senders are the target of the NotificationListener, then the list of Notifications for that specific NotificationListener is the same as the list of all Notifications.
         bool bAll = set.find(NotificationManager::ALL) != set.end();

Modified: code/trunk/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueue.cc	2010-09-11 18:27:21 UTC (rev 7416)
+++ code/trunk/src/modules/notifications/NotificationQueue.cc	2010-09-11 18:30:17 UTC (rev 7417)
@@ -355,7 +355,7 @@
         std::stringstream stream;
         bool first = true;
         // Iterate through the set of targets.
-        for(std::set<std::string, StringCompare>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
+        for(std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
         {
             if(!first)
                 stream << ", ";

Modified: code/trunk/src/modules/notifications/NotificationQueue.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueue.h	2010-09-11 18:27:21 UTC (rev 7416)
+++ code/trunk/src/modules/notifications/NotificationQueue.h	2010-09-11 18:30:17 UTC (rev 7417)
@@ -123,7 +123,7 @@
             @brief Returns the targets of this NotificationQueue, reps. the senders which Notifications are displayed in this NotificationQueue.
             @return Returns a set of strings holding the different targets.
             */
-            inline const std::set<std::string, StringCompare> & getTargetsSet()
+            inline const std::set<std::string> & getTargetsSet()
                 { return this->targets_; }
 
             // tolua_begin
@@ -143,7 +143,7 @@
 
             bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
 
-            std::set<std::string, StringCompare> targets_; //!< The targets the NotificationQueue displays Notifications of.
+            std::set<std::string> targets_; //!< The targets the NotificationQueue displays Notifications of.
 
             std::multiset<NotificationContainer*, NotificationContainerCompare> ordering_; //!< The NotificationContainers ordered by the time they were registered.
             std::vector<NotificationContainer*> notifications_; //!< The NotificationContainers in the order they were added to the NotificationQueue.

Modified: code/trunk/src/orxonox/interfaces/NotificationListener.h
===================================================================
--- code/trunk/src/orxonox/interfaces/NotificationListener.h	2010-09-11 18:27:21 UTC (rev 7416)
+++ code/trunk/src/orxonox/interfaces/NotificationListener.h	2010-09-11 18:30:17 UTC (rev 7417)
@@ -60,7 +60,7 @@
             NotificationListener();
             virtual ~NotificationListener() {}
 
-            virtual const std::set<std::string, StringCompare> & getTargetsSet() = 0;
+            virtual const std::set<std::string> & getTargetsSet() = 0;
             virtual void update(void) = 0;
             virtual void update(Notification* notification, const std::time_t & time) = 0;
     };




More information about the Orxonox-commit mailing list