Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 10, 2016, 1:54:11 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/modules/notifications/NotificationManager.cc

    r10624 r11054  
    6969    {
    7070        // 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();
    7373        this->allNotificationsList_.clear();
    7474
     
    152152        bool executed = false;
    153153        // 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();
    157157            // If either the sender is 'all', the NotificationQueue has as target all or the NotificationQueue has the input sender as a target.
    158158            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;
    160160        }
    161161
     
    187187
    188188        // 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();
    192192            bool bAll = set.find(NotificationListener::ALL) != set.end();
    193193            // If either the Notification has as sender 'all', the NotificationQueue displays all Notifications or the NotificationQueue has the sender of the Notification as target.
     
    195195            {
    196196                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.
    199199            }
    200200        }
     
    334334        // 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.
    335335        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;
    337337        if(bAll)
    338338            this->notificationLists_[queue->getName()] = &this->allNotificationsList_;
     
    345345
    346346        // 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));
    351351        }
    352352
     
    395395        The name of the NotificationQueue.
    396396    @return
    397         Returns a pointer to the NotificationQueue with the input name. Returns NULL if 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.
    398398    */
    399399    NotificationQueue* NotificationManager::getQueue(const std::string & name)
    400400    {
    401401        std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.find(name);
    402         // Returns NULL if no such NotificationQueue exists.
     402        // Returns nullptr if no such NotificationQueue exists.
    403403        if(it == this->queues_.end())
    404             return NULL;
     404            return nullptr;
    405405
    406406        return (*it).second;
Note: See TracChangeset for help on using the changeset viewer.