Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/notifications/NotificationManager.cc

    r10765 r10821  
    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(auto & elem : this->allNotificationsList_)
     72            elem.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(auto & elem : this->queues_) // Iterate through all NotificationQueues.
     155        {
     156            const std::set<std::string>& set = elem.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 = elem.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(auto & elem : this->queues_) // Iterate through all NotificationQueues.
     190        {
     191            const std::set<std::string>& set = elem.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_[elem.second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue.
     198                elem.second->update(notification, time); // Update the NotificationQueue.
    199199            }
    200200        }
     
    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(auto & elem : this->allNotificationsList_)
     348        {
     349            if(!bAll && set.find(elem.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*>(elem.first, elem.second));
    351351        }
    352352
Note: See TracChangeset for help on using the changeset viewer.