- Timestamp:
- Jan 10, 2016, 1:54:11 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/modules/notifications/NotificationManager.cc
r10624 r11054 69 69 { 70 70 // Destroys all Notifications. 71 for( std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it!= this->allNotificationsList_.end(); it++)72 it->second->destroy();71 for(const auto& mapEntry : this->allNotificationsList_) 72 mapEntry.second->destroy(); 73 73 this->allNotificationsList_.clear(); 74 74 … … 152 152 bool executed = false; 153 153 // Clear all NotificationQueues that have the input sender as target. 154 for( std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.155 { 156 const std::set<std::string>& set = it->second->getTargetsSet();154 for(const auto& mapEntry : this->queues_) // Iterate through all NotificationQueues. 155 { 156 const std::set<std::string>& set = mapEntry.second->getTargetsSet(); 157 157 // If either the sender is 'all', the NotificationQueue has as target all or the NotificationQueue has the input sender as a target. 158 158 if(all || set.find(NotificationListener::ALL) != set.end() || set.find(sender) != set.end()) 159 executed = it->second->tidy() || executed;159 executed = mapEntry.second->tidy() || executed; 160 160 } 161 161 … … 187 187 188 188 // Insert the Notification in all NotificationQueues that have its sender as target. 189 for( std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.190 { 191 const std::set<std::string>& set = it->second->getTargetsSet();189 for(const auto& mapEntry : this->queues_) // Iterate through all NotificationQueues. 190 { 191 const std::set<std::string>& set = mapEntry.second->getTargetsSet(); 192 192 bool bAll = set.find(NotificationListener::ALL) != set.end(); 193 193 // If either the Notification has as sender 'all', the NotificationQueue displays all Notifications or the NotificationQueue has the sender of the Notification as target. … … 195 195 { 196 196 if(!bAll) 197 this->notificationLists_[ it->second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue.198 it->second->update(notification, time); // Update the NotificationQueue.197 this->notificationLists_[mapEntry.second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue. 198 mapEntry.second->update(notification, time); // Update the NotificationQueue. 199 199 } 200 200 } … … 334 334 // If all senders are the target of the NotificationQueue, then the list of Notifications for that specific NotificationQueue is the same as the list of all Notifications. 335 335 bool bAll = set.find(NotificationListener::ALL) != set.end(); 336 std::multimap<std::time_t, Notification*>* map = NULL;336 std::multimap<std::time_t, Notification*>* map = nullptr; 337 337 if(bAll) 338 338 this->notificationLists_[queue->getName()] = &this->allNotificationsList_; … … 345 345 346 346 // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationQueue. 347 for( std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)348 { 349 if(!bAll && set.find( it->second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.350 map->insert(std::pair<std::time_t, Notification*>( it->first, it->second));347 for(const auto& mapEntry : this->allNotificationsList_) 348 { 349 if(!bAll && set.find(mapEntry.second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target. 350 map->insert(std::pair<std::time_t, Notification*>(mapEntry.first, mapEntry.second)); 351 351 } 352 352 … … 395 395 The name of the NotificationQueue. 396 396 @return 397 Returns a pointer to the NotificationQueue with the input name. Returns NULLif no NotificationQueue with such a name exists.397 Returns a pointer to the NotificationQueue with the input name. Returns nullptr if no NotificationQueue with such a name exists. 398 398 */ 399 399 NotificationQueue* NotificationManager::getQueue(const std::string & name) 400 400 { 401 401 std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.find(name); 402 // Returns NULLif no such NotificationQueue exists.402 // Returns nullptr if no such NotificationQueue exists. 403 403 if(it == this->queues_.end()) 404 return NULL;404 return nullptr; 405 405 406 406 return (*it).second;
Note: See TracChangeset
for help on using the changeset viewer.