Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (9 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/notifications/NotificationDispatcher.cc

    r10624 r11071  
    113113        // TODO: Needed?
    114114        const std::string message = this->createNotificationMessage();
    115         NotificationListener::sendNotification(message, this->getSender(), notificationMessageType::info, notificationSendMode::local);
     115        NotificationListener::sendNotification(message, this->getSender(), NotificationMessageType::info, NotificationSendMode::local);
    116116
    117117        // Broadcast
     
    144144            const std::string message = this->createNotificationMessage();
    145145            // TODO: Make the type configurable.
    146             NotificationListener::sendNotification(message, this->getSender(), notificationMessageType::info, notificationSendMode::network, clientId);
     146            NotificationListener::sendNotification(message, this->getSender(), NotificationMessageType::info, NotificationSendMode::network, clientId);
    147147        }
    148148        else if(GameMode::isServer())
     
    177177
    178178        PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
    179         PlayerInfo* player = NULL;
     179        PlayerInfo* player = nullptr;
    180180
    181181        // If the trigger is a PlayerTrigger.
    182         if(pTrigger != NULL)
     182        if(pTrigger != nullptr)
    183183        {
    184184            if(!pTrigger->isForPlayer())  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
     
    190190            return false;
    191191
    192         if(player == NULL)
     192        if(player == nullptr)
    193193        {
    194194            orxout(verbose, context::notifications) << "The NotificationDispatcher was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl;
  • code/trunk/src/modules/notifications/NotificationDispatcher.h

    r9667 r11071  
    7979            virtual ~NotificationDispatcher(); //!< Destructor.
    8080
    81             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a NotificationDispatcher object through XML.
    82             virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     81            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a NotificationDispatcher object through XML.
     82            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
    8383
    8484            /**
  • code/trunk/src/modules/notifications/NotificationManager.cc

    r10624 r11071  
    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
     
    106106        Returns true if successful.
    107107    */
    108     bool NotificationManager::registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type)
     108    bool NotificationManager::registerNotification(const std::string& message, const std::string& sender, NotificationMessageType type)
    109109    {
    110110        // TODO: Do something with the type.
     
    124124        Returns true if the command was successfully executed.
    125125    */
    126     bool NotificationManager::executeCommand(notificationCommand::Value command, const std::string& sender)
     126    bool NotificationManager::executeCommand(NotificationCommand command, const std::string& sender)
    127127    {
    128128        bool commandExecuted = false;
    129         if(command == notificationCommand::clear)
     129        if(command == NotificationCommand::clear)
    130130        {
    131131            if(this->commandClear(sender))
     
    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;
     
    437437
    438438    */
    439     Notification::Notification(const std::string& message, const std::string& sender, notificationMessageType::Value type)
     439    Notification::Notification(const std::string& message, const std::string& sender, NotificationMessageType type)
    440440    {
    441441        this->initialize();
  • code/trunk/src/modules/notifications/NotificationManager.h

    r9667 r11071  
    6262    {
    6363        public:
    64             Notification(const std::string& message, const std::string& sender, notificationMessageType::Value type);
     64            Notification(const std::string& message, const std::string& sender, NotificationMessageType type);
    6565            virtual ~Notification();
    6666
     
    8989            @return Returns an enum with the type of the Notification.
    9090            */
    91             inline notificationMessageType::Value getType(void) const
     91            inline NotificationMessageType getType(void) const
    9292                { return this->type_; }
    9393
     
    9595            std::string message_; //!< The Notification message.
    9696            std::string sender_; //!< The sender of the notification.
    97             notificationMessageType::Value type_; //!< The type of the notification.
     97            NotificationMessageType type_; //!< The type of the notification.
    9898
    9999            void initialize(void); //!< Registers the object and sets some default values.
     
    120120            virtual ~NotificationManager();
    121121
    122             virtual void preDestroy(void); // Is called before the object is destroyed.
     122            virtual void preDestroy(void) override; // Is called before the object is destroyed.
    123123
    124124            /**
     
    128128            static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export
    129129
    130             virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type);
    131             virtual bool executeCommand(notificationCommand::Value command, const std::string& sender);
     130            virtual bool registerNotification(const std::string& message, const std::string& sender, NotificationMessageType type) override;
     131            virtual bool executeCommand(NotificationCommand command, const std::string& sender) override;
    132132
    133133            bool registerNotification(Notification* notification); // Registers a Notification within the NotificationManager.
  • code/trunk/src/modules/notifications/NotificationQueue.cc

    r9667 r11071  
    206206        {
    207207            // Add all Notifications that have been created after this NotificationQueue was created.
    208             for(std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)
     208            for(const auto& mapEntry : *notifications)
    209209            {
    210                 if(it->first >= this->creationTime_)
    211                     this->push(it->second, it->first);
     210                if(mapEntry.first >= this->creationTime_)
     211                    this->push(mapEntry.second, mapEntry.first);
    212212            }
    213213        }
     
    336336        this->ordering_.clear();
    337337        // Delete all NotificationContainers in the list.
    338         for(std::vector<NotificationContainer*>::iterator it = this->notifications_.begin(); it != this->notifications_.end(); it++)
    339             delete *it;
     338        for(NotificationContainer* notification : this->notifications_)
     339            delete notification;
    340340
    341341        this->notifications_.clear();
     
    426426        bool first = true;
    427427        // Iterate through the set of targets.
    428         for(std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
     428        for(const std::string& target : this->targets_)
    429429        {
    430430            if(!first)
     
    432432            else
    433433                first = false;
    434             stream << *it;
     434            stream << target;
    435435        }
    436436
  • code/trunk/src/modules/notifications/NotificationQueue.h

    r9667 r11071  
    9797            virtual ~NotificationQueue();
    9898
    99             virtual void tick(float dt); // To update from time to time.
    100             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    101 
    102             virtual void changedName(void);
     99            virtual void tick(float dt) override; // To update from time to time.
     100            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     101
     102            virtual void changedName(void) override;
    103103           
    104104            void update(void); // Updates the NotificationQueue.
  • code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc

    r10258 r11071  
    290290        The name of the NotificationQueueCEGUI to be got.
    291291    @return
    292         Returns a pointer to the NotificationQueueCEGUI, or NULL if it doesn't exist.
     292        Returns a pointer to the NotificationQueueCEGUI, or nullptr if it doesn't exist.
    293293    */
    294294    /*static*/ NotificationQueueCEGUI* NotificationQueueCEGUI::getQueue(const std::string& name)
    295295    {
    296296        NotificationQueue* queue = NotificationManager::getInstance().getQueue(name);
    297         if(queue == NULL || !queue->isA(Class(NotificationQueueCEGUI)))
    298             return NULL;
     297        if(queue == nullptr || !queue->isA(Class(NotificationQueueCEGUI)))
     298            return nullptr;
    299299        return static_cast<NotificationQueueCEGUI*>(queue);
    300300    }
  • code/trunk/src/modules/notifications/NotificationQueueCEGUI.h

    r9667 r11071  
    7373            virtual ~NotificationQueueCEGUI();
    7474
    75             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     75            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    7676
    77             virtual void changedName(void);
     77            virtual void changedName(void) override;
    7878
    7979            void destroy(bool noGraphics = false); // Destroys the NotificationQueue.
     
    136136            void registerVariables();
    137137           
    138             virtual void create(void); // Creates the NotificationQueue in lua.
     138            virtual void create(void) override; // Creates the NotificationQueue in lua.
    139139           
    140             virtual void notificationPushed(Notification* notification); // Is called by the NotificationQueue when a Notification was pushed
    141             virtual void notificationPopped(void); // Is called by the NotificationQueue when a Notification was popped.
    142             virtual void notificationRemoved(unsigned int index); // Is called when a Notification was removed.
     140            virtual void notificationPushed(Notification* notification) override; // Is called by the NotificationQueue when a Notification was pushed
     141            virtual void notificationPopped(void) override; // Is called by the NotificationQueue when a Notification was popped.
     142            virtual void notificationRemoved(unsigned int index) override; // Is called when a Notification was removed.
    143143           
    144             virtual void clear(bool noGraphics = false); // Clears the NotificationQueue by removing all NotificationContainers.
     144            virtual void clear(bool noGraphics = false) override; // Clears the NotificationQueue by removing all NotificationContainers.
    145145
    146146        protected:
Note: See TracChangeset for help on using the changeset viewer.