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:
154 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/libraries/core/ApplicationPaths.cc

    r10624 r11054  
    6868
    6969    //! Static pointer to the singleton
    70     ApplicationPaths* ApplicationPaths::singletonPtr_s  = 0;
     70    ApplicationPaths* ApplicationPaths::singletonPtr_s  = nullptr;
    7171
    7272    ApplicationPaths::ApplicationPaths()
     
    8484        // get executable module
    8585        TCHAR buffer[1024];
    86         if (GetModuleFileName(NULL, buffer, 1024) == 0)
     86        if (GetModuleFileName(nullptr, buffer, 1024) == 0)
    8787            ThrowException(General, "Could not retrieve executable path.");
    8888
  • code/branches/cpp11_v3/src/libraries/core/ApplicationPaths.h

    r10624 r11054  
    104104
    105105        private:
    106             ApplicationPaths(const ApplicationPaths&); //!< Don't use (undefined symbol)
     106            // non-copyable:
     107            ApplicationPaths(const ApplicationPaths&) = delete;
     108            ApplicationPaths& operator=(const ApplicationPaths&) = delete;
    107109
    108110            std::vector<std::string> getModuleOrPluginPaths(boost::filesystem::path& directory, const std::string& extension);
  • code/branches/cpp11_v3/src/libraries/core/BaseObject.cc

    r10624 r11054  
    6565        this->bRegisteredEventStates_ = false;
    6666
    67         this->lastLoadedXMLElement_ = 0;
    68 
    69         this->mainStateFunctor_ = 0;
     67        this->lastLoadedXMLElement_ = nullptr;
     68
     69        this->mainStateFunctor_ = nullptr;
    7070
    7171        if (context)
     
    8686        else
    8787        {
    88             this->file_ = 0;
     88            this->file_ = nullptr;
    8989            this->sceneID_ = OBJECTID_UNKNOWN;
    9090        }
     
    132132        XMLPortObject(BaseObject, BaseObject, "eventlisteners", addEventListener, getEventListener, xmlelement, mode);
    133133
    134         Element* events = 0;
     134        Element* events = nullptr;
    135135        if (mode == XMLPort::LoadObject || mode == XMLPort::ExpandObject)
    136136            events = xmlelement.FirstChildElement("events", false);
     
    163163        this->setName(name);
    164164
    165         for (ObjectList<XMLNameListener>::iterator it = ObjectList<XMLNameListener>::begin(); it != ObjectList<XMLNameListener>::end(); ++it)
    166             it->loadedNewXMLName(this);
     165        for (XMLNameListener* listener : ObjectList<XMLNameListener>())
     166            listener->loadedNewXMLName(this);
    167167    }
    168168
     
    205205            Template* link;
    206206            assert(!(link = Template::getTemplate(temp->getLink())) || !link->isLink());
    207             link = NULL;
     207            link = nullptr;
    208208        }
    209209        else
     
    234234    {
    235235        unsigned int i = 0;
    236         for (std::set<Template*>::const_iterator it = this->templates_.begin(); it != this->templates_.end(); ++it)
     236        for (Template* temp : this->templates_)
    237237        {
    238238            if (i == index)
    239                 return (*it);
     239                return temp;
    240240            i++;
    241241        }
    242         return 0;
     242        return nullptr;
    243243    }
    244244
     
    269269    {
    270270        unsigned int i = 0;
    271         for (std::map<BaseObject*, std::string>::const_iterator it = this->eventSources_.begin(); it != this->eventSources_.end(); ++it)
    272         {
    273             if (it->second != state)
     271        for (const auto& mapEntry : this->eventSources_)
     272        {
     273            if (mapEntry.second != state)
    274274                continue;
    275275
    276276            if (i == index)
    277                 return it->first;
     277                return mapEntry.first;
    278278            ++i;
    279279        }
    280         return 0;
     280        return nullptr;
    281281    }
    282282
     
    296296    {
    297297        unsigned int i = 0;
    298         for (std::set<BaseObject*>::const_iterator it = this->eventListenersXML_.begin(); it != this->eventListenersXML_.end(); ++it)
     298        for (BaseObject* listener : this->eventListenersXML_)
    299299        {
    300300            if (i == index)
    301                 return *it;
     301                return listener;
    302302            ++i;
    303303        }
    304         return 0;
     304        return nullptr;
    305305    }
    306306
     
    331331            return (it->second);
    332332        else
    333             return 0;
     333            return nullptr;
    334334    }
    335335
     
    358358        Event event(activate, originator, name);
    359359
    360         for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
    361         {
    362             event.statename_ = (*it)->eventSources_[this];
    363             (*it)->processEvent(event);
     360        for (BaseObject* listener : this->eventListeners_)
     361        {
     362            event.statename_ = listener->eventSources_[this];
     363            listener->processEvent(event);
    364364        }
    365365    }
     
    370370    void BaseObject::fireEvent(Event& event)
    371371    {
    372         for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)
    373             (*it)->processEvent(event);
     372        for (BaseObject* listener : this->eventListeners_)
     373            listener->processEvent(event);
    374374    }
    375375
     
    423423    void BaseObject::changedMainStateName()
    424424    {
    425         this->mainStateFunctor_ = 0;
     425        this->mainStateFunctor_ = nullptr;
    426426
    427427        if (!this->mainStateName_.empty())
     
    474474
    475475            // iterate through all states and get the event sources
    476             for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it)
    477             {
    478                 const std::string& statename = (*it);
    479 
     476            for (const std::string& statename : eventnames)
     477            {
    480478                // if the event state is already known, continue with the next state
    481479                orxonox::EventState* eventstate = object->getEventState(statename);
  • code/branches/cpp11_v3/src/libraries/core/BaseObject.h

    r10624 r11054  
    163163            inline void setScene(const StrongOrWeakPtr<Scene>& scene, uint32_t sceneID) { this->scene_ = scene; this->sceneID_=sceneID; }
    164164            inline Scene* getScene() const { return this->scene_.get(); }
    165             inline virtual uint32_t getSceneID() const { return this->sceneID_; }
     165            virtual inline uint32_t getSceneID() const { return this->sceneID_; }
    166166
    167167            inline void setGametype(const StrongOrWeakPtr<Gametype>& gametype) { this->gametype_ = gametype; }
     
    218218            bool                       bInitialized_;          //!< True if the object was initialized (passed the object registration)
    219219            const XMLFile*             file_;                  //!< The XMLFile that loaded this object
    220             Element*                   lastLoadedXMLElement_;  //!< Non 0 if the TinyXML attributes have already been copied to our own lowercase map
     220            Element*                   lastLoadedXMLElement_;  //!< Non nullptr if the TinyXML attributes have already been copied to our own lowercase map
    221221            std::map<std::string, std::string> xmlAttributes_; //!< Lowercase XML attributes
    222222            std::string                loaderIndentation_;     //!< Indentation of the debug output in the Loader
     
    265265            return this->weakPtr_;
    266266        else
    267             return NULL;
     267            return nullptr;
    268268    }
    269269
  • code/branches/cpp11_v3/src/libraries/core/ClassTreeMask.cc

    r10624 r11054  
    207207            return ((*this->nodes_.top().first) == compare);
    208208        else
    209             return (compare == 0);
     209            return (compare == nullptr);
    210210    }
    211211
     
    218218            return ((*this->nodes_.top().first) != compare);
    219219        else
    220             return (compare != 0);
     220            return (compare != nullptr);
    221221    }
    222222
     
    293293        {
    294294            // No it's not: Search for classes inheriting from the given class and add the rules for them
    295             for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)
    296                 if ((*it)->isA(this->root_->getClass()))
    297                     if (overwrite || (!this->nodeExists(*it))) // If we don't want to overwrite, only add nodes that don't already exist
    298                         this->add(this->root_, *it, bInclude, overwrite);
     295            for (const Identifier* directChild : subclass->getDirectChildren())
     296                if (directChild->isA(this->root_->getClass()))
     297                    if (overwrite || (!this->nodeExists(directChild))) // If we don't want to overwrite, only add nodes that don't already exist
     298                        this->add(this->root_, directChild, bInclude, overwrite);
    299299        }
    300300
     
    325325        {
    326326            // Search for an already existing node, containing the subclass we want to add
    327             for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
     327            for (ClassTreeMaskNode* subnode : node->subnodes_)
    328328            {
    329                 if (subclass->isA((*it)->getClass()))
     329                if (subclass->isA(subnode->getClass()))
    330330                {
    331331                    // We've found an existing node -> delegate the work with a recursive function-call and return
    332                     this->add(*it, subclass, bInclude, overwrite);
     332                    this->add(subnode, subclass, bInclude, overwrite);
    333333                    return;
    334334                }
     
    392392        if (!subclass)
    393393            return;
    394         for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)
    395             this->add(*it, this->isIncluded(*it), false, false);
     394        for (const Identifier* directChild : subclass->getDirectChildren())
     395            this->add(directChild, this->isIncluded(directChild), false, false);
    396396
    397397        this->add(subclass, bInclude, false, clean);
     
    435435
    436436            // Go through the list of subnodes and look for a node containing the searched subclass and delegate the request by a recursive function-call.
    437             for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
    438                 if (subclass->isA((*it)->getClass()))
    439                     return isIncluded(*it, subclass);
     437            for (ClassTreeMaskNode* subnode : node->subnodes_)
     438                if (subclass->isA(subnode->getClass()))
     439                    return isIncluded(subnode, subclass);
    440440
    441441            // There is no subnode containing our class -> the rule of the current node takes in effect
     
    851851            this->objectIterator_ = Context::getRootContext()->getObjectList(this->subclassIterator_->first)->begin();
    852852        else
    853             this->objectIterator_ = ObjectList<BaseObject>::end();
     853            this->objectIterator_ = ObjectList<BaseObject>().end();
    854854
    855855        // Check if the iterator points on a valid object. If not, go to the next object by calling ++
     
    915915
    916916            // Iterate through all subnodes
    917             for (std::list<ClassTreeMaskNode*>::iterator it1 = node->subnodes_.begin(); it1 != node->subnodes_.end(); ++it1)
     917            for (ClassTreeMaskNode* subnode : node->subnodes_)
    918918            {
    919919                // Recursive call to this function with the subnode
    920                 this->create(*it1);
     920                this->create(subnode);
    921921
    922922                // Only execute the following code if the current node is included, meaning some of the subnodes might be included too
     
    926926
    927927                    // Iterate through all direct children
    928                     for (std::set<const Identifier*>::iterator it2 = directChildren.begin(); it2 != directChildren.end(); ++it2)
     928                    for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it)
    929929                    {
    930930                        // Check if the subnode (it1) is a child of the directChild (it2)
    931                         if ((*it1)->getClass()->isA(*it2))
     931                        if (subnode->getClass()->isA(*it))
    932932                        {
    933933                            // Yes it is - remove the directChild (it2) from the list, because it will already be handled by a recursive call to the create() function
    934                             directChildren.erase(it2);
     934                            directChildren.erase(it);
    935935
    936936                            // Check if the removed directChild was exactly the subnode
    937                             if (!(*it1)->getClass()->isExactlyA(*it2))
     937                            if (!subnode->getClass()->isExactlyA(*it))
    938938                            {
    939939                                // No, it wasn't exactly the subnode - therefore there are some classes between
    940940
    941941                                // Add the previously removed directChild (it2) to the subclass-list
    942                                 this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it2, true));
     942                                this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, true));
    943943
    944944                                // Insert all directChildren of the directChild
    945                                 directChildren.insert((*it2)->getDirectChildren().begin(), (*it2)->getDirectChildren().end());
     945                                directChildren.insert((*it)->getDirectChildren().begin(), (*it)->getDirectChildren().end());
    946946
    947947                                // Restart the scan with the expanded set of directChildren
     
    957957            // The bool is "false", meaning they have no subnodes and therefore need no further checks
    958958            if (node->isIncluded())
    959                 for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it)
    960                     this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, false));
     959                for (const Identifier* directChild : directChildren)
     960                    this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(directChild, false));
    961961        }
    962962    }
  • code/branches/cpp11_v3/src/libraries/core/ClassTreeMask.h

    r10693 r11054  
    152152            ClassTreeMaskNode* operator*() const;
    153153            ClassTreeMaskNode* operator->() const;
    154             operator bool() const;
     154            explicit operator bool() const;
    155155            bool operator==(ClassTreeMaskNode* compare) const;
    156156            bool operator!=(ClassTreeMaskNode* compare) const;
    157157
    158158        private:
    159             std::stack<std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator> > nodes_;    ///< A stack to store list-iterators
     159            std::stack<std::pair<std::list<ClassTreeMaskNode*>::iterator, std::list<ClassTreeMaskNode*>::iterator>> nodes_;    ///< A stack to store list-iterators
    160160            std::list<ClassTreeMaskNode*> rootlist_;                                                                            ///< A list for internal use (it only stores the root-node)
    161161    };
     
    211211            inline const ClassTreeMask& begin() const { return (*this); }
    212212            /// End of the ClassTreeMaskObjectIterator.
    213             inline BaseObject*          end()   const { return 0; }
     213            inline BaseObject*          end()   const { return nullptr; }
    214214
    215215            ClassTreeMask& operator=(const ClassTreeMask& other);
     
    276276        public:
    277277            /// Default-constructor: Does nothing.
    278             inline ClassTreeMaskObjectIterator() {}
     278            inline ClassTreeMaskObjectIterator() = default;
    279279            /// Copy-Constructor: Initializes the iterator from another ClassTreeMask.
    280280            inline ClassTreeMaskObjectIterator(const ClassTreeMask& mask) { (*this) = mask; }
     
    285285
    286286            /// Returns true if the ClassTreeMaskObjectIterator points at the given object.
    287             inline bool operator==(BaseObject* pointer) const { return (this->objectIterator_ && (*this->objectIterator_) == pointer) || (!this->objectIterator_ && pointer == 0); }
     287            inline bool operator==(BaseObject* pointer) const { return (this->objectIterator_ && (*this->objectIterator_) == pointer) || (!this->objectIterator_ && pointer == nullptr); }
    288288            /// Returns true if the ClassTreeMaskObjectIterator doesn't point at the given object.
    289             inline bool operator!=(BaseObject* pointer) const { return (this->objectIterator_ && (*this->objectIterator_) != pointer) || (!this->objectIterator_ && pointer != 0); }
     289            inline bool operator!=(BaseObject* pointer) const { return (this->objectIterator_ && (*this->objectIterator_) != pointer) || (!this->objectIterator_ && pointer != nullptr); }
    290290            /// Returns true if the ClassTreeMaskObjectIterator hasn't already reached the end.
    291             inline operator bool() const { return (this->objectIterator_); }
     291            inline explicit operator bool() const { return this->objectIterator_.operator bool(); }
    292292            /// Returns the object the ClassTreeMaskObjectIterator currently points at.
    293293            inline BaseObject* operator*() const { return (*this->objectIterator_); }
     
    298298            void create(ClassTreeMaskNode* node);
    299299
    300             std::list<std::pair<const Identifier*, bool> >           subclasses_;       ///< A list of all Identifiers through which objects the iterator should iterate
    301             std::list<std::pair<const Identifier*, bool> >::iterator subclassIterator_; ///< The current class of the iterator
    302             Iterator<BaseObject>                                     objectIterator_;   ///< The current object of the iterator
     300            std::list<std::pair<const Identifier*, bool>>           subclasses_;       ///< A list of all Identifiers through which objects the iterator should iterate
     301            std::list<std::pair<const Identifier*, bool>>::iterator subclassIterator_; ///< The current class of the iterator
     302            Iterator<BaseObject>                                    objectIterator_;   ///< The current object of the iterator
    303303    };
    304304}
  • code/branches/cpp11_v3/src/libraries/core/ConfigurablePaths.cc

    r10624 r11054  
    5454#include "util/Exception.h"
    5555#include "commandline/CommandLineIncludes.h"
     56#include "core/ApplicationPaths.h"
    5657
    5758// Differentiate Boost Filesystem v2 and v3
     
    6768
    6869    //! Static pointer to the singleton
    69     ConfigurablePaths* ConfigurablePaths::singletonPtr_s  = 0;
     70    ConfigurablePaths* ConfigurablePaths::singletonPtr_s  = nullptr;
    7071
    7172    SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");
     
    122123            char* userDataPathPtr(getenv("APPDATA"));
    123124#endif
    124             if (userDataPathPtr == NULL)
     125            if (userDataPathPtr == nullptr)
    125126                ThrowException(General, "Could not retrieve user data path.");
    126127            bf::path userDataPath(userDataPathPtr);
     
    143144
    144145        // Create directories to avoid problems when opening files in non existent folders.
    145         std::vector<std::pair<bf::path, std::string> > directories;
    146         directories.push_back(std::make_pair(bf::path(configPath_), std::string("config")));
    147         directories.push_back(std::make_pair(bf::path(logPath_), std::string("log")));
     146        std::vector<std::pair<bf::path, std::string>> directories;
     147        directories.emplace_back(bf::path(configPath_), std::string("config"));
     148        directories.emplace_back(bf::path(logPath_), std::string("log"));
    148149
    149         for (std::vector<std::pair<bf::path, std::string> >::iterator it = directories.begin();
     150        for (std::vector<std::pair<bf::path, std::string>>::iterator it = directories.begin();
    150151            it != directories.end(); ++it)
    151152        {
  • code/branches/cpp11_v3/src/libraries/core/ConfigurablePaths.h

    r10624 r11054  
    9393
    9494        private:
    95             ConfigurablePaths(const ConfigurablePaths&); //!< Don't use (undefined symbol)
     95            // non-copyable:
     96            ConfigurablePaths(const ConfigurablePaths&) = delete;
     97            ConfigurablePaths& operator=(const ConfigurablePaths&) = delete;
    9698
    9799            boost::filesystem::path& dataPath_;              //!< Path to the data files folder
  • code/branches/cpp11_v3/src/libraries/core/Core.cc

    r11011 r11054  
    8383{
    8484    //! Static pointer to the singleton
    85     Core* Core::singletonPtr_s  = 0;
     85    Core* Core::singletonPtr_s  = nullptr;
    8686
    8787    SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
     
    9898
    9999    Core::Core(const std::string& cmdLine)
    100         : applicationPaths_(NULL)
    101         , configurablePaths_(NULL)
    102         , dynLibManager_(NULL)
    103         , signalHandler_(NULL)
    104         , configFileManager_(NULL)
    105         , languageInstance_(NULL)
    106         , loaderInstance_(NULL)
    107         , ioConsole_(NULL)
    108         , tclBind_(NULL)
    109         , tclThreadManager_(NULL)
    110         , rootScope_(NULL)
    111         , graphicsManager_(NULL)
    112         , inputManager_(NULL)
    113         , guiManager_(NULL)
    114         , graphicsScope_(NULL)
     100        : applicationPaths_(nullptr)
     101        , configurablePaths_(nullptr)
     102        , dynLibManager_(nullptr)
     103        , signalHandler_(nullptr)
     104        , configFileManager_(nullptr)
     105        , languageInstance_(nullptr)
     106        , loaderInstance_(nullptr)
     107        , ioConsole_(nullptr)
     108        , tclBind_(nullptr)
     109        , tclThreadManager_(nullptr)
     110        , rootScope_(nullptr)
     111        , graphicsManager_(nullptr)
     112        , inputManager_(nullptr)
     113        , guiManager_(nullptr)
     114        , graphicsScope_(nullptr)
    115115        , bGraphicsLoaded_(false)
    116         , staticInitHandler_(NULL)
    117         , pluginManager_(NULL)
    118         , rootModule_(NULL)
    119         , config_(NULL)
     116        , staticInitHandler_(nullptr)
     117        , pluginManager_(nullptr)
     118        , rootModule_(nullptr)
     119        , config_(nullptr)
    120120        , destructionHelper_(this)
    121121    {
     
    179179
    180180        // initialize root context
    181         Context::setRootContext(new Context(NULL));
     181        Context::setRootContext(new Context(nullptr));
    182182
    183183        // Do this soon after the ConfigFileManager has been created to open up the
     
    282282
    283283        const std::vector<std::string>& modulePaths = ApplicationPaths::getInstance().getModulePaths();
    284         for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it)
    285         {
    286             ModuleInstance* module = new ModuleInstance(*it);
     284        for (const std::string& modulePath : modulePaths)
     285        {
     286            ModuleInstance* module = new ModuleInstance(modulePath);
    287287            this->loadModule(module);
    288288            this->modules_.push_back(module);
     
    312312    void Core::unloadModules()
    313313    {
    314         for (std::list<ModuleInstance*>::iterator it = this->modules_.begin(); it != this->modules_.end(); ++it)
    315         {
    316             ModuleInstance* module = (*it);
     314        for (ModuleInstance* module : this->modules_)
     315        {
    317316            this->unloadModule(module);
    318317            delete module;
     
    329328        module->deleteAllStaticallyInitializedInstances();
    330329        this->dynLibManager_->unload(module->getDynLib());
    331         module->setDynLib(NULL);
     330        module->setDynLib(nullptr);
    332331    }
    333332
     
    464463    {
    465464        // Update UpdateListeners before general ticking
    466         for (ObjectList<UpdateListener>::iterator it = ObjectList<UpdateListener>::begin(); it != ObjectList<UpdateListener>::end(); ++it)
    467             it->preUpdate(time);
     465        for (UpdateListener* listener : ObjectList<UpdateListener>())
     466            listener->preUpdate(time);
    468467        if (this->bGraphicsLoaded_)
    469468        {
     
    474473        }
    475474        // Process console events and status line
    476         if (this->ioConsole_ != NULL)
     475        if (this->ioConsole_ != nullptr)
    477476            this->ioConsole_->preUpdate(time);
    478477        // Process thread commands
     
    483482    {
    484483        // Update UpdateListeners just before rendering
    485         for (ObjectList<UpdateListener>::iterator it = ObjectList<UpdateListener>::begin(); it != ObjectList<UpdateListener>::end(); ++it)
    486             it->postUpdate(time);
     484        for (UpdateListener* listener : ObjectList<UpdateListener>())
     485            listener->postUpdate(time);
    487486        if (this->bGraphicsLoaded_)
    488487        {
  • code/branches/cpp11_v3/src/libraries/core/Core.h

    r11012 r11054  
    7373
    7474            /// Leave empty and use destroy() instead
    75             ~Core() {}
     75            ~Core() = default;
    7676            /// Destructor that also executes when the object fails to construct
    7777            void destroy();
     
    9292
    9393        private:
    94             Core(const Core&); //!< Don't use (undefined symbol)
     94            // non-copyable:
     95            Core(const Core&) = delete;
     96            Core& operator=(const Core&) = delete;
    9597
    9698            void setThreadAffinity(int limitToCPU);
  • code/branches/cpp11_v3/src/libraries/core/CoreConfig.cc

    r11052 r11054  
    3535#include "core/Language.h"
    3636#include "core/ApplicationPaths.h"
     37
     38#include <random>
    3739
    3840namespace orxonox
     
    106108    {
    107109        // Inform listeners
    108         ObjectList<DevModeListener>::iterator it = ObjectList<DevModeListener>::begin();
    109         for (; it != ObjectList<DevModeListener>::end(); ++it)
    110             it->devModeChanged(bDevMode_);
     110        for (DevModeListener* listener : ObjectList<DevModeListener>())
     111            listener->devModeChanged(bDevMode_);
    111112    }
    112113
     
    129130        if (!bInitialized && this->bInitRandomNumberGenerator_)
    130131        {
    131             srand(static_cast<unsigned int>(time(0)));
     132            std::random_device rnddev;
     133            rndseed(rnddev());
     134            //Keep the old seeding around because people will probably still use the old functions
     135            srand(rnddev());
    132136            rand();
    133137            bInitialized = true;
     
    137141    void CoreConfig::updateLastLevelTimestamp()
    138142    {
    139         ModifyConfigValue(lastLevelTimestamp_, set, static_cast<long long>(time(NULL)));
     143        ModifyConfigValue(lastLevelTimestamp_, set, static_cast<long long>(time(nullptr)));
    140144    }
    141145
    142146    void CoreConfig::updateOgreConfigTimestamp()
    143147    {
    144         ModifyConfigValue(ogreConfigTimestamp_, set, static_cast<long long>(time(NULL)));
     148        ModifyConfigValue(ogreConfigTimestamp_, set, static_cast<long long>(time(nullptr)));
    145149    }
    146150
  • code/branches/cpp11_v3/src/libraries/core/CoreConfig.h

    r11052 r11054  
    7676    public:
    7777        DevModeListener();
    78         virtual ~DevModeListener() {}
     78        virtual ~DevModeListener() = default;
    7979        virtual void devModeChanged(bool value) = 0;
    8080    };
  • code/branches/cpp11_v3/src/libraries/core/CoreIncludes.h

    r11020 r11054  
    120120*/
    121121#define RegisterAbstractClass(ClassName) \
    122     RegisterClassWithFactory(ClassName, static_cast<ClassFactory<ClassName>*>(NULL), false)
     122    RegisterClassWithFactory(ClassName, static_cast<ClassFactory<ClassName>*>(nullptr), false)
    123123
    124124/**
     
    221221        struct InheritsFromClass : public Identifier::InheritsFrom
    222222        {
    223             virtual Identifier* getParent() const { return Class(T); }
     223            virtual Identifier* getParent() const override { return Class(T); }
    224224        };
    225225
     
    231231            ~StaticallyInitializedIdentifier() { identifier_->destroy(); }
    232232
    233             virtual void load()
     233            virtual void load() override
    234234            {
    235235                IdentifierManager::getInstance().addIdentifier(this->identifier_);
    236236            }
    237237
    238             virtual void unload()
     238            virtual void unload() override
    239239            {
    240240                IdentifierManager::getInstance().removeIdentifier(this->identifier_);
  • code/branches/cpp11_v3/src/libraries/core/CorePrecompiledHeaders.h

    r8858 r11054  
    5050#include <sstream>  // 53
    5151#include <set>      // 50
     52#include <memory>
    5253
    5354#include "util/Output.h" // 48
     
    6667#include <OgreColourValue.h> // 36
    6768#include <boost/preprocessor/cat.hpp> // 27
    68 #include <boost/shared_ptr.hpp> // 21
    6969
    7070#ifdef ORXONOX_COMPILER_MSVC
     
    7676#include "util/SubString.h"  // 14
    7777
    78 #include <boost/scoped_ptr.hpp> // 13
    7978#include <stack> // 12
    8079
  • code/branches/cpp11_v3/src/libraries/core/CorePrereqs.h

    r10624 r11054  
    6868namespace orxonox
    6969{
    70     static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);
     70    static constexpr uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);
    7171}
    7272
     
    8282
    8383        //!A list of available scopes for the Scope template.
    84         static const Value ROOT = 1;
    85         static const Value GRAPHICS = 2;
     84        static constexpr Value ROOT = 1;
     85        static constexpr Value GRAPHICS = 2;
    8686    }
    8787
     
    9090        typedef int Type;
    9191
    92         static const Type STATIC_INITIALIZATION_HANDLER = 1;
    93         static const Type IDENTIFIER = 2;
    94         static const Type SCOPED_SINGLETON_WRAPPER = 3;
    95         static const Type COMMAND_LINE_ARGUMENT = 4;
    96         static const Type CONSOLE_COMMAND = 5;
     92        static constexpr Type STATIC_INITIALIZATION_HANDLER = 1;
     93        static constexpr Type IDENTIFIER = 2;
     94        static constexpr Type SCOPED_SINGLETON_WRAPPER = 3;
     95        static constexpr Type COMMAND_LINE_ARGUMENT = 4;
     96        static constexpr Type CONSOLE_COMMAND = 5;
    9797    }
    9898
  • code/branches/cpp11_v3/src/libraries/core/CoreStaticInitializationHandler.cc

    r10624 r11054  
    9999        std::set<Identifier*> identifiers;
    100100        const std::set<StaticallyInitializedInstance*>& instances = module->getInstances(StaticInitialization::IDENTIFIER);
    101         for (std::set<StaticallyInitializedInstance*>::const_iterator it = instances.begin(); it != instances.end(); ++it)
    102             identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(*it)->getIdentifier());
     101        for (StaticallyInitializedInstance* instance : instances)
     102            identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(instance)->getIdentifier());
    103103
    104104        // destroy objects. some objects may survive this at first because they still have strong pointers pointing at them. this is
     
    106106        // that objects within one module may reference each other by strong pointers. but it is not allowed that objects from another
    107107        // module (which is not unloaded) uses strong pointers to point at objects inside the unloaded module. this will lead to a crash.
    108         for (std::set<Identifier*>::iterator it = identifiers.begin(); it != identifiers.end(); ++it)
    109             (*it)->destroyObjects();
     108        for (Identifier* identifier : identifiers)
     109            identifier->destroyObjects();
    110110
    111111        // check if all objects were really destroyed. this is not the case if an object is referenced by a strong pointer from another
    112112        // module (or if two objects inside this module reference each other). this will lead to a crash and must be fixed (e.g. by
    113113        // changing object dependencies; or by changing the logic that allows modules to be unloaded).
    114         for (std::set<Identifier*>::iterator it = identifiers.begin(); it != identifiers.end(); ++it)
     114        for (Identifier* identifier : identifiers)
    115115        {
    116             ObjectListBase* objectList = Context::getRootContext()->getObjectList(*it);
     116            ObjectListBase* objectList = Context::getRootContext()->getObjectList(identifier);
    117117            if (objectList->size() > 0)
    118118            {
    119                 orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << (*it)->getName()
     119                orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << identifier->getName()
    120120                    << " after unloading the Identifier. This may lead to a crash" << endl;
    121121            }
     
    123123
    124124        // destroy object-lists in all contexts
    125         for (std::set<Identifier*>::iterator it_identifier = identifiers.begin(); it_identifier != identifiers.end(); ++it_identifier)
     125        for (Identifier* identifier : identifiers)
    126126        {
    127127            // only do this if the Identifier is not a Context itself; otherwise we delete the list we're iterating over
    128             if (!(*it_identifier)->isExactlyA(Class(Context)))
     128            if (!identifier->isExactlyA(Class(Context)))
    129129            {
    130130                // iterate over all contexts
    131                 for (ObjectList<Context>::iterator it_context = ObjectList<Context>::begin(); it_context != ObjectList<Context>::end(); ++it_context)
    132                     it_context->destroyObjectList((*it_identifier));
     131                for (Context* context : ObjectList<Context>())
     132                    context->destroyObjectList(identifier);
    133133            }
    134134        }
  • code/branches/cpp11_v3/src/libraries/core/CoreStaticInitializationHandler.h

    r10624 r11054  
    4343            CoreStaticInitializationHandler() : bInitInstances_(false) {}
    4444
    45             virtual void setupHandler();
    46             virtual void shutdownHandler();
     45            virtual void setupHandler() override;
     46            virtual void shutdownHandler() override;
    4747
    48             virtual void loadModule(ModuleInstance* module);
    49             virtual void unloadModule(ModuleInstance* module);
     48            virtual void loadModule(ModuleInstance* module) override;
     49            virtual void unloadModule(ModuleInstance* module) override;
    5050
    5151            inline void setInitInstances(bool bInitInstances)
  • code/branches/cpp11_v3/src/libraries/core/EventIncludes.h

    r8729 r11054  
    8686
    8787#define XMLPortEventStateIntern(name, classname, statename, xmlelement, mode) \
    88     static orxonox::ExecutorMemberPtr<classname> xmlsetfunctor##name = orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + '(' + statename + ')').cast<orxonox::ExecutorMember<classname> >(); \
    89     static orxonox::ExecutorMemberPtr<classname> xmlgetfunctor##name = orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + '(' + statename + ')').cast<orxonox::ExecutorMember<classname> >(); \
     88    static orxonox::ExecutorPtr xmlsetfunctorbase##name = orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + '(' + statename + ')'); \
     89    static orxonox::ExecutorPtr xmlgetfunctorbase##name = orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + '(' + statename + ')'); \
     90    static orxonox::ExecutorMemberPtr<classname> xmlsetfunctor##name = std::static_pointer_cast<orxonox::ExecutorMember<classname>>(xmlsetfunctorbase##name); \
     91    static orxonox::ExecutorMemberPtr<classname> xmlgetfunctor##name = std::static_pointer_cast<orxonox::ExecutorMember<classname>>(xmlgetfunctorbase##name); \
    9092    xmlsetfunctor##name->setDefaultValue(1, statename); \
    9193    xmlgetfunctor##name->setDefaultValue(1, statename); \
  • code/branches/cpp11_v3/src/libraries/core/GUIManager.cc

    r11052 r11054  
    3232#include <fstream>
    3333#include <memory>
    34 #include <boost/bind.hpp>
     34#include <functional>
    3535#include <OgreRenderQueue.h>
    3636#include <OgreRenderWindow.h>
     
    119119namespace orxonox
    120120{
     121    namespace arg = std::placeholders;
     122
    121123    static void key_esc()
    122124        { GUIManager::getInstance().keyESC(); }
     
    126128    {
    127129    public:
    128         void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard)
     130        virtual void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard) override
    129131        {
    130132            OutputLevel orxonoxLevel = level::debug_output;
     
    145147
    146148        /// Carbon copy from CEGUIDefaultLogger.cpp with a bugfix for Windows
    147         void setLogFilename(const CEGUI::String& filename, bool append = false)
     149        virtual void setLogFilename(const CEGUI::String& filename, bool append = false) override
    148150        {
    149151            // Close current log file (if any)
     
    169171                d_caching = false;
    170172
    171                 std::vector<std::pair<CEGUI::String, CEGUI::LoggingLevel> >::iterator it = d_cache.begin();
     173                std::vector<std::pair<CEGUI::String, CEGUI::LoggingLevel>>::iterator it = d_cache.begin();
    172174
    173175                while (it != d_cache.end())
     
    230232    public:
    231233        /// Callback from Ogre invoked before other stuff in our target queue is rendered
    232         void renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue)
     234        virtual void renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue) override
    233235        {
    234236            if (id == Ogre::RENDER_QUEUE_OVERLAY && invocation.empty())
     
    252254    static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
    253255
    254     GUIManager* GUIManager::singletonPtr_s = 0;
     256    GUIManager* GUIManager::singletonPtr_s = nullptr;
    255257    /*static*/ const std::string GUIManager::defaultScheme_ = "TaharezGreen"; //Alternative: Orxonox (not fully complete yet, see the graphics menu)
    256258
     
    291293    */
    292294    GUIManager::GUIManager(const std::pair<int, int>& mousePosition)
    293         : guiRenderer_(NULL)
    294         , resourceProvider_(NULL)
     295        : guiRenderer_(nullptr)
     296        , resourceProvider_(nullptr)
    295297#ifndef ORXONOX_OLD_CEGUI
    296         , rqListener_(NULL)
    297         , imageCodec_(NULL)
    298 #endif
    299         , luaState_(NULL)
    300         , scriptModule_(NULL)
    301         , guiSystem_(NULL)
    302         , ceguiLogger_(NULL)
    303         , rootWindow_(NULL)
    304         , hudRootWindow_(NULL)
    305         , menuRootWindow_(NULL)
    306         , camera_(NULL)
     298        , rqListener_(nullptr)
     299        , imageCodec_(nullptr)
     300#endif
     301        , luaState_(nullptr)
     302        , scriptModule_(nullptr)
     303        , guiSystem_(nullptr)
     304        , ceguiLogger_(nullptr)
     305        , rootWindow_(nullptr)
     306        , hudRootWindow_(nullptr)
     307        , menuRootWindow_(nullptr)
     308        , camera_(nullptr)
    307309        , destructionHelper_(this)
    308310    {
     
    353355
    354356        // Create our own logger to specify the filepath
    355         std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
     357        std::unique_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
    356358        ceguiLogger->setLogFilename(ConfigurablePaths::getLogPathString() + "cegui.log");
    357359        ceguiLogger->setLoggingLevel(static_cast<CEGUI::LoggingLevel>(this->outputLevelCeguiLog_));
     
    360362        // Create the CEGUI system singleton
    361363#ifdef ORXONOX_OLD_CEGUI
    362         guiSystem_ = new System(guiRenderer_, resourceProvider_, 0, scriptModule_);
     364        guiSystem_ = new System(guiRenderer_, resourceProvider_, nullptr, scriptModule_);
    363365        // Add functions that have been renamed in newer versions
    364366        luaState_->doString("CEGUI.SchemeManager.create = CEGUI.SchemeManager.loadScheme");
     
    366368        luaState_->doString("CEGUI.ImagesetManager.createFromImageFile= CEGUI.ImagesetManager.createImagesetFromImageFile");
    367369#else
    368         guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, 0, imageCodec_, scriptModule_);
     370        guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, nullptr, imageCodec_, scriptModule_);
    369371#endif
    370372
     
    474476    {
    475477        assert(guiSystem_);
    476         this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectTimePulse, _1, time.getDeltaTime()));
     478        this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectTimePulse, arg::_1, time.getDeltaTime()));
    477479    }
    478480
     
    490492    {
    491493#ifdef ORXONOX_OLD_CEGUI
    492         if (camera == NULL)
    493             this->guiRenderer_->setTargetSceneManager(0);
     494        if (camera == nullptr)
     495            this->guiRenderer_->setTargetSceneManager(nullptr);
    494496        else
    495497            this->guiRenderer_->setTargetSceneManager(camera->getSceneManager());
    496498#else
    497         if (camera_ != NULL && camera_->getSceneManager() != NULL)
     499        if (camera_ != nullptr && camera_->getSceneManager() != nullptr)
    498500            camera_->getSceneManager()->removeRenderQueueListener(rqListener_);
    499         if (camera != NULL && camera->getSceneManager() != NULL)
     501        if (camera != nullptr && camera->getSceneManager() != nullptr)
    500502            camera->getSceneManager()->addRenderQueueListener(rqListener_);
    501503#endif
     
    672674    {
    673675#if CEGUI_VERSION >= 0x000800
    674         this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectKeyDown, _1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work?
    675         this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectChar, _1, evt.getText()));
    676 #else
    677         this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectKeyDown, _1, evt.getKeyCode()));
    678         this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectChar, _1, evt.getText()));
     676        this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectKeyDown, arg::_1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work?
     677        this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectChar, arg::_1, evt.getText()));
     678#else
     679        this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectKeyDown, arg::_1, evt.getKeyCode()));
     680        this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectChar, arg::_1, evt.getText()));
    679681#endif
    680682    }
     
    683685    {
    684686#if CEGUI_VERSION >= 0x000800
    685         this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectKeyUp, _1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work?
    686 #else
    687         this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectKeyUp, _1, evt.getKeyCode()));
     687        this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectKeyUp, arg::_1, (CEGUI::Key::Scan) evt.getKeyCode())); // TODO: will this cast always work?
     688#else
     689        this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectKeyUp, arg::_1, evt.getKeyCode()));
    688690#endif
    689691    }
     
    701703    {
    702704#if CEGUI_VERSION >= 0x000800
    703         this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMouseButtonDown, _1, convertButton(id)));
    704 #else
    705         this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMouseButtonDown, _1, convertButton(id)));
     705        this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMouseButtonDown, arg::_1, convertButton(id)));
     706#else
     707        this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMouseButtonDown, arg::_1, convertButton(id)));
    706708#endif
    707709    }
     
    719721    {
    720722#if CEGUI_VERSION >= 0x000800
    721         this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMouseButtonUp, _1, convertButton(id)));
    722 #else
    723         this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMouseButtonUp, _1, convertButton(id)));
     723        this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMouseButtonUp, arg::_1, convertButton(id)));
     724#else
     725        this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMouseButtonUp, arg::_1, convertButton(id)));
    724726#endif
    725727    }
     
    728730    {
    729731#if CEGUI_VERSION >= 0x000800
    730         this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMousePosition, _1, (float)abs.x, (float)abs.y));
    731 #else
    732         this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMousePosition, _1, (float)abs.x, (float)abs.y));
     732        this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMousePosition, arg::_1, (float)abs.x, (float)abs.y));
     733#else
     734        this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMousePosition, arg::_1, (float)abs.x, (float)abs.y));
    733735#endif
    734736    }
     
    737739    {
    738740#if CEGUI_VERSION >= 0x000800
    739         this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMouseWheelChange, _1, (float)sgn(rel) * this->numScrollLines_));
    740 #else
    741         this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMouseWheelChange, _1, (float)sgn(rel) * this->numScrollLines_));
     741        this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMouseWheelChange, arg::_1, (float)sgn(rel) * this->numScrollLines_));
     742#else
     743        this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMouseWheelChange, arg::_1, (float)sgn(rel) * this->numScrollLines_));
    742744#endif
    743745    }
     
    749751    {
    750752#if CEGUI_VERSION >= 0x000800
    751         this->protectedCeguiContextCall(boost::bind(&CEGUI::GUIContext::injectMouseLeaves, _1));
    752 #else
    753         this->protectedCeguiSystemCall(boost::bind(&CEGUI::System::injectMouseLeaves, _1));
     753        this->protectedCeguiContextCall(std::bind(&CEGUI::GUIContext::injectMouseLeaves, arg::_1));
     754#else
     755        this->protectedCeguiSystemCall(std::bind(&CEGUI::System::injectMouseLeaves, arg::_1));
    754756#endif
    755757    }
     
    798800        terminate the whole program...
    799801    @note
    800         Your life gets easier if you use boost::bind to create the object/function.
     802        Your life gets easier if you use std::bind to create the object/function.
    801803    @param function
    802804        Any callable object/function that takes this->guiSystem_ as its only parameter.
     
    921923            return;
    922924
    923         CEGUI::Font* font = NULL;
     925        CEGUI::Font* font = nullptr;
    924926        CEGUI::XMLAttributes xmlAttributes;
    925927
     
    937939
    938940        font = CEGUI::FontManager::getSingleton().createFont("FreeType", xmlAttributes);
    939         if(font != NULL)
     941        if(font != nullptr)
    940942            font->load();
    941943#else
  • code/branches/cpp11_v3/src/libraries/core/GUIManager.h

    r11052 r11054  
    4040#include <map>
    4141#include <string>
     42#include <memory>
    4243
    4344#if CEGUI_VERSION >= 0x000800
     
    4849#   include <CEGUIVersion.h>
    4950#endif
    50 
    51 #include <boost/shared_ptr.hpp>
    5251
    5352#include "util/DestructionHelper.h"
     
    9897
    9998        //! Leave empty and use cleanup() instead
    100         ~GUIManager() {}
     99        ~GUIManager() = default;
    101100        /// Destructor that also executes when object fails to construct
    102101        void destroy();
     
    137136        inline void setPlayer(const std::string& guiname, PlayerInfo* player)
    138137            { this->players_[guiname] = player; }
    139         inline orxonox::PlayerInfo* getPlayer(const std::string& guiname) const { std::map<std::string, PlayerInfo*>::const_iterator it = this->players_.find(guiname); return (it != this->players_.end()) ? it->second : 0; } // tolua_export
     138        inline orxonox::PlayerInfo* getPlayer(const std::string& guiname) const { std::map<std::string, PlayerInfo*>::const_iterator it = this->players_.find(guiname); return (it != this->players_.end()) ? it->second : nullptr; } // tolua_export
    140139
    141140        // TODO: Temporary hack because the tolua exported CEGUI method does not seem to work
     
    154153
    155154    private:
    156         GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
     155        // non-copyable:
     156        GUIManager(const GUIManager&) = delete;
     157        GUIManager& operator=(const GUIManager&) = delete;
    157158
    158159        void executeCode(const std::string& str);
     
    172173
    173174        // keyHandler functions
    174         void buttonPressed (const KeyEvent& evt);
    175         void buttonReleased(const KeyEvent& evt);
     175        virtual void buttonPressed (const KeyEvent& evt) override;
     176        virtual void buttonReleased(const KeyEvent& evt) override;
    176177
    177178        // mouseHandler functions
    178         void buttonPressed (MouseButtonCode::ByEnum id);
    179         void buttonReleased(MouseButtonCode::ByEnum id);
    180         void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
    181         void mouseScrolled (int abs, int rel);
     179        virtual void buttonPressed (MouseButtonCode::ByEnum id) override;
     180        virtual void buttonReleased(MouseButtonCode::ByEnum id) override;
     181        virtual void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) override;
     182        virtual void mouseScrolled (int abs, int rel) override;
    182183        void mouseLeft     ();
    183184
    184185        // window event handler
    185         virtual void windowResized(unsigned int newWidth, unsigned int newHeight);
    186         virtual void windowFocusChanged(bool bFocus);
     186        virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override;
     187        virtual void windowFocusChanged(bool bFocus) override;
    187188
    188189#ifdef ORXONOX_OLD_CEGUI
     
    198199        CEGUI::LuaScriptModule*              scriptModule_;         //!< CEGUI's script module to use Lua
    199200        CEGUI::System*                       guiSystem_;            //!< CEGUI's main system
    200         shared_ptr<ResourceInfo>             rootFileInfo_;         //!< Resource information about the root script
     201        std::shared_ptr<ResourceInfo>        rootFileInfo_;         //!< Resource information about the root script
    201202        CEGUI::Logger*                       ceguiLogger_;          //!< CEGUI's logger to be able to log CEGUI errors in our log
    202203        int                                  outputLevelCeguiLog_;  //!< CEGUI's log level
  • code/branches/cpp11_v3/src/libraries/core/Game.cc

    r10624 r11054  
    3636
    3737#include <exception>
    38 #include <boost/weak_ptr.hpp>
    3938#include <loki/ScopeGuard.h>
    4039
     
    6665
    6766    std::map<std::string, GameStateInfo> Game::gameStateDeclarations_s;
    68     Game* Game::singletonPtr_s = 0;
     67    Game* Game::singletonPtr_s = nullptr;
    6968
    7069    //! Represents one node of the game state tree.
     
    7271    {
    7372        std::string name_;
    74         weak_ptr<GameStateTreeNode> parent_;
    75         std::vector<shared_ptr<GameStateTreeNode> > children_;
     73        std::weak_ptr<GameStateTreeNode> parent_;
     74        std::vector<std::shared_ptr<GameStateTreeNode>> children_;
    7675    };
    7776
    7877    Game::Game(const std::string& cmdLine)
    79         : gameClock_(NULL)
    80         , core_(NULL)
     78        : gameClock_(nullptr)
     79        , core_(nullptr)
    8180        , bChangingState_(false)
    8281        , bAbort_(false)
    83         , config_(NULL)
     82        , config_(nullptr)
    8483        , destructionHelper_(this)
    8584    {
     
    116115
    117116        // After the core has been created, we can safely instantiate the GameStates that don't require graphics
    118         for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
    119             it != gameStateDeclarations_s.end(); ++it)
    120         {
    121             if (!it->second.bGraphicsMode)
    122                 constructedStates_[it->second.stateName] = GameStateFactory::fabricate(it->second);
     117        for (const auto& mapEntry : gameStateDeclarations_s)
     118        {
     119            if (!mapEntry.second.bGraphicsMode)
     120                constructedStates_[mapEntry.second.stateName] = GameStateFactory::fabricate(mapEntry.second);
    123121        }
    124122
    125123        // The empty root state is ALWAYS loaded!
    126         this->rootStateNode_ = shared_ptr<GameStateTreeNode>(new GameStateTreeNode());
     124        this->rootStateNode_ = std::shared_ptr<GameStateTreeNode>(std::make_shared<GameStateTreeNode>());
    127125        this->rootStateNode_->name_ = "emptyRootGameState";
    128126        this->loadedTopStateNode_ = this->rootStateNode_;
     
    137135
    138136        assert(loadedStates_.size() <= 1); // Just empty root GameState
    139         // Destroy all GameStates (shared_ptrs take care of actual destruction)
     137        // Destroy all GameStates (std::shared_ptrs take care of actual destruction)
    140138        constructedStates_.clear();
    141139
     
    235233        while (this->requestedStateNodes_.size() > 0)
    236234        {
    237             shared_ptr<GameStateTreeNode> requestedStateNode = this->requestedStateNodes_.front();
     235            std::shared_ptr<GameStateTreeNode> requestedStateNode = this->requestedStateNodes_.front();
    238236            assert(this->loadedTopStateNode_);
    239237            if (!this->loadedTopStateNode_->parent_.expired() && requestedStateNode == this->loadedTopStateNode_->parent_.lock())
     
    263261    {
    264262        // Note: The first element is the empty root state, which doesn't need ticking
    265         for (GameStateVector::const_iterator it = this->loadedStates_.begin() + 1;
    266             it != this->loadedStates_.end(); ++it)
     263        for (const std::shared_ptr<GameState>& state : this->loadedStates_)
    267264        {
    268265            try
     
    270267                // Add tick time for most of the states
    271268                uint64_t timeBeforeTick = 0;
    272                 if ((*it)->getInfo().bIgnoreTickTime)
     269                if (state->getInfo().bIgnoreTickTime)
    273270                    timeBeforeTick = this->gameClock_->getRealMicroseconds();
    274                 (*it)->update(*this->gameClock_);
    275                 if ((*it)->getInfo().bIgnoreTickTime)
     271                state->update(*this->gameClock_);
     272                if (state->getInfo().bIgnoreTickTime)
    276273                    this->subtractTickTime(static_cast<int32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick));
    277274            }
    278275            catch (...)
    279276            {
    280                 orxout(user_error) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << endl;
     277                orxout(user_error) << "An exception occurred while updating '" << state->getName() << "': " << Exception::handleMessage() << endl;
    281278                orxout(user_error) << "This should really never happen!" << endl;
    282279                orxout(user_error) << "Unloading all GameStates depending on the one that crashed." << endl;
    283                 shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_;
    284                 while (current->name_ != (*it)->getName() && current)
     280                std::shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_;
     281                while (current->name_ != state->getName() && current)
    285282                    current = current->parent_.lock();
    286283                if (current && current->parent_.lock())
     
    372369        }
    373370
    374         shared_ptr<GameStateTreeNode> lastRequestedNode;
     371        std::shared_ptr<GameStateTreeNode> lastRequestedNode;
    375372        if (this->requestedStateNodes_.empty())
    376373            lastRequestedNode = this->loadedTopStateNode_;
     
    384381
    385382        // Check children first
    386         std::vector<shared_ptr<GameStateTreeNode> > requestedNodes;
     383        std::vector<std::shared_ptr<GameStateTreeNode>> requestedNodes;
    387384        for (unsigned int i = 0; i < lastRequestedNode->children_.size(); ++i)
    388385        {
     
    397394        {
    398395            // Check parent and all its grand parents
    399             shared_ptr<GameStateTreeNode> currentNode = lastRequestedNode;
    400             while (currentNode != NULL)
     396            std::shared_ptr<GameStateTreeNode> currentNode = lastRequestedNode;
     397            while (currentNode != nullptr)
    401398            {
    402399                if (currentNode->name_ == name)
     
    405402                requestedNodes.push_back(currentNode);
    406403            }
    407             if (currentNode == NULL)
     404            if (currentNode == nullptr)
    408405                requestedNodes.clear();
    409406        }
     
    424421    void Game::popState()
    425422    {
    426         shared_ptr<GameStateTreeNode> lastRequestedNode;
     423        std::shared_ptr<GameStateTreeNode> lastRequestedNode;
    427424        if (this->requestedStateNodes_.empty())
    428425            lastRequestedNode = this->loadedTopStateNode_;
     
    435432    }
    436433
    437     shared_ptr<GameState> Game::getState(const std::string& name)
     434    std::shared_ptr<GameState> Game::getState(const std::string& name)
    438435    {
    439436        GameStateMap::const_iterator it = constructedStates_.find(name);
     
    447444            else
    448445                orxout(internal_error) << "Could not find GameState '" << name << "'." << endl;
    449             return shared_ptr<GameState>();
     446            return std::shared_ptr<GameState>();
    450447        }
    451448    }
     
    454451    {
    455452        // Split string into pieces of the form whitespacesText
    456         std::vector<std::pair<std::string, int> > stateStrings;
     453        std::vector<std::pair<std::string, int>> stateStrings;
    457454        size_t pos = 0;
    458455        size_t startPos = 0;
     
    465462            while (pos < str.size() && str[pos] != ' ')
    466463                ++pos;
    467             stateStrings.push_back(std::make_pair(str.substr(startPos, pos - startPos), indentation));
     464            stateStrings.emplace_back(str.substr(startPos, pos - startPos), indentation);
    468465        }
    469466        if (stateStrings.empty())
    470467            ThrowException(GameState, "Emtpy GameState hierarchy provided, terminating.");
    471468        // Add element with large identation to detect the last with just an iterator
    472         stateStrings.push_back(std::make_pair(std::string(), -1));
     469        stateStrings.emplace_back(std::string(), -1);
    473470
    474471        // Parse elements recursively
    475         std::vector<std::pair<std::string, int> >::const_iterator begin = stateStrings.begin();
     472        std::vector<std::pair<std::string, int>>::const_iterator begin = stateStrings.begin();
    476473        parseStates(begin, this->rootStateNode_);
    477474    }
     
    479476    /*** Internal ***/
    480477
    481     void Game::parseStates(std::vector<std::pair<std::string, int> >::const_iterator& it, shared_ptr<GameStateTreeNode> currentNode)
     478    void Game::parseStates(std::vector<std::pair<std::string, int>>::const_iterator& it, std::shared_ptr<GameStateTreeNode> currentNode)
    482479    {
    483480        SubString tokens(it->first, ",");
    484         std::vector<std::pair<std::string, int> >::const_iterator startIt = it;
     481        std::vector<std::pair<std::string, int>>::const_iterator startIt = it;
    485482
    486483        for (unsigned int i = 0; i < tokens.size(); ++i)
     
    491488            if (tokens[i] == this->rootStateNode_->name_)
    492489                ThrowException(GameState, "You shouldn't use 'emptyRootGameState' in the hierarchy...");
    493             shared_ptr<GameStateTreeNode> node(new GameStateTreeNode());
     490            std::shared_ptr<GameStateTreeNode> node(std::make_shared<GameStateTreeNode>());
    494491            node->name_ = tokens[i];
    495492            node->parent_ = currentNode;
     
    521518
    522519            // Construct all the GameStates that require graphics
    523             for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
    524                 it != gameStateDeclarations_s.end(); ++it)
    525             {
    526                 if (it->second.bGraphicsMode)
     520            for (const auto& mapEntry : gameStateDeclarations_s)
     521            {
     522                if (mapEntry.second.bGraphicsMode)
    527523                {
    528524                    // Game state loading failure is serious --> don't catch
    529                     shared_ptr<GameState> gameState = GameStateFactory::fabricate(it->second);
     525                    std::shared_ptr<GameState> gameState = GameStateFactory::fabricate(mapEntry.second);
    530526                    if (!constructedStates_.insert(std::make_pair(
    531                         it->second.stateName, gameState)).second)
     527                        mapEntry.second.stateName, gameState)).second)
    532528                        assert(false); // GameState was already created!
    533529                }
     
    582578            graphicsUnloader.Dismiss();
    583579
    584         shared_ptr<GameState> state = this->getState(name);
     580        std::shared_ptr<GameState> state = this->getState(name);
    585581        state->activateInternal();
    586582        if (!this->loadedStates_.empty())
     
    599595        try
    600596        {
    601             shared_ptr<GameState> state = this->getState(name);
     597            std::shared_ptr<GameState> state = this->getState(name);
    602598            state->activity_.topState = false;
    603599            this->loadedStates_.pop_back();
     
    613609        // Check if graphics is still required
    614610        bool graphicsRequired = false;
    615         for (unsigned i = 0; i < loadedStates_.size(); ++i)
    616             graphicsRequired |= loadedStates_[i]->getInfo().bGraphicsMode;
     611        for (const std::shared_ptr<GameState>& state : loadedStates_)
     612            graphicsRequired |= state->getInfo().bGraphicsMode;
    617613        if (!graphicsRequired)
    618614            this->unloadGraphics(!this->bAbort_); // if abort is false, that means the game is still running while unloading graphics. in this case we load a graphics manager without renderer (to keep all necessary ogre instances alive)
     
    620616    }
    621617
    622     /*static*/ std::map<std::string, shared_ptr<Game::GameStateFactory> >& Game::GameStateFactory::getFactories()
    623     {
    624         static std::map<std::string, shared_ptr<GameStateFactory> > factories;
     618    /*static*/ std::map<std::string, std::shared_ptr<Game::GameStateFactory>>& Game::GameStateFactory::getFactories()
     619    {
     620        static std::map<std::string, std::shared_ptr<GameStateFactory>> factories;
    625621        return factories;
    626622    }
    627623
    628     /*static*/ shared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info)
    629     {
    630         std::map<std::string, shared_ptr<Game::GameStateFactory> >::const_iterator it = getFactories().find(info.className);
     624    /*static*/ std::shared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info)
     625    {
     626        std::map<std::string, std::shared_ptr<Game::GameStateFactory>>::const_iterator it = getFactories().find(info.className);
    631627        assert(it != getFactories().end());
    632628        return it->second->fabricateInternal(info);
  • code/branches/cpp11_v3/src/libraries/core/Game.h

    r10624 r11054  
    4444#include <string>
    4545#include <vector>
    46 #include <boost/shared_ptr.hpp>
     46#include <memory>
    4747#include <boost/preprocessor/cat.hpp>
    4848
     
    8484    { // tolua_export
    8585        friend class Singleton<Game>;
    86         typedef std::vector<shared_ptr<GameState> > GameStateVector;
    87         typedef std::map<std::string, shared_ptr<GameState> > GameStateMap;
    88         typedef shared_ptr<GameStateTreeNode> GameStateTreeNodePtr;
     86        typedef std::vector<std::shared_ptr<GameState>> GameStateVector;
     87        typedef std::map<std::string, std::shared_ptr<GameState>> GameStateMap;
     88        typedef std::shared_ptr<GameStateTreeNode> GameStateTreeNodePtr;
    8989
    9090    public:
     
    9292
    9393        //! Leave empty and use cleanup() instead
    94         ~Game() {}
     94        ~Game() = default;
    9595        /// Destructor that also executes when object fails to construct
    9696        void destroy();
    9797
    9898        void setStateHierarchy(const std::string& str);
    99         shared_ptr<GameState> getState(const std::string& name);
     99        std::shared_ptr<GameState> getState(const std::string& name);
    100100
    101101        void run();
     
    122122        {
    123123        public:
    124             virtual ~GameStateFactory() { }
    125             static shared_ptr<GameState> fabricate(const GameStateInfo& info);
     124            virtual ~GameStateFactory() = default;
     125            static std::shared_ptr<GameState> fabricate(const GameStateInfo& info);
    126126            template <class T>
    127127            static void createFactory(const std::string& className)
    128128                { getFactories()[className].reset(new TemplateGameStateFactory<T>()); }
    129129
    130             virtual shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) = 0;
    131             static std::map<std::string, shared_ptr<GameStateFactory> >& getFactories();
     130            virtual std::shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) = 0;
     131            static std::map<std::string, std::shared_ptr<GameStateFactory>>& getFactories();
    132132        };
    133133        template <class T>
     
    135135        {
    136136        public:
    137             shared_ptr<GameState> fabricateInternal(const GameStateInfo& info)
    138                 { return shared_ptr<GameState>(new T(info)); }
     137            virtual std::shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) override
     138                { return std::shared_ptr<GameState>(std::make_shared<T>(info)); }
    139139        };
    140140
     
    145145        };
    146146
    147         Game(Game&); // don't mess with singletons
     147        // non-copyable:
     148        Game(const Game&) = delete;
     149        Game& operator=(const Game&) = delete;
    148150
    149151        void loadGraphics();
    150152        void unloadGraphics(bool loadGraphicsManagerWithoutRenderer = true);
    151153
    152         void parseStates(std::vector<std::pair<std::string, int> >::const_iterator& it, shared_ptr<GameStateTreeNode> currentNode);
     154        void parseStates(std::vector<std::pair<std::string, int>>::const_iterator& it, std::shared_ptr<GameStateTreeNode> currentNode);
    153155        bool checkState(const std::string& name) const;
    154156        void loadState(const std::string& name);
  • code/branches/cpp11_v3/src/libraries/core/GameMode.h

    r7401 r11054  
    6363
    6464        private:
    65             GameMode();
    66             GameMode(const GameMode& inst);
    67             ~GameMode();
     65            // static class, no instances allowed:
     66            GameMode() = delete;
     67            GameMode(const GameMode&) = delete;
     68            GameMode& operator=(const GameMode&) = delete;
     69            ~GameMode() = delete;
    6870
    6971            /// Checks if we're in control of the game (either standalone or server).
  • code/branches/cpp11_v3/src/libraries/core/GraphicsManager.cc

    r10624 r11054  
    3434#include <sstream>
    3535#include <boost/filesystem.hpp>
    36 #include <boost/shared_array.hpp>
    3736
    3837#include <OgreFrameListener.h>
     
    8382    {
    8483    public:
    85         void windowResized     (Ogre::RenderWindow* rw)
     84        virtual void windowResized     (Ogre::RenderWindow* rw) override
    8685            { orxonox::WindowEventListener::resizeWindow(rw->getWidth(), rw->getHeight()); }
    87         void windowFocusChange (Ogre::RenderWindow* rw)
     86        virtual void windowFocusChange (Ogre::RenderWindow* rw) override
    8887            { orxonox::WindowEventListener::changeWindowFocus(rw->isActive()); }
    89         void windowClosed      (Ogre::RenderWindow* rw)
     88        virtual void windowClosed      (Ogre::RenderWindow* rw) override
    9089            { orxonox::Game::getInstance().stop(); }
    91         void windowMoved       (Ogre::RenderWindow* rw)
     90        virtual void windowMoved       (Ogre::RenderWindow* rw) override
    9291            { orxonox::WindowEventListener::moveWindow(); }
    9392    };
    9493
    95     GraphicsManager* GraphicsManager::singletonPtr_s = 0;
     94    GraphicsManager* GraphicsManager::singletonPtr_s = nullptr;
    9695
    9796    RegisterAbstractClass(GraphicsManager).inheritsFrom<Configurable>();
     
    9998    GraphicsManager::GraphicsManager(bool bLoadRenderer)
    10099        : ogreWindowEventListener_(new OgreWindowEventListener())
    101         , renderWindow_(0)
    102         , viewport_(0)
     100        , renderWindow_(nullptr)
     101        , viewport_(nullptr)
    103102        , lastFrameStartTime_(0.0f)
    104103        , lastFrameEndTime_(0.0f)
     
    178177    void GraphicsManager::upgradeToGraphics()
    179178    {
    180         if (renderWindow_ != NULL)
     179        if (renderWindow_ != nullptr)
    181180            return;
    182181
     
    304303        //       But in our case we only have one viewport for now anyway, therefore
    305304        //       no ScopeGuards or anything to handle exceptions.
    306         this->viewport_ = this->renderWindow_->addViewport(0, 0);
     305        this->viewport_ = this->renderWindow_->addViewport(nullptr, 0);
    307306
    308307        Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(Ogre::MIP_UNLIMITED);
     
    312311        HWND hwnd;
    313312        this->renderWindow_->getCustomAttribute("WINDOW", (void*)&hwnd);
    314         LONG iconID = (LONG)LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(101));
     313        LONG iconID = (LONG)LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(101));
    315314        SetClassLong(hwnd, GCL_HICON, iconID);
    316315#endif
     
    390389        GUIManager::getInstance().setCamera(camera);
    391390
    392         for (ObjectList<ViewportEventListener>::iterator it = ObjectList<ViewportEventListener>::begin(); it != ObjectList<ViewportEventListener>::end(); ++it)
    393             it->cameraChanged(this->viewport_, oldCamera);
     391        for (ViewportEventListener* listener : ObjectList<ViewportEventListener>())
     392            listener->cameraChanged(this->viewport_, oldCamera);
    394393    }
    395394
  • code/branches/cpp11_v3/src/libraries/core/GraphicsManager.h

    r10624 r11054  
    4747#include <cassert>
    4848#include <string>
     49#include <memory>
     50
    4951#include <OgreLog.h>
    50 #include <boost/shared_ptr.hpp>
    5152
    5253#include "util/DestructionHelper.h"
     
    7071
    7172        //! Leave empty and use cleanup() instead
    72         ~GraphicsManager() {}
     73        ~GraphicsManager() = default;
    7374        /// Destructor that also executes when object fails to construct
    7475        void destroy();
     
    9697        void loadDebugOverlay();
    9798        void unloadDebugOverlay();
    98         bool rendererLoaded() const { return renderWindow_ != NULL; }
     99        bool rendererLoaded() const { return renderWindow_ != nullptr; }
    99100
    100101        void setCamera(Ogre::Camera* camera);
    101102
    102103    private:
    103         GraphicsManager(GraphicsManager&); // don't mess with singletons
     104        // non-copyable:
     105        GraphicsManager(const GraphicsManager&) = delete;
     106        GraphicsManager& operator=(const GraphicsManager&) = delete;
    104107
    105108        // OGRE initialisation
     
    110113        // event from Ogre::LogListener
    111114#if OGRE_VERSION >= 0x010800
    112         void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName, bool& skipThisMessage);
     115        virtual void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName, bool& skipThisMessage) override;
    113116#else
    114         void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName);
     117        virtual void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName) override;
    115118#endif
    116119
     
    130133
    131134        // XML files for the resources and the debug overlay
    132         shared_ptr<XMLFile> resources_;                //!< XML with resource locations
    133         shared_ptr<XMLFile> extResources_;             //!< XML with resource locations in the external path (only for dev runs)
    134         shared_ptr<XMLFile> debugOverlay_;             //!< XML with various debug overlays
     135        std::shared_ptr<XMLFile> resources_;           //!< XML with resource locations
     136        std::shared_ptr<XMLFile> extResources_;        //!< XML with resource locations in the external path (only for dev runs)
     137        std::shared_ptr<XMLFile> debugOverlay_;        //!< XML with various debug overlays
    135138
    136139        // config values
  • code/branches/cpp11_v3/src/libraries/core/Language.cc

    r10624 r11054  
    8888    // ###############################
    8989
    90     Language* Language::singletonPtr_s = 0;
     90    Language* Language::singletonPtr_s = nullptr;
    9191
    9292    /**
     
    107107    Language::~Language()
    108108    {
    109         for (std::map<std::string, LanguageEntry*>::iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
    110             delete (it->second);
     109        for (const auto& mapEntry : this->languageEntries_)
     110            delete (mapEntry.second);
    111111    }
    112112
     
    319319
    320320        // Iterate through the list an write the lines into the file
    321         for (std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.begin(); it != this->languageEntries_.end(); ++it)
    322         {
    323             file << it->second->getLabel() << '=' << it->second->getDefault() << endl;
     321        for (const auto& mapEntry : this->languageEntries_)
     322        {
     323            file << mapEntry.second->getLabel() << '=' << mapEntry.second->getDefault() << endl;
    324324        }
    325325
  • code/branches/cpp11_v3/src/libraries/core/Language.h

    r10624 r11054  
    171171
    172172        private:
    173             Language(const Language&);
     173            // non-copyable:
     174            Language(const Language&) = delete;
     175            Language& operator=(const Language&) = delete;
    174176
    175177            void readDefaultLanguageFile();
  • code/branches/cpp11_v3/src/libraries/core/Loader.cc

    r10624 r11054  
    3131#include <sstream>
    3232#include <tinyxml/ticpp.h>
    33 #include <boost/scoped_ptr.hpp>
    3433#include <boost/filesystem.hpp>
    3534#include <boost/filesystem/fstream.hpp>
     
    4847namespace orxonox
    4948{
    50     Loader* Loader::singletonPtr_s = 0;
     49    Loader* Loader::singletonPtr_s = nullptr;
    5150
    5251    /**
     
    7372        std::string xmlInput;
    7473
    75         shared_ptr<std::vector<std::vector<std::pair<std::string, size_t> > > > lineTrace(new std::vector<std::vector<std::pair<std::string, size_t> > >());
     74        std::shared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> lineTrace(std::make_shared<std::vector<std::vector<std::pair<std::string, size_t>>>>());
    7675        lineTrace->reserve(1000); //arbitrary number
    7776
     
    8079        {
    8180            // Use the LuaState to replace the XML tags (calls our function)
    82             scoped_ptr<LuaState> luaState(new LuaState());
     81            const std::unique_ptr<LuaState> luaState(new LuaState());
    8382            luaState->setTraceMap(lineTrace);
    8483            luaState->setIncludeParser(&Loader::replaceLuaTags);
     
    8887        else
    8988        {
    90             shared_ptr<ResourceInfo> info = Resource::getInfo(file->getFilename());
    91             if (info == NULL)
     89            std::shared_ptr<ResourceInfo> info = Resource::getInfo(file->getFilename());
     90            if (info == nullptr)
    9291            {
    9392                orxout(user_error, context::loader) << "Could not find XML file '" << file->getFilename() << "'." << endl;
     
    163162                    if (line <= lineTrace->size())
    164163                    {
    165                         std::vector<std::pair<std::string, size_t> > linesources = lineTrace->at(line - 1);
     164                        std::vector<std::pair<std::string, size_t>> linesources = lineTrace->at(line - 1);
    166165                        std::ostringstream message;
    167166                        message << "Possible sources of error:" << endl;
    168                         for (std::vector<std::pair<std::string, size_t> >::iterator it = linesources.begin(); it != linesources.end(); ++it)
     167                        for (const std::pair<std::string, size_t>& pair : linesources)
    169168                        {
    170                             message << it->first << ", Line " << it->second << endl;
     169                            message << pair.first << ", Line " << pair.second << endl;
    171170                        }
    172171                        orxout(user_error, context::loader) << message.str() << endl;
     
    208207        if (!file)
    209208            return;
    210         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; )
     209        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>().begin(); it; )
    211210        {
    212211            if ((it->getFile() == file) && mask.isIncluded(it->getIdentifier()))
     
    262261        {
    263262            bool expectedValue = true;
    264             for (std::map<size_t, bool>::iterator it = luaTags.begin(); it != luaTags.end(); ++it)
    265             {
    266                 if (it->second == expectedValue)
     263            for (const auto& mapEntry : luaTags)
     264            {
     265                if (mapEntry.second == expectedValue)
    267266                    expectedValue = !expectedValue;
    268267                else
  • code/branches/cpp11_v3/src/libraries/core/Loader.h

    r10624 r11054  
    6767            static bool getLuaTags(const std::string& text, std::map<size_t, bool>& luaTags);
    6868
    69             std::vector<std::pair<const XMLFile*, ClassTreeMask> > files_;
     69            std::vector<std::pair<const XMLFile*, ClassTreeMask>> files_;
    7070
    7171            static Loader* singletonPtr_s;
  • code/branches/cpp11_v3/src/libraries/core/LuaState.cc

    r10265 r11054  
    4848    LuaState::LuaState()
    4949        : bIsRunning_(false)
    50         , includeParseFunction_(NULL)
     50        , includeParseFunction_(nullptr)
    5151    {
    5252        // Create new lua state and configure it
     
    7979    }
    8080
    81     shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename)
     81    std::shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename)
    8282    {
    8383        // Look in the current directory first
    84         shared_ptr<ResourceInfo> sourceInfo = Resource::getInfo(sourceFileInfo_->path + filename);
     84        std::shared_ptr<ResourceInfo> sourceInfo = Resource::getInfo(sourceFileInfo_->path + filename);
    8585        // Continue search in root directories
    86         if (sourceInfo == NULL && !sourceFileInfo_->path.empty())
     86        if (sourceInfo == nullptr && !sourceFileInfo_->path.empty())
    8787            sourceInfo = Resource::getInfo(filename);
    8888        return sourceInfo;
     
    9191    bool LuaState::includeFile(const std::string& filename)
    9292    {
    93         shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);
    94         if (sourceInfo != NULL)
     93        std::shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);
     94        if (sourceInfo != nullptr)
    9595            return this->includeString(Resource::open(sourceInfo)->getAsString(), sourceInfo);
    9696        else
     
    101101    }
    102102
    103     bool LuaState::includeString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo)
     103    bool LuaState::includeString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo)
    104104    {
    105105        // Parse string with provided include parser (otherwise don't preparse at all)
    106106        std::string luaInput;
    107         if (includeParseFunction_ != NULL)
     107        if (includeParseFunction_ != nullptr)
    108108            luaInput = (*includeParseFunction_)(code);
    109109        else
    110110            luaInput = code;
    111111
    112         if (sourceFileInfo != NULL)
     112        if (sourceFileInfo != nullptr)
    113113        {
    114114            // Also fill a map with the actual source code. This is just for the include* commands
     
    119119        bool returnValue = this->doString(luaInput, sourceFileInfo);
    120120
    121         if (sourceFileInfo != NULL)
     121        if (sourceFileInfo != nullptr)
    122122        {
    123123            // Delete source code entry
    124             if (sourceFileInfo != NULL)
     124            if (sourceFileInfo != nullptr)
    125125                this->sourceCodeMap_.erase(sourceFileInfo->filename);
    126126        }
     
    131131    bool LuaState::doFile(const std::string& filename)
    132132    {
    133         shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);
    134         if (sourceInfo != NULL)
     133        std::shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);
     134        if (sourceInfo != nullptr)
    135135            return this->doString(Resource::open(sourceInfo)->getAsString(), sourceInfo);
    136136        else
     
    141141    }
    142142
    143     bool LuaState::doString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo)
     143    bool LuaState::doString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo)
    144144    {
    145145        // Save the old source file info
    146         shared_ptr<ResourceInfo> oldSourceFileInfo = sourceFileInfo_;
     146        std::shared_ptr<ResourceInfo> oldSourceFileInfo = sourceFileInfo_;
    147147        // Only override if sourceFileInfo provides useful information
    148         if (sourceFileInfo != NULL)
     148        if (sourceFileInfo != nullptr)
    149149            sourceFileInfo_ = sourceFileInfo;
    150150
    151151        std::string chunkname;
    152         if (sourceFileInfo != NULL)
     152        if (sourceFileInfo != nullptr)
    153153        {
    154154            // Provide lua_load with the filename for debug purposes
     
    245245            //Note: due to newlines etc., it's possible that one line consists of parts of
    246246            //      multiple, different files
    247             std::vector<std::vector<std::pair<std::string, size_t> > >::reverse_iterator it = lineTrace_->rbegin();
     247            std::vector<std::vector<std::pair<std::string, size_t>>>::reverse_iterator it = lineTrace_->rbegin();
    248248            std::pair<std::string, size_t> temppair = std::make_pair(filename, line);
    249249            //Avoid duplicate entries. This could happen if there were lua blocks on the same line
     
    259259            {
    260260                //Add the new line to the trace map
    261                 lineTrace_->push_back(std::vector<std::pair<std::string, size_t> >());
     261                lineTrace_->emplace_back();
    262262                //Add the source of the line at the end
    263                 lineTrace_->rbegin()->push_back(std::make_pair(filename, line + i));
     263                lineTrace_->rbegin()->emplace_back(filename, line + i);
    264264            }
    265265        }
     
    285285    bool LuaState::fileExists(const std::string& filename)
    286286    {
    287         shared_ptr<ResourceInfo> info = this->getFileInfo(filename);
    288         if (info == NULL)
     287        std::shared_ptr<ResourceInfo> info = this->getFileInfo(filename);
     288        if (info == nullptr)
    289289            return false;
    290290        else
     
    300300        if (it != this->sourceCodeMap_.end())
    301301            return it->second;
    302         shared_ptr<ResourceInfo> info = Resource::getInfo(filename);
    303         if (info == NULL)
     302        std::shared_ptr<ResourceInfo> info = Resource::getInfo(filename);
     303        if (info == nullptr)
    304304            return "";
    305305        else
     
    326326    /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
    327327    {
    328         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    329         {
    330             if (it->first == name || it->second == function)
     328        for (const auto& mapEntry : getToluaInterfaces())
     329        {
     330            if (mapEntry.first == name || mapEntry.second == function)
    331331            {
    332332                orxout(internal_warning, context::lua) << "Trying to add a Tolua interface with the same name or function." << endl;
     
    337337
    338338        // Open interface in all LuaStates
    339         for (std::vector<LuaState*>::const_iterator it = getInstances().begin(); it != getInstances().end(); ++it)
    340             (*function)((*it)->luaState_);
     339        for (LuaState* state : getInstances())
     340            (*function)(state->luaState_);
    341341
    342342        // Return dummy bool
     
    354354
    355355        // Close interface in all LuaStates
    356         for (std::vector<LuaState*>::const_iterator itState = getInstances().begin(); itState != getInstances().end(); ++itState)
    357         {
    358             lua_pushnil((*itState)->luaState_);
    359             lua_setglobal((*itState)->luaState_, it->first.c_str());
     356        for (LuaState* state : getInstances())
     357        {
     358            lua_pushnil(state->luaState_);
     359            lua_setglobal(state->luaState_, it->first.c_str());
    360360        }
    361361
     
    369369    /*static*/ void LuaState::openToluaInterfaces(lua_State* state)
    370370    {
    371         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
    372             (*it->second)(state);
     371        for (const auto& mapEntry : getToluaInterfaces())
     372            (mapEntry.second)(state);
    373373    }
    374374
    375375    /*static*/ void LuaState::closeToluaInterfaces(lua_State* state)
    376376    {
    377         for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
     377        for (const auto& mapEntry : getToluaInterfaces())
    378378        {
    379379            lua_pushnil(state);
    380             lua_setglobal(state, it->first.c_str());
     380            lua_setglobal(state, mapEntry.first.c_str());
    381381        }
    382382    }
  • code/branches/cpp11_v3/src/libraries/core/LuaState.h

    r10265 r11054  
    4747#include <string>
    4848#include <vector>
    49 #include <boost/shared_ptr.hpp>
     49#include <memory>
    5050
    5151#include "util/Output.h"
     
    7979
    8080        bool doFile(const std::string& filename); // tolua_export
    81         bool doString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo = shared_ptr<ResourceInfo>());
     81        bool doString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo = std::shared_ptr<ResourceInfo>());
    8282
    8383        bool includeFile(const std::string& filename); // tolua_export
    84         bool includeString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo = shared_ptr<ResourceInfo>());
     84        bool includeString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo = std::shared_ptr<ResourceInfo>());
    8585
    8686        void luaPrint(const std::string& str); // tolua_export
     
    9494        void clearOutput() { output_.clear(); } // tolua_export
    9595
    96         void setTraceMap(shared_ptr<std::vector<std::vector<std::pair<std::string, size_t> > > > map)
    97             { map->push_back(std::vector<std::pair<std::string, size_t> >()); lineTrace_ = map; }
     96        void setTraceMap(std::shared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> map)
     97            { map->emplace_back(); lineTrace_ = map; }
    9898
    9999        void setIncludeParser(std::string (*function)(const std::string&)) { includeParseFunction_ = function; }
    100100        lua_State* getInternalLuaState() { return luaState_; }
    101101
    102         void setDefaultResourceInfo(const shared_ptr<ResourceInfo>& sourceFileInfo) { this->sourceFileInfo_ = sourceFileInfo; }
    103         const shared_ptr<ResourceInfo>& getDefaultResourceInfo() { return this->sourceFileInfo_; }
     102        void setDefaultResourceInfo(const std::shared_ptr<ResourceInfo>& sourceFileInfo) { this->sourceFileInfo_ = sourceFileInfo; }
     103        const std::shared_ptr<ResourceInfo>& getDefaultResourceInfo() { return this->sourceFileInfo_; }
    104104
    105105        LuaFunctor* createLuaFunctor(const std::string& code) { return new LuaFunctor(code, this); } // tolua_export
     
    115115
    116116    private:
    117         shared_ptr<ResourceInfo> getFileInfo(const std::string& filename);
    118         shared_ptr<std::vector<std::vector<std::pair<std::string, size_t> > > > lineTrace_;
     117        std::shared_ptr<ResourceInfo> getFileInfo(const std::string& filename);
     118        std::shared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> lineTrace_;
    119119       
    120120        std::stringstream output_;
    121121        lua_State* luaState_;
    122122        bool bIsRunning_;
    123         shared_ptr<ResourceInfo> sourceFileInfo_;
     123        std::shared_ptr<ResourceInfo> sourceFileInfo_;
    124124        std::map<std::string, std::string> sourceCodeMap_;
    125125        std::string (*includeParseFunction_)(const std::string&);
  • code/branches/cpp11_v3/src/libraries/core/Namespace.cc

    r10624 r11054  
    5353    {
    5454        if (this->bRoot_)
    55             for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
    56                 delete (*it);
     55            for (NamespaceNode* node : this->representingNamespaces_)
     56                delete node;
    5757    }
    5858
     
    8080            for (unsigned int i = 0; i < tokens.size(); i++)
    8181            {
    82                 for (std::set<NamespaceNode*>::iterator it = this->getNamespace()->representingNamespaces_.begin(); it != this->getNamespace()->representingNamespaces_.end(); ++it)
     82                for (NamespaceNode* node : this->getNamespace()->representingNamespaces_)
    8383                {
    84                     std::set<NamespaceNode*> temp = (*it)->getNodeRelative(tokens[i]);
     84                    std::set<NamespaceNode*> temp = node->getNodeRelative(tokens[i]);
    8585                    this->representingNamespaces_.insert(temp.begin(), temp.end());
    8686                }
     
    9393        if (this->bAutogeneratedFileRootNamespace_)
    9494        {
    95             for (std::set<NamespaceNode*>::iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); ++it)
     95            for (NamespaceNode* node : this->representingNamespaces_)
    9696            {
    97                 (*it)->setRoot(true);
    98                 (*it)->setHidden(true);
     97                node->setRoot(true);
     98                node->setHidden(true);
    9999            }
    100100        }
     
    109109    const BaseObject* Namespace::saveObjects(unsigned int index) const
    110110    {
    111         return 0; // todo
     111        return nullptr; // todo
    112112    }
    113113
    114114    bool Namespace::includes(const Namespace* ns) const
    115115    {
    116         for (std::set<NamespaceNode*>::const_iterator it1 = this->representingNamespaces_.begin(); it1 != this->representingNamespaces_.end(); ++it1)
     116        for (NamespaceNode* node1 : this->representingNamespaces_)
    117117        {
    118             for (std::set<NamespaceNode*>::const_iterator it2 = ns->representingNamespaces_.begin(); it2 != ns->representingNamespaces_.end(); ++it2)
     118            for (NamespaceNode* node2 : ns->representingNamespaces_)
    119119            {
    120                 if ((*it1)->includes(*it2))
     120                if (node1->includes(node2))
    121121                {
    122122                    if (this->operator_ == "or")
     
    149149
    150150        int i = 0;
    151         for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
     151        for (NamespaceNode* node : this->representingNamespaces_)
    152152        {
    153153            if (i > 0)
    154154                output += " / ";
    155155
    156             output += (*it)->toString();
     156            output += node->toString();
     157            i++;
    157158        }
    158159
     
    165166
    166167        int i = 0;
    167         for (std::set<NamespaceNode*>::const_iterator it = this->representingNamespaces_.begin(); it != this->representingNamespaces_.end(); i++, ++it)
     168        for (NamespaceNode* node : this->representingNamespaces_)
    168169        {
    169170            if (i > 0)
    170171                output += '\n';
    171172
    172             output += (*it)->toString(indentation);
     173            output += node->toString(indentation);
     174            i++;
    173175        }
    174176
  • code/branches/cpp11_v3/src/libraries/core/Namespace.h

    r9667 r11054  
    5050            virtual ~Namespace();
    5151
    52             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     52            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5353
    5454            void loadObjects(BaseObject* object);
  • code/branches/cpp11_v3/src/libraries/core/NamespaceNode.cc

    r8858 r11054  
    103103                bool bFoundMatchingNamespace = false;
    104104
    105                 for (std::map<std::string, NamespaceNode*>::iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
     105                for (const auto& mapEntry : this->subnodes_)
    106106                {
    107                     if (it->first.find(firstPart) == (it->first.size() - firstPart.size()))
     107                    if (mapEntry.first.find(firstPart) == (mapEntry.first.size() - firstPart.size()))
    108108                    {
    109                         std::set<NamespaceNode*> temp2 = it->second->getNodeRelative(secondPart);
     109                        std::set<NamespaceNode*> temp2 = mapEntry.second->getNodeRelative(secondPart);
    110110                        nodes.insert(temp2.begin(), temp2.end());
    111111                        bFoundMatchingNamespace = true;
     
    132132        else
    133133        {
    134             for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
    135                 if (it->second->includes(ns))
     134            for (const auto& mapEntry : this->subnodes_)
     135                if (mapEntry.second->includes(ns))
    136136                    return true;
    137137        }
     
    149149
    150150            int i = 0;
    151             for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); i++, ++it)
     151            for (const auto& mapEntry : this->subnodes_)
    152152            {
    153153                if (i > 0)
    154154                    output += ", ";
    155155
    156                 output += it->second->toString();
     156                output += mapEntry.second->toString();
     157                i++;
    157158            }
    158159
     
    167168        std::string output = (indentation + this->name_ + '\n');
    168169
    169         for (std::map<std::string, NamespaceNode*>::const_iterator it = this->subnodes_.begin(); it != this->subnodes_.end(); ++it)
    170             output += it->second->toString(indentation + "  ");
     170        for (const auto& mapEntry : this->subnodes_)
     171            output += mapEntry.second->toString(indentation + "  ");
    171172
    172173        return output;
  • code/branches/cpp11_v3/src/libraries/core/NamespaceNode.h

    r7401 r11054  
    4646    {
    4747        public:
    48             NamespaceNode(const std::string& name, NamespaceNode* parent = 0);
     48            NamespaceNode(const std::string& name, NamespaceNode* parent = nullptr);
    4949            ~NamespaceNode();
    5050
  • code/branches/cpp11_v3/src/libraries/core/Resource.cc

    r9675 r11054  
    5858        DataStreamListPtr resources(new Ogre::DataStreamList());
    5959        const Ogre::StringVector& groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
    60         for (Ogre::StringVector::const_iterator it = groups.begin(); it != groups.end(); ++it)
     60        for (const std::string& group : groups)
    6161        {
    62             DataStreamListPtr temp = Ogre::ResourceGroupManager::getSingleton().openResources(pattern, *it);
     62            DataStreamListPtr temp = Ogre::ResourceGroupManager::getSingleton().openResources(pattern, group);
    6363            resources->insert(resources->end(), temp->begin(), temp->end());
    6464        }
     
    7979    }
    8080
    81     shared_ptr<ResourceInfo> Resource::getInfo(const std::string& name)
     81    std::shared_ptr<ResourceInfo> Resource::getInfo(const std::string& name)
    8282    {
    8383        std::string group;
     
    8888        catch (const Ogre::Exception&)
    8989        {
    90             return shared_ptr<ResourceInfo>();
     90            return std::shared_ptr<ResourceInfo>();
    9191        }
    9292        Ogre::FileInfoListPtr infos = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(group, name);
     
    9595            if (it->filename == name)
    9696            {
    97                 shared_ptr<ResourceInfo> ptr(new ResourceInfo());
     97                std::shared_ptr<ResourceInfo> ptr(std::make_shared<ResourceInfo>());
    9898                ptr->filename = name;
    9999                ptr->path = it->path;
     
    102102                ptr->size = it->uncompressedSize;
    103103#if OGRE_VERSION >= 0x010800
    104                 if (dynamic_cast<const Ogre::FileSystemArchive*>(it->archive) != NULL)
     104                if (dynamic_cast<const Ogre::FileSystemArchive*>(it->archive) != nullptr)
    105105#else
    106                 if (dynamic_cast<Ogre::FileSystemArchive*>(it->archive) != NULL)
     106                if (dynamic_cast<Ogre::FileSystemArchive*>(it->archive) != nullptr)
    107107#endif
    108108                {
     
    114114            }
    115115        }
    116         return shared_ptr<ResourceInfo>();
     116        return std::shared_ptr<ResourceInfo>();
    117117    }
    118118
     
    121121        StringVectorPtr resourceNames(new Ogre::StringVector());
    122122        const Ogre::StringVector& groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
    123         for (Ogre::StringVector::const_iterator it = groups.begin(); it != groups.end(); ++it)
     123        for (const std::string& group : groups)
    124124        {
    125             StringVectorPtr temp = Ogre::ResourceGroupManager::getSingleton().findResourceNames(*it, pattern);
     125            StringVectorPtr temp = Ogre::ResourceGroupManager::getSingleton().findResourceNames(group, pattern);
    126126            resourceNames->insert(resourceNames->end(), temp->begin(), temp->end());
    127127        }
  • code/branches/cpp11_v3/src/libraries/core/Resource.h

    r8351 r11054  
    4242#include "CorePrereqs.h"
    4343
    44 #include <boost/shared_ptr.hpp>
     44#include <memory>
     45
    4546#include <OgreDataStream.h>
    4647#include <OgreStringVector.h>
     
    9394
    9495        //! Similar to open(string, string, bool), but with a fileInfo struct
    95         static DataStreamPtr open(shared_ptr<ResourceInfo> fileInfo)
     96        static DataStreamPtr open(std::shared_ptr<ResourceInfo> fileInfo)
    9697        {
    9798            return open(fileInfo->filename);
     
    125126            Fully qualified name of the file to test for
    126127        */
    127         static shared_ptr<ResourceInfo> getInfo(const std::string& name);
     128        static std::shared_ptr<ResourceInfo> getInfo(const std::string& name);
    128129
    129130        /**
     
    140141
    141142    private:
    142         Resource();
    143         ~Resource();
    144         Resource(const Resource& instance);
     143        // static class, no instances allowed:
     144        Resource() = delete;
     145        Resource(const Resource&) = delete;
     146        Resource& operator=(const Resource&) = delete;
     147        ~Resource() = delete;
    145148    };
    146149}
  • code/branches/cpp11_v3/src/libraries/core/Template.cc

    r9667 r11054  
    4949        this->bLoadDefaults_ = true;
    5050        this->bIsReturningXMLElement_ = false;
    51         this->baseclassIdentifier_ = 0;
     51        this->baseclassIdentifier_ = nullptr;
    5252    }
    5353
     
    176176        {
    177177            orxout(internal_warning, context::templates) << "Template with name " << name << " doesn't exist." << endl;
    178             return 0;
     178            return nullptr;
    179179        }
    180180    }
  • code/branches/cpp11_v3/src/libraries/core/Template.h

    r9667 r11054  
    5454            virtual ~Template();
    5555
    56             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    57             virtual void changedName();
     56            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
     57            virtual void changedName() override;
    5858
    5959            inline void setLink(const std::string& link)
  • code/branches/cpp11_v3/src/libraries/core/Thread.cc

    r8399 r11054  
    3434
    3535#include <cassert>
     36#include <functional>
    3637#include <boost/thread/thread.hpp>
    37 #include <boost/bind.hpp>
    3838#include <boost/thread/mutex.hpp>
    3939#include <boost/thread/thread_time.hpp>
     
    4848
    4949    Thread::Thread():
    50         executor_(0),
     50        executor_(nullptr),
    5151        isWorking_(false),
    5252        stopThread_(false)
     
    5555        this->isWorkingMutex_ = new boost::mutex;
    5656        this->stopThreadMutex_ = new boost::mutex;
    57         this->workerThread_ = new boost::thread( boost::bind(&Thread::threadLoop, this) );
     57        this->workerThread_ = new boost::thread( std::bind(&Thread::threadLoop, this) );
    5858    }
    5959
     
    102102                (*executor)();
    103103                this->executorMutex_->lock();
    104                 this->executor_ = 0;
     104                this->executor_ = nullptr;
    105105                this->executorMutex_->unlock();
    106106                this->isWorkingMutex_->lock();
  • code/branches/cpp11_v3/src/libraries/core/ThreadPool.cc

    r8394 r11054  
    8383    bool ThreadPool::passFunction( const ExecutorPtr& executor, bool addThread )
    8484    {
    85         std::vector<Thread*>::iterator it;
    86         for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
     85        for ( Thread* thread : threadPool_ )
    8786        {
    88             if ( ! (*it)->isWorking() )
     87            if ( ! thread->isWorking() )
    8988            {
    9089                // If that fails, then there is some code error
    91                 OrxVerify( (*it)->evaluateExecutor( executor ), "ERROR: could not evaluate Executor" );
     90                OrxVerify( thread->evaluateExecutor( executor ), "ERROR: could not evaluate Executor" );
    9291                return true;
    9392            }
     
    105104    void ThreadPool::synchronise()
    106105    {
    107         std::vector<Thread*>::iterator it;
    108         for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
     106        for ( Thread* thread : this->threadPool_ )
    109107        {
    110             (*it)->waitUntilFinished();
     108            thread->waitUntilFinished();
    111109        }
    112110    }
  • code/branches/cpp11_v3/src/libraries/core/ThreadWin.cc

    r8706 r11054  
    3131
    3232#include <cassert>
     33// #include <functional>
    3334// #include <boost/thread/thread.hpp>
    34 // #include <boost/bind.hpp>
    3535// #include <boost/thread/mutex.hpp>
    3636// #include <boost/thread/thread_time.hpp>
     
    4545
    4646    Thread::Thread():
    47         executor_(0),
     47        executor_(nullptr),
    4848        isWorking_(false),
    4949        stopThread_(false)
     
    5252//         this->isWorkingMutex_ = new boost::mutex;
    5353//         this->stopThreadMutex_ = new boost::mutex;
    54 //         this->workerThread_ = new boost::thread( boost::bind(&Thread::threadLoop, this) );
     54//         this->workerThread_ = new boost::thread( std::bind(&Thread::threadLoop, this) );
    5555    }
    5656
     
    101101//                 (*executor)();
    102102//                 this->executorMutex_->lock();
    103 //                 this->executor_ = 0;
     103//                 this->executor_ = nullptr;
    104104//                 this->executorMutex_->unlock();
    105105//                 this->isWorkingMutex_->lock();
  • code/branches/cpp11_v3/src/libraries/core/ViewportEventListener.h

    r9667 r11054  
    4444        protected:
    4545            ViewportEventListener();
    46             virtual ~ViewportEventListener() {}
     46            virtual ~ViewportEventListener() = default;
    4747    };
    4848}
  • code/branches/cpp11_v3/src/libraries/core/WindowEventListener.cc

    r10624 r11054  
    4545    /*static*/ void WindowEventListener::moveWindow()
    4646    {
    47         for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
    48             it->windowMoved();
     47        for (WindowEventListener* listener : ObjectList<WindowEventListener>())
     48            listener->windowMoved();
    4949    }
    5050
     
    5454        windowWidth_s = newWidth;
    5555        windowHeight_s = newHeight;
    56         for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
    57             it->windowResized(newWidth, newHeight);
     56        for (WindowEventListener* listener : ObjectList<WindowEventListener>())
     57            listener->windowResized(newWidth, newHeight);
    5858    }
    5959
     
    6161    /*static*/ void WindowEventListener::changeWindowFocus(bool bFocus)
    6262    {
    63         for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
    64             it->windowFocusChanged(bFocus);
     63        for (WindowEventListener* listener : ObjectList<WindowEventListener>())
     64            listener->windowFocusChanged(bFocus);
    6565    }
    6666}
  • code/branches/cpp11_v3/src/libraries/core/WindowEventListener.h

    r9667 r11054  
    4747        protected:
    4848            WindowEventListener();
    49             virtual ~WindowEventListener() { }
     49            virtual ~WindowEventListener() = default;
    5050
    5151            //! Returns the current render window width
  • code/branches/cpp11_v3/src/libraries/core/XMLNameListener.h

    r9667 r11054  
    4444        public:
    4545            XMLNameListener();
    46             virtual ~XMLNameListener() {}
     46            virtual ~XMLNameListener() = default;
    4747
    4848            virtual void loadedNewXMLName(BaseObject* object) = 0;
  • code/branches/cpp11_v3/src/libraries/core/XMLPort.h

    r9667 r11054  
    245245            return my_added_objects[index];
    246246          else
    247             return 0;
     247            return nullptr;
    248248        }
    249249      @endcode
     
    334334            XMLPortParamContainer()
    335335                { this->parseResult_ = PR_not_started; }
    336             virtual ~XMLPortParamContainer() {}
     336            virtual ~XMLPortParamContainer() = default;
    337337
    338338            inline const std::string& getName() const
     
    378378            }
    379379
    380             ~XMLPortClassParamContainer()
    381             {
    382             }
    383 
    384380            XMLPortParamContainer& port(BaseObject* owner, T* object, Element& xmlelement, XMLPort::Mode mode)
    385381            {
     
    399395                            // Iterate through the attributes manually in order to make them case insensitive
    400396                            ticpp::Attribute* attribute = xmlelement.FirstAttribute(false);
    401                             while (attribute != 0)
     397                            while (attribute != nullptr)
    402398                            {
    403399                                this->owner_->xmlAttributes_[getLowercase(attribute->Name())] = attribute->Value();
     
    459455            }
    460456
    461             virtual XMLPortParamContainer& defaultValue(unsigned int index, const MultiType& param)
     457            virtual XMLPortParamContainer& defaultValue(unsigned int index, const MultiType& param) override
    462458            {
    463459                if (!this->loadexecutor_->defaultValueSet(index))
     
    465461                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    466462            }
    467             virtual XMLPortParamContainer& defaultValues(const MultiType& param1)
     463            virtual XMLPortParamContainer& defaultValues(const MultiType& param1) override
    468464            {
    469465                if (!this->loadexecutor_->defaultValueSet(0))
     
    471467                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    472468            }
    473             virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2)
     469            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2) override
    474470            {
    475471                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)))
     
    477473                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    478474            }
    479             virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)
     475            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3) override
    480476            {
    481477                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)) || (!this->loadexecutor_->defaultValueSet(2)))
     
    483479                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    484480            }
    485             virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)
     481            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4) override
    486482            {
    487483                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)) || (!this->loadexecutor_->defaultValueSet(2)) || (!this->loadexecutor_->defaultValueSet(3)))
     
    489485                return this->portIfWaitingForDefaultValues(this->parseResult_, this->parseParams_);
    490486            }
    491             virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)
     487            virtual XMLPortParamContainer& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) override
    492488            {
    493489                if ((!this->loadexecutor_->defaultValueSet(0)) || (!this->loadexecutor_->defaultValueSet(1)) || (!this->loadexecutor_->defaultValueSet(2)) || (!this->loadexecutor_->defaultValueSet(3)) || (!this->loadexecutor_->defaultValueSet(4)))
     
    511507            XMLPortObjectContainer()
    512508                { this->bApplyLoaderMask_ = false; }
    513             virtual ~XMLPortObjectContainer() {}
     509            virtual ~XMLPortObjectContainer() = default;
    514510
    515511            XMLPortObjectContainer& port(BaseObject* object, Element& xmlelement, XMLPort::Mode mode);
     
    552548            }
    553549
    554             ~XMLPortClassObjectContainer()
    555             {
    556             }
    557 
    558             void callLoadExecutor(BaseObject* object, BaseObject* newObject)
     550            virtual void callLoadExecutor(BaseObject* object, BaseObject* newObject) override
    559551            {
    560552                T* castObject = orxonox_cast<T*>(object);
  • code/branches/cpp11_v3/src/libraries/core/class/Identifiable.cc

    r10624 r11054  
    4848    Identifiable::Identifiable()
    4949    {
    50         this->identifier_ = 0;
     50        this->identifier_ = nullptr;
    5151        this->objectPointers_.reserve(6); // Optimisation
    5252
  • code/branches/cpp11_v3/src/libraries/core/class/Identifiable.h

    r9667 r11054  
    9898                registered in the class hierarchy.
    9999            @return
    100                 Returns NULL if the no pointer was found.
     100                Returns nullptr if the no pointer was found.
    101101            */
    102102            ORX_FORCEINLINE void* getDerivedPointer(unsigned int classID)
     
    107107                        return this->objectPointers_[i].second;
    108108                }
    109                 return NULL;
     109                return nullptr;
    110110            }
    111111
     
    121121
    122122            /// 'Fast map' that holds this-pointers of all derived types
    123             std::vector<std::pair<unsigned int, void*> > objectPointers_;
     123            std::vector<std::pair<unsigned int, void*>> objectPointers_;
    124124    };
    125125}
  • code/branches/cpp11_v3/src/libraries/core/class/Identifier.cc

    r10624 r11054  
    7979            delete this->factory_;
    8080
    81         for (std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it)
    82             delete (*it);
     81        for (const InheritsFrom* manualDirectParent : this->manualDirectParents_)
     82            delete manualDirectParent;
    8383
    8484        // erase this Identifier from all related identifiers
    85         for (std::list<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)
    86             const_cast<Identifier*>(*it)->children_.erase(this);
    87         for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
    88             const_cast<Identifier*>(*it)->directChildren_.erase(this);
    89         for (std::set<const Identifier*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)
    90             const_cast<Identifier*>(*it)->parents_.remove(this);
    91         for (std::set<const Identifier*>::const_iterator it = this->directChildren_.begin(); it != this->directChildren_.end(); ++it)
    92             const_cast<Identifier*>(*it)->directParents_.remove(this);
    93 
    94         for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
    95             delete (it->second);
    96         for (std::map<std::string, XMLPortParamContainer*>::iterator it = this->xmlportParamContainers_.begin(); it != this->xmlportParamContainers_.end(); ++it)
    97             delete (it->second);
    98         for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
    99             delete (it->second);
     85        for (const Identifier* parent : this->parents_)
     86            const_cast<Identifier*>(parent)->children_.erase(this);
     87        for (const Identifier* directParent : this->directParents_)
     88            const_cast<Identifier*>(directParent)->directChildren_.erase(this);
     89        for (const Identifier* child : this->children_)
     90            const_cast<Identifier*>(child)->parents_.remove(this);
     91        for (const Identifier* directChild : this->directChildren_)
     92            const_cast<Identifier*>(directChild)->directParents_.remove(this);
     93
     94        for (const auto& mapEntry : this->configValues_)
     95            delete (mapEntry.second);
     96        for (const auto& mapEntry : this->xmlportParamContainers_)
     97            delete (mapEntry.second);
     98        for (const auto& mapEntry : this->xmlportObjectContainers_)
     99            delete (mapEntry.second);
    100100    }
    101101
     
    117117            orxout(user_error) << "Aborting..." << endl;
    118118            abort();
    119             return 0;
     119            return nullptr;
    120120        }
    121121    }
     
    157157        if (this->directParents_.empty())
    158158        {
    159             for (std::list<const Identifier*>::const_iterator it = initializationTrace.begin(); it != initializationTrace.end(); ++it)
    160                 if (*it != this)
    161                     this->parents_.push_back(*it);
     159            for (const Identifier* identifier : initializationTrace)
     160                if (identifier != this)
     161                    this->parents_.push_back(identifier);
    162162        }
    163163        else
     
    184184
    185185            // initialize all parents
    186             for (std::list<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)
    187                 const_cast<Identifier*>(*it)->finishInitialization(); // initialize parent
     186            for (const Identifier* parent : this->parents_)
     187                const_cast<Identifier*>(parent)->finishInitialization(); // initialize parent
    188188
    189189            // parents of parents are no direct parents of this identifier
    190190            this->directParents_ = this->parents_;
    191             for (std::list<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)
    192                 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)
    193                     this->directParents_.remove(*it_parent_parent);
     191            for (const Identifier* parent : this->parents_)
     192                for (const Identifier* parent_parent : const_cast<Identifier*>(parent)->parents_)
     193                    this->directParents_.remove(parent_parent);
    194194
    195195            this->verifyIdentifierTrace();
     
    200200
    201201            // initialize all direct parents
    202             for (std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it)
     202            for (const InheritsFrom* manualDirectParent : this->manualDirectParents_)
    203203            {
    204                 Identifier* directParent = (*it)->getParent();
     204                Identifier* directParent = manualDirectParent->getParent();
    205205                this->directParents_.push_back(directParent);
    206206                directParent->finishInitialization(); // initialize parent
     
    208208
    209209            // direct parents and their parents are also parents of this identifier (but only add them once)
    210             for (std::list<const Identifier*>::const_iterator it_parent = this->directParents_.begin(); it_parent != this->directParents_.end(); ++it_parent)
     210            for (const Identifier* parent : this->directParents_)
    211211            {
    212                 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)
    213                     this->addIfNotExists(this->parents_, *it_parent_parent);
    214                 this->addIfNotExists(this->parents_, *it_parent);
     212                for (const Identifier* parent_parent : const_cast<Identifier*>(parent)->parents_)
     213                    this->addIfNotExists(this->parents_, parent_parent);
     214                this->addIfNotExists(this->parents_, parent);
    215215            }
    216216        }
     
    224224
    225225        // tell all parents that this identifier is a child
    226         for (std::list<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)
    227             const_cast<Identifier*>(*it)->children_.insert(this);
     226        for (const Identifier* parent : this->parents_)
     227            const_cast<Identifier*>(parent)->children_.insert(this);
    228228
    229229        // tell all direct parents that this identifier is a direct child
    230         for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
    231         {
    232             const_cast<Identifier*>(*it)->directChildren_.insert(this);
     230        for (const Identifier* directChild : this->directParents_)
     231        {
     232            const_cast<Identifier*>(directChild)->directChildren_.insert(this);
    233233
    234234            // Create the super-function dependencies
    235             (*it)->createSuperFunctionCaller();
     235            directChild->createSuperFunctionCaller();
    236236        }
    237237
     
    261261
    262262        // if any parent class is virtual, it will be instantiated first, so we need to add them first.
    263         for (std::list<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)
    264         {
    265             if ((*it_parent)->isVirtualBase())
     263        for (const Identifier* parent : this->parents_)
     264        {
     265            if (parent->isVirtualBase())
    266266            {
    267                 for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)
    268                     this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);
    269                 this->addIfNotExists(expectedIdentifierTrace, *it_parent);
     267                for (const Identifier* parent_parent : const_cast<Identifier*>(parent)->parents_)
     268                    this->addIfNotExists(expectedIdentifierTrace, parent_parent);
     269                this->addIfNotExists(expectedIdentifierTrace, parent);
    270270            }
    271271        }
    272272
    273273        // now all direct parents get created recursively. already added identifiers (e.g. virtual base classes) are not added again.
    274         for (std::list<const Identifier*>::const_iterator it_parent = this->directParents_.begin(); it_parent != this->directParents_.end(); ++it_parent)
    275         {
    276             for (std::list<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)
    277                 this->addIfNotExists(expectedIdentifierTrace, *it_parent_parent);
    278             this->addIfNotExists(expectedIdentifierTrace, *it_parent);
     274        for (const Identifier* directParent : this->directParents_)
     275        {
     276            for (const Identifier* parent_parent : const_cast<Identifier*>(directParent)->parents_)
     277                this->addIfNotExists(expectedIdentifierTrace, parent_parent);
     278            this->addIfNotExists(expectedIdentifierTrace, directParent);
    279279        }
    280280
     
    285285
    286286            orxout(internal_warning) << "  Actual trace (after creating a sample instance):" << endl << "    ";
    287             for (std::list<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)
    288                 orxout(internal_warning) << " " << (*it_parent)->getName();
     287            for (const Identifier* parent : this->parents_)
     288                orxout(internal_warning) << " " << parent->getName();
    289289            orxout(internal_warning) << endl;
    290290
    291291            orxout(internal_warning) << "  Expected trace (according to class hierarchy definitions):" << endl << "    ";
    292             for (std::list<const Identifier*>::const_iterator it_parent = expectedIdentifierTrace.begin(); it_parent != expectedIdentifierTrace.end(); ++it_parent)
    293                 orxout(internal_warning) << " " << (*it_parent)->getName();
     292            for (const Identifier* parent : expectedIdentifierTrace)
     293                orxout(internal_warning) << " " << parent->getName();
    294294            orxout(internal_warning) << endl;
    295295
    296296            orxout(internal_warning) << "  Direct parents (according to class hierarchy definitions):" << endl << "    ";
    297             for (std::list<const Identifier*>::const_iterator it_parent = this->directParents_.begin(); it_parent != this->directParents_.end(); ++it_parent)
    298                 orxout(internal_warning) << " " << (*it_parent)->getName();
     297            for (const Identifier* directParent : this->directParents_)
     298                orxout(internal_warning) << " " << directParent->getName();
    299299            orxout(internal_warning) << endl;
    300300        }
     
    393393            return it->second;
    394394        else
    395             return 0;
     395            return nullptr;
    396396    }
    397397
     
    407407            return it->second;
    408408        else
    409             return 0;
     409            return nullptr;
    410410    }
    411411
     
    438438            return it->second;
    439439        else
    440             return 0;
     440            return nullptr;
    441441    }
    442442
  • code/branches/cpp11_v3/src/libraries/core/class/Identifier.h

    r10624 r11054  
    5656    object->getIdentifier()->getName();                                         // returns "MyClass"
    5757
    58     Identifiable* other = object->getIdentifier()->fabricate(0);                // fabricates a new instance of MyClass
     58    Identifiable* other = object->getIdentifier()->fabricate(nullptr);                // fabricates a new instance of MyClass
    5959
    6060
     
    8080#include <typeinfo>
    8181#include <loki/TypeTraits.h>
    82 #include <boost/static_assert.hpp>
    83 #include <boost/type_traits/is_base_of.hpp>
    8482
    8583#include "util/Output.h"
     
    120118        public:
    121119            Identifier(const std::string& name, Factory* factory, bool bLoadable);
    122             Identifier(const Identifier& identifier); // don't copy
    123120            virtual ~Identifier();
     121
     122            // non-copyable:
     123            Identifier(const Identifier&) = delete;
     124            Identifier& operator=(const Identifier&) = delete;
    124125
    125126            /// Returns the name of the class the Identifier belongs to.
     
    137138
    138139            /// Returns true if the Identifier has a Factory.
    139             inline bool hasFactory() const { return (this->factory_ != 0); }
     140            inline bool hasFactory() const { return (this->factory_ != nullptr); }
    140141
    141142            Identifiable* fabricate(Context* context);
     
    269270    class ClassIdentifier : public Identifier
    270271    {
    271         BOOST_STATIC_ASSERT((boost::is_base_of<Identifiable, T>::value));
     272        static_assert(std::is_base_of<Identifiable, T>::value, "ClassIdentifier can only be used with Identifiables");
    272273
    273274        #ifndef DOXYGEN_SHOULD_SKIP_THIS
     
    279280            ClassIdentifier(const std::string& name, Factory* factory, bool bLoadable) : Identifier(name, factory, bLoadable)
    280281            {
    281                 OrxVerify(ClassIdentifier<T>::classIdentifier_s == NULL, "Assertion failed in ClassIdentifier of type " << typeid(T).name());
     282                OrxVerify(ClassIdentifier<T>::classIdentifier_s == nullptr, "Assertion failed in ClassIdentifier of type " << typeid(T).name());
    282283                ClassIdentifier<T>::classIdentifier_s = this;
    283284
     
    291292            bool initializeObject(T* object);
    292293
    293             virtual void updateConfigValues(bool updateChildren = true) const;
    294 
    295             virtual const std::type_info& getTypeInfo()
     294            virtual void updateConfigValues(bool updateChildren = true) const override;
     295
     296            virtual const std::type_info& getTypeInfo() override
    296297                { return typeid(T); }
    297298
    298             virtual bool canDynamicCastObjectToIdentifierClass(Identifiable* object) const
    299                 { return dynamic_cast<T*>(object) != 0; }
    300 
    301             virtual void destroyObjects();
     299            virtual bool canDynamicCastObjectToIdentifierClass(Identifiable* object) const override
     300                { return dynamic_cast<T*>(object) != nullptr; }
     301
     302            virtual void destroyObjects() override;
    302303
    303304            static ClassIdentifier<T>* getIdentifier();
    304305
    305306        private:
    306             ClassIdentifier(const ClassIdentifier<T>& identifier) {}    // don't copy
     307            // non-copyable:
     308            ClassIdentifier(const ClassIdentifier<T>&) = delete;
     309            ClassIdentifier& operator=(const ClassIdentifier<T>&) = delete;
    307310
    308311            void setConfigValues(T* object, Configurable*) const;
     
    321324            void updateConfigValues(bool updateChildren, Identifiable*) const;
    322325
    323             static WeakPtr<ClassIdentifier<T> > classIdentifier_s;
     326            static WeakPtr<ClassIdentifier<T>> classIdentifier_s;
    324327    };
    325328
    326329    template <class T>
    327     WeakPtr<ClassIdentifier<T> > ClassIdentifier<T>::classIdentifier_s;
     330    WeakPtr<ClassIdentifier<T>> ClassIdentifier<T>::classIdentifier_s;
    328331
    329332    /**
     
    334337    /*static*/ inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()
    335338    {
    336         if (ClassIdentifier<T>::classIdentifier_s == NULL)
     339        if (ClassIdentifier<T>::classIdentifier_s == nullptr)
    337340            ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*) IdentifierManager::getInstance().getIdentifierByTypeInfo(typeid(T));
    338341
    339         OrxVerify(ClassIdentifier<T>::classIdentifier_s != NULL, "Did you forget to register the class of type " << typeid(T).name() << "?");
     342        OrxVerify(ClassIdentifier<T>::classIdentifier_s != nullptr, "Did you forget to register the class of type " << typeid(T).name() << "?");
    340343        return ClassIdentifier<T>::classIdentifier_s;
    341344    }
     
    365368
    366369            // Add pointer of type T to the map in the Identifiable instance that enables "dynamic_casts"
    367             object->objectPointers_.push_back(std::make_pair(this->getClassID(), static_cast<void*>(object)));
     370            object->objectPointers_.emplace_back(this->getClassID(), static_cast<void*>(object));
    368371            return false;
    369372        }
     
    408411    void ClassIdentifier<T>::destroyObjects()
    409412    {
    410         this->destroyObjects((T*)0);
     413        this->destroyObjects((T*)nullptr);
    411414    }
    412415
     
    417420    void ClassIdentifier<T>::destroyObjects(Listable*)
    418421    {
    419         ObjectListBase* objectList = Context::getRootContext()->getObjectList(this);
    420         ObjectListElement<T>* begin = static_cast<ObjectListElement<T>*>(objectList->begin());
    421         ObjectListElement<T>* end = static_cast<ObjectListElement<T>*>(objectList->end());
    422         for (typename ObjectList<T>::iterator it = begin; it != end; )
     422        ObjectList<T> list(Context::getRootContext()->getObjectList(this));
     423        for (typename ObjectList<T>::iterator it = list.begin(); it != list.end(); )
    423424            this->destroyObject(*(it++));
    424425    }
     
    451452    void ClassIdentifier<T>::updateConfigValues(bool updateChildren) const
    452453    {
    453         this->updateConfigValues(updateChildren, static_cast<T*>(NULL));
     454        this->updateConfigValues(updateChildren, static_cast<T*>(nullptr));
    454455    }
    455456
     
    460461            return;
    461462
    462         for (ObjectListIterator<T> it = ObjectList<T>::begin(); it; ++it)
    463             this->setConfigValues(*it, *it);
     463        for (T* object : ObjectList<T>())
     464            this->setConfigValues(object, object);
    464465
    465466        if (updateChildren)
    466             for (std::set<const Identifier*>::const_iterator it = this->getChildren().begin(); it != this->getChildren().end(); ++it)
    467                 (*it)->updateConfigValues(false);
     467            for (const Identifier* child : this->getChildren())
     468                child->updateConfigValues(false);
    468469    }
    469470
     
    483484        registered in the class hierarchy.
    484485    @return
    485         Returns NULL if the cast is not possible
     486        Returns nullptr if the cast is not possible
    486487    @note
    487         In case of NULL return (and using MSVC), a dynamic_cast might still be possible if
     488        In case of nullptr return (and using MSVC), a dynamic_cast might still be possible if
    488489        a class forgot to register its objects.
    489490        Also note that the function is implemented differently for GCC/MSVC.
     
    494495#ifdef ORXONOX_COMPILER_MSVC
    495496        typedef Loki::TypeTraits<typename Loki::TypeTraits<T>::PointeeType>::NonConstType ClassType;
    496         if (source != NULL)
     497        if (source != nullptr)
    497498            return source->template getDerivedPointer<ClassType>(ClassIdentifier<ClassType>::getIdentifier()->getClassID());
    498499        else
    499             return NULL;
     500            return nullptr;
    500501#else
    501502        return dynamic_cast<T>(source);
  • code/branches/cpp11_v3/src/libraries/core/class/IdentifierManager.cc

    r10624 r11054  
    4444namespace orxonox
    4545{
    46     IdentifierManager* IdentifierManager::singletonPtr_s = 0;
     46    IdentifierManager* IdentifierManager::singletonPtr_s = nullptr;
    4747
    4848    IdentifierManager::IdentifierManager()
    4949    {
    5050        this->hierarchyCreatingCounter_s = 0;
    51         this->recordTraceForIdentifier_ = NULL;
     51        this->recordTraceForIdentifier_ = nullptr;
    5252    }
    5353
     
    6060
    6161        this->identifiers_.insert(identifier);
     62        this->identifierByTypeIndex_[identifier->getTypeInfo()] = identifier;
    6263        this->identifierByString_[identifier->getName()] = identifier;
    6364        this->identifierByLowercaseString_[getLowercase(identifier->getName())] = identifier;
     
    7172    {
    7273        this->identifiers_.erase(identifier);
     74        this->identifierByTypeIndex_.erase(identifier->getTypeInfo());
    7375        this->identifierByString_.erase(identifier->getName());
    7476        this->identifierByLowercaseString_.erase(getLowercase(identifier->getName()));
     
    9294        // iterate over all identifiers, create one instance of each class and initialize the identifiers
    9395        {
    94             Context temporaryContext(NULL);
    95             for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
     96            Context temporaryContext(nullptr);
     97            for (Identifier* identifier : this->identifiers_)
    9698            {
    97                 Identifier* identifier = (*it);
    9899                if (identifier->isInitialized())
    99100                    continue;
     
    108109                    Identifiable* temp = identifier->fabricate(&temporaryContext);
    109110
    110                     this->recordTraceForIdentifier_ = NULL;
     111                    this->recordTraceForIdentifier_ = nullptr;
    111112
    112113                    if (temp->getIdentifier() != identifier)
     
    127128
    128129        // finish the initialization of all identifiers
    129         for (std::set<Identifier*>::const_iterator it = initializedIdentifiers.begin(); it != initializedIdentifiers.end(); ++it)
    130             (*it)->finishInitialization();
     130        for (Identifier* initializedIdentifier : initializedIdentifiers)
     131            initializedIdentifier->finishInitialization();
    131132
    132133        // only check class hierarchy in dev mode because it's an expensive operation and it requires a developer to fix detected problems anyway.
     
    144145    {
    145146        // check if there are any uninitialized identifiers remaining
    146         for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
    147             if (!(*it)->isInitialized())
    148                 orxout(internal_error) << "Identifier was registered late and is not initialized: " << (*it)->getName() << " / " << (*it)->getTypeInfo().name() << endl;
     147        for (Identifier* identifier : this->identifiers_)
     148            if (!identifier->isInitialized())
     149                orxout(internal_error) << "Identifier was registered late and is not initialized: " << identifier->getName() << " / " << identifier->getTypeInfo().name() << endl;
    149150
    150151        // for all initialized identifiers, check if a sample instance behaves as expected according to the class hierarchy
    151         Context temporaryContext(NULL);
    152         for (std::set<Identifier*>::const_iterator it1 = initializedIdentifiers.begin(); it1 != initializedIdentifiers.end(); ++it1)
     152        Context temporaryContext(nullptr);
     153        for (Identifier* initializedIdentifier : initializedIdentifiers)
    153154        {
    154             if (!(*it1)->hasFactory())
     155            if (!initializedIdentifier->hasFactory())
    155156                continue;
    156157
    157             Identifiable* temp = (*it1)->fabricate(&temporaryContext);
    158 
    159             for (std::set<Identifier*>::const_iterator it2 = this->identifiers_.begin(); it2 != this->identifiers_.end(); ++it2)
     158            Identifiable* temp = initializedIdentifier->fabricate(&temporaryContext);
     159
     160            for (Identifier* identifier : this->identifiers_)
    160161            {
    161                 bool isA_AccordingToRtti = (*it2)->canDynamicCastObjectToIdentifierClass(temp);
    162                 bool isA_AccordingToClassHierarchy = temp->isA((*it2));
     162                bool isA_AccordingToRtti = identifier->canDynamicCastObjectToIdentifierClass(temp);
     163                bool isA_AccordingToClassHierarchy = temp->isA(identifier);
    163164
    164165                if (isA_AccordingToRtti != isA_AccordingToClassHierarchy)
    165166                {
    166                     orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << (*it1)->getName() <<
    167                         (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << (*it2)->getName() << " but RTTI says the opposite." << endl;
     167                    orxout(internal_error) << "Class hierarchy does not match RTTI: Class hierarchy claims that " << initializedIdentifier->getName() <<
     168                        (isA_AccordingToClassHierarchy ? " is a " : " is not a ") << identifier->getName() << " but RTTI says the opposite." << endl;
    168169                }
    169170            }
     
    184185    {
    185186        orxout(internal_status) << "Destroy class-hierarchy" << endl;
    186         for (std::set<Identifier*>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
    187             (*it)->reset();
     187        for (Identifier* identifier : this->identifiers_)
     188            identifier->reset();
    188189    }
    189190
     
    221222            return it->second;
    222223        else
    223             return 0;
     224            return nullptr;
    224225    }
    225226
     
    235236            return it->second;
    236237        else
    237             return 0;
     238            return nullptr;
    238239    }
    239240
     
    249250            return it->second;
    250251        else
    251             return 0;
     252            return nullptr;
    252253    }
    253254
     
    259260    Identifier* IdentifierManager::getIdentifierByTypeInfo(const std::type_info& typeInfo)
    260261    {
    261         // TODO: use std::type_index and a map to find identifiers by type_info (only with c++11)
    262         for (std::set<Identifier*>::iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); ++it)
    263             if ((*it)->getTypeInfo() == typeInfo)
    264                 return (*it);
    265         return 0;
     262        auto it = this->identifierByTypeIndex_.find(typeInfo);
     263        if (it != this->identifierByTypeIndex_.end())
     264            return it->second;
     265        else
     266            return nullptr;
    266267    }
    267268
  • code/branches/cpp11_v3/src/libraries/core/class/IdentifierManager.h

    r10624 r11054  
    3737#include "core/CorePrereqs.h"
    3838
     39#include <typeindex>
    3940#include <map>
     41#include <unordered_map>
    4042#include <set>
    4143#include <list>
     
    5254        public:
    5355            IdentifierManager();
    54             ~IdentifierManager() {}
     56            ~IdentifierManager() = default;
    5557
    5658            void addIdentifier(Identifier* identifier);
     
    9395
    9496        private:
    95             IdentifierManager(const IdentifierManager&); // not implemented
     97            // non-copyable:
     98            IdentifierManager(const IdentifierManager&) = delete;
     99            IdentifierManager& operator=(const IdentifierManager&) = delete;
    96100
    97101            /// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
     
    102106                { hierarchyCreatingCounter_s--; }
    103107
    104             std::set<Identifier*> identifiers_;                              //!< All identifiers. This is only used internally.
    105             std::map<std::string, Identifier*> identifierByString_;          //!< Map that stores all Identifiers with their names.
    106             std::map<std::string, Identifier*> identifierByLowercaseString_; //!< Map that stores all Identifiers with their names in lowercase.
    107             std::map<uint32_t, Identifier*> identifierByNetworkId_;          //!< Returns the map that stores all Identifiers with their network IDs.
     108            std::set<Identifier*> identifiers_;                                      //!< All identifiers. This is only used internally.
     109            std::unordered_map<std::type_index, Identifier*> identifierByTypeIndex_; //!< Map that stores all Identifiers with their type_index.
     110            std::map<std::string, Identifier*> identifierByString_;                  //!< Map that stores all Identifiers with their names.
     111            std::map<std::string, Identifier*> identifierByLowercaseString_;         //!< Map that stores all Identifiers with their names in lowercase.
     112            std::map<uint32_t, Identifier*> identifierByNetworkId_;                  //!< Returns the map that stores all Identifiers with their network IDs.
    108113
    109114            int hierarchyCreatingCounter_s;                         //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
     
    111116            /// Used while creating the object hierarchy to keep track of the identifiers of a newly created object (and all other objects that get created as
    112117            /// a consequence of this, e.g. nested member objects).
    113             std::map<Identifiable*, std::list<const Identifier*> > identifierTraceOfNewObject_;
     118            std::map<Identifiable*, std::list<const Identifier*>> identifierTraceOfNewObject_;
    114119            Identifier* recordTraceForIdentifier_; //!< The identifier for which we want to record the trace of identifiers during object creation. If null, no trace is recorded.
    115120
  • code/branches/cpp11_v3/src/libraries/core/class/SubclassIdentifier.h

    r9667 r11054  
    127127                    else
    128128                    {
    129                         orxout(internal_error) << "Can't assign NULL identifier" << endl;
     129                        orxout(internal_error) << "Can't assign nullptr identifier" << endl;
    130130                    }
    131131                }
     
    189189                    orxout(user_error) << "Aborting..." << endl;
    190190                    abort();
    191                     return 0;
     191                    return nullptr;
    192192                }
    193193            }
  • code/branches/cpp11_v3/src/libraries/core/class/Super.h

    r10624 r11054  
    9494            static void superCheck() \
    9595            { \
    96                 SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \
     96                SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(nullptr)); \
    9797                SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); \
    9898            } \
     
    103103            { \
    104104                ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); \
    105                 for (std::set<const Identifier*>::iterator it = identifier->getDirectChildren().begin(); it != identifier->getDirectChildren().end(); ++it) \
     105                for (const Identifier* child : identifier->getDirectChildren()) \
    106106                { \
    107                     if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
     107                    if (((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_) \
    108108                    { \
    109                         delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_; \
    110                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0; \
    111                         ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false; \
     109                        delete ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_; \
     110                        ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = nullptr; \
     111                        ((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ = false; \
    112112                    } \
    113113                    \
    114                     if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
     114                    if (!((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_) \
    115115                    { \
    116                         orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)(*it))->getName() << endl; \
    117                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \
     116                        orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)child)->getName() << endl; \
     117                        ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \
    118118                    } \
    119                     else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) \
    120                         orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; \
     119                    else if (((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) \
     120                        orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)child)->getName() << " calls function of " << ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; \
    121121                } \
    122122            } \
     
    154154                // This call to the apply-function is the whole check. By calling the function with
    155155                // a T* pointer, the right function get's called.
    156                 SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0));
     156                SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(nullptr));
    157157
    158158                // Go go the superCheck for of next super-function (functionnumber + 1)
     
    171171
    172172                // Iterate through all children
    173                 for (std::set<const Identifier*>::iterator it = identifier->getDirectChildren().begin(); it != identifier->getDirectChildren().end(); ++it)
     173                for (const Identifier* child : identifier->getDirectChildren())
    174174                {
    175175                    // Check if the caller is a fallback-caller
    176                     if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
     176                    if (((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_)
    177177                    {
    178178                        // Delete the fallback caller an prepare to get a real caller
    179                         delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_;
    180                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0;
    181                         ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false;
     179                        delete ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_;
     180                        ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = nullptr;
     181                        ((ClassIdentifier<T>*)child)->bSuperFunctionCaller_##functionname##_isFallback_ = false;
    182182                    }
    183183
    184184                    // Check if there's not already a caller
    185                     if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
     185                    if (!((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_)
    186186                    {
    187187                        // Add the SuperFunctionCaller
    188                         orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << endl;
    189                         ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;
     188                        orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*)child)->getName() << endl;
     189                        ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;
    190190                    }
    191191
    192192                    // If there is already a caller, but for another parent, print a warning
    193                     else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier())
    194                         orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl;
     193                    else if (((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier())
     194                        orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)child)->getName() << " calls function of " << ((ClassIdentifier<T>*)child)->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl;
    195195                }
    196196            }
     
    584584        // Creates the super-function-callers by calling the first SuperFunctionCondition check
    585585        // This get's called within the initialization of an Identifier
    586         virtual void createSuperFunctionCaller() const
     586        virtual void createSuperFunctionCaller() const override
    587587        {
    588588            SuperFunctionCondition<0, T, 0, 0>::superCheck();
  • code/branches/cpp11_v3/src/libraries/core/command/ArgumentCompletionFunctions.cc

    r10624 r11054  
    7777            bool groupIsVisible(const std::map<std::string, ConsoleCommand*>& group, bool bOnlyShowHidden)
    7878            {
    79                 for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = group.begin(); it_command != group.end(); ++it_command)
    80                     if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden)
     79                for (const auto& mapEntry : group)
     80                    if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden)
    8181                        return true;
    8282
     
    9999
    100100                // get all the groups that are visible (except the shortcut group "")
    101                 const std::map<std::string, std::map<std::string, ConsoleCommand*> >& commands = ConsoleCommandManager::getInstance().getCommands();
    102                 for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group)
    103                     if (groupIsVisible(it_group->second, bOnlyShowHidden) && it_group->first != "" && (fragmentLC == "" || getLowercase(it_group->first).find(fragmentLC) == 0))
    104                         groupList.push_back(ArgumentCompletionListElement(it_group->first, getLowercase(it_group->first)));
     101                const std::map<std::string, std::map<std::string, ConsoleCommand*>>& commands = ConsoleCommandManager::getInstance().getCommands();
     102                for (const auto& mapEntry : commands)
     103                    if (groupIsVisible(mapEntry.second, bOnlyShowHidden) && mapEntry.first != "" && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0))
     104                        groupList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
    105105
    106106                // now add all shortcuts (in group "")
    107                 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.find("");
     107                std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = commands.find("");
    108108                if (it_group != commands.end())
    109109                {
    110110                    // add a line-break if the list isn't empty
    111111                    if (!groupList.empty())
    112                         groupList.push_back(ArgumentCompletionListElement("", "", "\n"));
     112                        groupList.emplace_back("", "", "\n");
    113113
    114114                    // add the shortcuts
    115                     for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
    116                         if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(it_command->first).find(fragmentLC) == 0))
    117                             groupList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
     115                    for (const auto& mapEntry : it_group->second)
     116                        if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0))
     117                            groupList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
    118118                }
    119119
     
    138138
    139139                // find the iterator of the given group
    140                 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommands().begin();
     140                std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = ConsoleCommandManager::getInstance().getCommands().begin();
    141141                for ( ; it_group != ConsoleCommandManager::getInstance().getCommands().end(); ++it_group)
    142142                    if (getLowercase(it_group->first) == groupLC)
     
    146146                if (it_group != ConsoleCommandManager::getInstance().getCommands().end())
    147147                {
    148                     for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
    149                         if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden)
    150                             commandList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
     148                    for (const auto& mapEntry : it_group->second)
     149                        if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden)
     150                            commandList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
    151151                }
    152152
     
    188188            {
    189189                ArgumentCompletionList list;
    190                 list.push_back(ArgumentCompletionListElement("", "", hint));
     190                list.emplace_back("", "", hint);
    191191                return list;
    192192            }
     
    212212            if (tokens.size() == 1)
    213213            {
    214                 std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommands().find(tokens[0]);
     214                std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = ConsoleCommandManager::getInstance().getCommands().find(tokens[0]);
    215215                if (it_group != ConsoleCommandManager::getInstance().getCommands().end())
    216216                    return detail::_subcommands(fragment, tokens[0], true);
     
    261261                {
    262262                    if (boost::filesystem::is_directory(*file))
    263                         dirlist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/'));
     263                        dirlist.emplace_back(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/');
    264264                    else
    265                         filelist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF()));
     265                        filelist.emplace_back(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF());
    266266                    ++file;
    267267                }
     
    281281
    282282            const std::set<std::string>& names = SettingsConfigFile::getInstance().getSectionNames();
    283             for (std::set<std::string>::const_iterator it = names.begin(); it != names.end(); ++it)
    284                 sectionList.push_back(ArgumentCompletionListElement(*it, getLowercase(*it)));
     283            for (const std::string& name : names)
     284                sectionList.emplace_back(name, getLowercase(name));
    285285
    286286            return sectionList;
     
    298298            SettingsConfigFile::ContainerMap::const_iterator upper = settings.getContainerUpperBound(sectionLC);
    299299            for (SettingsConfigFile::ContainerMap::const_iterator it = settings.getContainerLowerBound(sectionLC); it != upper; ++it)
    300                 entryList.push_back(ArgumentCompletionListElement(it->second.second->getName(), it->second.first));
     300                entryList.emplace_back(it->second.second->getName(), it->second.first);
    301301
    302302            return entryList;
     
    319319                {
    320320                    const std::string& valuestring = it->second.second->toString();
    321                     oldValue.push_back(ArgumentCompletionListElement(valuestring, getLowercase(valuestring), "Old value: " + valuestring));
     321                    oldValue.emplace_back(valuestring, getLowercase(valuestring), "Old value: " + valuestring);
    322322                }
    323323            }
     
    334334            ArgumentCompletionList threads;
    335335
    336             for (std::list<unsigned int>::const_iterator it = threadnumbers.begin(); it != threadnumbers.end(); ++it)
    337                 threads.push_back(ArgumentCompletionListElement(multi_cast<std::string>(*it)));
     336            for (unsigned int threadnumber : threadnumbers)
     337                threads.emplace_back(multi_cast<std::string>(threadnumber));
    338338
    339339            return threads;
  • code/branches/cpp11_v3/src/libraries/core/command/ArgumentCompletionFunctions.h

    r11052 r11054  
    8686        {
    8787            for (int month = 1; month <= 12; ++month)
    88                 list.push_back(ArgumentCompletionListElement(multi_cast<std::string>(month)));
     88                list.emplace_back(multi_cast<std::string>(month));
    8989        }
    9090        else
    9191        {
    92             list.push_back(ArgumentCompletionListElement("January",   "january"));
    93             list.push_back(ArgumentCompletionListElement("February",  "february"));
    94             list.push_back(ArgumentCompletionListElement("March",     "march"));
    95             list.push_back(ArgumentCompletionListElement("April",     "april"));
    96             list.push_back(ArgumentCompletionListElement("May",       "may"));
    97             list.push_back(ArgumentCompletionListElement("June",      "june"));
    98             list.push_back(ArgumentCompletionListElement("July",      "july"));
    99             list.push_back(ArgumentCompletionListElement("August",    "august"));
    100             list.push_back(ArgumentCompletionListElement("September", "september"));
    101             list.push_back(ArgumentCompletionListElement("October",   "october"));
    102             list.push_back(ArgumentCompletionListElement("November",  "november"));
    103             list.push_back(ArgumentCompletionListElement("December",  "december"));
     92            list.emplace_back("January",   "january");
     93            list.emplace_back("February",  "february");
     94            list.emplace_back("March",     "march");
     95            list.emplace_back("April",     "april");
     96            list.emplace_back("May",       "may");
     97            list.emplace_back("June",      "june");
     98            list.emplace_back("July",      "july");
     99            list.emplace_back("August",    "august");
     100            list.emplace_back("September", "september");
     101            list.emplace_back("October",   "october");
     102            list.emplace_back("November",  "november");
     103            list.emplace_back("December",  "december");
    104104        }
    105105
  • code/branches/cpp11_v3/src/libraries/core/command/CommandEvaluation.cc

    r10624 r11054  
    5454    void CommandEvaluation::initialize(const std::string& command)
    5555    {
    56         this->execCommand_ = 0;
    57         this->hintCommand_ = 0;
     56        this->execCommand_ = nullptr;
     57        this->hintCommand_ = nullptr;
    5858        this->string_ = command;
    5959        this->execArgumentsOffset_ = 0;
     
    119119    /**
    120120        @brief Executes the command which was evaluated by this object and returns its return-value.
    121         @param error A pointer to an integer (or NULL) which will be used to write error codes to (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
     121        @param error A pointer to an integer (or nullptr) which will be used to write error codes to (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
    122122        @return Returns the result of the command (or MultiType::Null if there is no return value)
    123123    */
     
    306306                // the user typed 1-2 arguments, check what he tried to type and print a suitable error
    307307                std::string groupLC = getLowercase(this->getToken(0));
    308                 for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().begin(); it_group != ConsoleCommandManager::getInstance().getCommandsLC().end(); ++it_group)
    309                     if (it_group->first == groupLC)
     308                for (const auto& mapEntry : ConsoleCommandManager::getInstance().getCommandsLC())
     309                    if (mapEntry.first == groupLC)
    310310                        return std::string("Error: There is no command in group \"") + this->getToken(0) + "\" starting with \"" + this->getToken(1) + "\".";
    311311
     
    328328
    329329        // iterate through all groups and their commands and calculate the distance to the current command. keep the best.
    330         for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().begin(); it_group != ConsoleCommandManager::getInstance().getCommandsLC().end(); ++it_group)
    331         {
    332             if (it_group->first != "")
    333             {
    334                 for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); ++it_name)
    335                 {
    336                     std::string command = it_group->first + " " + it_name->first;
     330        for (const auto& mapEntryGroup : ConsoleCommandManager::getInstance().getCommandsLC())
     331        {
     332            if (mapEntryGroup.first != "")
     333            {
     334                for (const auto& mapEntryName : mapEntryGroup.second)
     335                {
     336                    std::string command = mapEntryGroup.first + " " + mapEntryName.first;
    337337                    unsigned int distance = getLevenshteinDistance(command, token0_LC + " " + token1_LC);
    338338                    if (distance < nearestDistance)
     
    346346
    347347        // now also iterate through all shortcuts and keep the best if it's better than the one found above.
    348         std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().find("");
     348        std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = ConsoleCommandManager::getInstance().getCommandsLC().find("");
    349349        if (it_group !=  ConsoleCommandManager::getInstance().getCommandsLC().end())
    350350        {
    351             for (std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); ++it_name)
    352             {
    353                 std::string command = it_name->first;
     351            for (const auto& mapEntry : it_group->second)
     352            {
     353                std::string command = mapEntry.first;
    354354                unsigned int distance = getLevenshteinDistance(command, token0_LC);
    355355                if (distance < nearestDistance)
     
    429429    {
    430430        size_t count = 0;
    431         for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    432             if (it->getComparable() != "")
     431        for (const ArgumentCompletionListElement& element : list)
     432            if (element.getComparable() != "")
    433433                ++count;
    434434        return count;
     
    495495        {
    496496            // only one (non-empty) value in the list - search it and return it
    497             for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    498             {
    499                 if (it->getComparable() != "")
     497            for (const ArgumentCompletionListElement& element : list)
     498            {
     499                if (element.getComparable() != "")
    500500                {
    501501                    // arguments that have a separate string to be displayed need a little more care - just return them without modification. add a space character to the others.
    502                     if (it->hasDisplay())
    503                         return (it->getString());
     502                    if (element.hasDisplay())
     503                        return (element.getString());
    504504                    else
    505                         return (it->getString() + ' ');
     505                        return (element.getString() + ' ');
    506506                }
    507507            }
     
    517517                char tempComparable = '\0';
    518518                char temp = '\0';
    519                 for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    520                 {
    521                     const std::string& argumentComparable = it->getComparable();
    522                     const std::string& argument = it->getString();
     519                for (const ArgumentCompletionListElement& element : list)
     520                {
     521                    const std::string& argumentComparable = element.getComparable();
     522                    const std::string& argument = element.getString();
    523523
    524524                    // ignore empty arguments
     
    560560    {
    561561        std::string output;
    562         for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    563         {
    564             output += it->getDisplay();
     562        for (const ArgumentCompletionListElement& element : list)
     563        {
     564            output += element.getDisplay();
    565565
    566566            // add a space character between two elements for all non-empty arguments
    567             if (it->getComparable() != "")
     567            if (element.getComparable() != "")
    568568                output += ' ';
    569569        }
  • code/branches/cpp11_v3/src/libraries/core/command/CommandEvaluation.h

    r8079 r11054  
    8686
    8787            int execute();
    88             MultiType query(int* error = 0);
     88            MultiType query(int* error = nullptr);
    8989
    9090            std::string complete();
     
    9797            /// Returns true if the command evaluation contains a valid command that can be executed.
    9898            inline bool isValid() const
    99                 { return (this->execCommand_ != 0); }
     99                { return (this->execCommand_ != nullptr); }
    100100
    101101            /// Returns the console command that was evaluated by this object.
     
    137137            static std::string getCommonBegin(const ArgumentCompletionList& list);
    138138
    139             const ConsoleCommand* execCommand_;             ///< The command that will be executed (can be NULL if the command is not valid)
     139            const ConsoleCommand* execCommand_;             ///< The command that will be executed (can be nullptr if the command is not valid)
    140140            const ConsoleCommand* hintCommand_;             ///< The command that is used to display hints and argument lists (can be different to execCommand_ in some cases)
    141141            SubString tokens_;                              ///< The single words of the command string, split into tokens
  • code/branches/cpp11_v3/src/libraries/core/command/CommandExecutor.cc

    r10624 r11054  
    8181        @brief Executes a command and returns its return-value.
    8282        @param command A string containing the command
    83         @param error A pointer to a value (or NULL) where the error-code should be written to (see @ref CommandExecutorErrorCodes "error codes")
     83        @param error A pointer to a value (or nullptr) where the error-code should be written to (see @ref CommandExecutorErrorCodes "error codes")
    8484        @param useTcl If true, the command is passed to tcl (see TclBind)
    8585        @return Returns the return-value of the command (if any - MultiType::Null otherwise)
     
    127127        @brief Executes a command and returns its return-value as string.
    128128        @param command A string containing the command
    129         @param error A pointer to a value (or NULL) where the error-code should be written to (see @ref CommandExecutorErrorCodes "error codes")
     129        @param error A pointer to a value (or nullptr) where the error-code should be written to (see @ref CommandExecutorErrorCodes "error codes")
    130130        @param useTcl If true, the command is passed to tcl (see TclBind)
    131131        @return Returns the return-value of the command converted to a string (or "" if there's no return value)
     
    275275        {
    276276            // it is valid - copy the executor of this command
    277             ExecutorPtr executor = new Executor(*evaluation.getConsoleCommand()->getExecutor().get());
     277            ExecutorPtr executor = std::make_shared<Executor>(*evaluation.getConsoleCommand()->getExecutor().get());
    278278
    279279            // evaluate the arguments and if this returns no error, store them as default values
  • code/branches/cpp11_v3/src/libraries/core/command/CommandExecutor.h

    r8858 r11054  
    113113            static int execute(const std::string& command, bool useTcl = true, bool printErrors = true); // tolua_export
    114114
    115             static MultiType queryMT(const std::string& command, int* error = 0, bool useTcl = true);
    116             static std::string query(const std::string& command, int* error = 0, bool useTcl = true); // tolua_export
     115            static MultiType queryMT(const std::string& command, int* error = nullptr, bool useTcl = true);
     116            static std::string query(const std::string& command, int* error = NULL, bool useTcl = true); // tolua_export
    117117
    118118            static CommandEvaluation evaluate(const std::string& command);
    119119
    120             static const int Success = 0;       ///< Error code for "success" (or no error)
    121             static const int Inexistent = 1;    ///< Error code if the command doesn't exist
    122             static const int Incomplete = 2;    ///< Error code if the command needs more arguments
    123             static const int Deactivated = 3;   ///< Error code if the command is not active
    124             static const int Denied = 4;        ///< Error code if the command needs a different access level
    125             static const int Error = 5;         ///< Error code if the command returned an error
     120            static constexpr int Success = 0;       ///< Error code for "success" (or no error)
     121            static constexpr int Inexistent = 1;    ///< Error code if the command doesn't exist
     122            static constexpr int Incomplete = 2;    ///< Error code if the command needs more arguments
     123            static constexpr int Deactivated = 3;   ///< Error code if the command is not active
     124            static constexpr int Denied = 4;        ///< Error code if the command needs a different access level
     125            static constexpr int Error = 5;         ///< Error code if the command returned an error
    126126
    127127            static std::string getErrorDescription(int error);
     
    132132
    133133        private:
    134             CommandExecutor() {}                            ///< Empty constructor
    135             CommandExecutor(const CommandExecutor& other);  ///< Not implemented copy-constructor
    136             ~CommandExecutor() {}                           ///< Empty destructor
     134            CommandExecutor() = default;                      ///< Empty constructor
     135            ~CommandExecutor() = default;                     ///< Empty destructor
     136
     137            // non-copyable:
     138            CommandExecutor(const CommandExecutor&) = delete;
     139            CommandExecutor& operator=(const CommandExecutor&) = delete;
    137140
    138141            static CommandExecutor& getInstance();
  • code/branches/cpp11_v3/src/libraries/core/command/ConsoleCommand.cc

    r10624 r11054  
    5050    */
    5151    ConsoleCommand::ConsoleCommand(const std::string& name, const ExecutorPtr& executor, bool bInitialized)
    52     {
    53         this->init("", name, executor, bInitialized);
     52        : ConsoleCommand("", name, executor, bInitialized)
     53    {
    5454    }
    5555
     
    7575        this->baseFunctor_ = executor->getFunctor();
    7676
    77         for (size_t i = 0; i < MAX_FUNCTOR_ARGUMENTS; ++i)
    78             this->argumentCompleter_[i] = 0;
     77        for (ArgumentCompleter*& completer : this->argumentCompleter_)
     78            completer = nullptr;
    7979
    8080        this->keybindMode_ = KeybindMode::OnPress;
     
    8484            this->executor_ = executor;
    8585
    86         this->names_.push_back(CommandName(group, name));
     86        this->names_.emplace_back(group, name);
    8787    }
    8888
     
    9999    ConsoleCommand& ConsoleCommand::addShortcut()
    100100    {
    101         this->names_.push_back(CommandName("", this->baseName_));
     101        this->names_.emplace_back("", this->baseName_);
    102102        return *this;
    103103    }
     
    108108    ConsoleCommand& ConsoleCommand::addShortcut(const std::string&  name)
    109109    {
    110         this->names_.push_back(CommandName("", name));
     110        this->names_.emplace_back("", name);
    111111        return *this;
    112112    }
     
    117117    ConsoleCommand& ConsoleCommand::addGroup(const std::string& group)
    118118    {
    119         this->names_.push_back(CommandName(group, this->baseName_));
     119        this->names_.emplace_back(group, this->baseName_);
    120120        return *this;
    121121    }
     
    126126    ConsoleCommand& ConsoleCommand::addGroup(const std::string& group, const std::string&  name)
    127127    {
    128         this->names_.push_back(CommandName(group, name));
     128        this->names_.emplace_back(group, name);
    129129        return *this;
    130130    }
     
    320320    {
    321321        if (this->executor_)
    322             this->pushFunction(new Executor(*this->executor_.get()));
     322            this->pushFunction(std::make_shared<Executor>(*this->executor_.get()));
    323323        else
    324324            orxout(internal_error, context::commands) << "Couldn't push copy of executor in console command \"" << this->baseName_ << "\", no executor set." << endl;
     
    348348
    349349    /**
    350         @brief Sets the functor to NULL (which also deactivates the command).
     350        @brief Sets the functor to nullptr (which also deactivates the command).
    351351    */
    352352    void ConsoleCommand::resetFunction()
    353353    {
    354354        if (this->executor_)
    355             this->executor_->setFunctor(0);
     355            this->executor_->setFunctor(nullptr);
    356356        this->objectStack_.clear();
    357357    }
     
    405405    void ConsoleCommand::popObject()
    406406    {
    407         void* newobject = 0;
     407        void* newobject = nullptr;
    408408        if (!this->objectStack_.empty())
    409409        {
     
    422422            return this->executor_->getFunctor()->getRawObjectPointer();
    423423        else
    424             return 0;
     424            return nullptr;
    425425    }
    426426
     
    528528            return this->argumentCompleter_[index];
    529529        else
    530             return 0;
     530            return nullptr;
    531531    }
    532532
  • code/branches/cpp11_v3/src/libraries/core/command/ConsoleCommand.h

    r10624 r11054  
    195195                        { if (this->command_) { this->command_->popFunction(); } return *this; }
    196196
    197                     /// Sets the current function-pointer to NULL, which also deactivates the command.
     197                    /// Sets the current function-pointer to nullptr, which also deactivates the command.
    198198                    inline ConsoleCommandManipulator& resetFunction()
    199199                        { if (this->command_) { this->command_->resetFunction(); } return *this; }
     
    205205                    inline ConsoleCommandManipulator& pushObject(void* object)
    206206                        { if (this->command_) { this->command_->pushObject(object); } return *this; }
    207                     /// Removes the current object from the object-stack and restores the old object (or NULL if there's no object left on the stack).
     207                    /// Removes the current object from the object-stack and restores the old object (or nullptr if there's no object left on the stack).
    208208                    inline ConsoleCommandManipulator& popObject()
    209209                        { if (this->command_) { this->command_->popObject(); } return *this; }
  • code/branches/cpp11_v3/src/libraries/core/command/ConsoleCommandIncludes.h

    r10624 r11054  
    316316            ~StaticallyInitializedConsoleCommand() { delete command_; }
    317317
    318             virtual void load();
    319             virtual void unload();
     318            virtual void load() override;
     319            virtual void unload() override;
    320320
    321321            inline ConsoleCommand& getCommand()
     
    331331        @brief Returns a manipulator for a command with the given name.
    332332
    333         @note If the command doesn't exist, the manipulator contains a NULL pointer to the command,
     333        @note If the command doesn't exist, the manipulator contains a nullptr to the command,
    334334        but it can still be used without checks, because all functions of ConsoleCommandManipulator
    335335        check internally if the command exists.
     
    340340        @brief Returns a manipulator for a command with the given group and name.
    341341
    342         @note If the command doesn't exist, the manipulator contains a NULL pointer to the command,
     342        @note If the command doesn't exist, the manipulator contains a nullptr to the command,
    343343        but it can still be used without checks, because all functions of ConsoleCommandManipulator
    344344        check internally if the command exists.
  • code/branches/cpp11_v3/src/libraries/core/command/ConsoleCommandManager.cc

    r11052 r11054  
    3939namespace orxonox
    4040{
    41     ConsoleCommandManager* ConsoleCommandManager::singletonPtr_s = 0;
     41    ConsoleCommandManager* ConsoleCommandManager::singletonPtr_s = nullptr;
    4242
    4343    /**
     
    5050    {
    5151        // find the group
    52         std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = this->commandMap_.find(group);
     52        std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = this->commandMap_.find(group);
    5353        if (it_group != this->commandMap_.end())
    5454        {
     
    6868                orxout(internal_error, context::commands) << "Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << endl;
    6969        }
    70         return 0;
     70        return nullptr;
    7171    }
    7272
     
    8383
    8484        // find the group
    85         std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = this->commandMapLC_.find(groupLC);
     85        std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = this->commandMapLC_.find(groupLC);
    8686        if (it_group != this->commandMapLC_.end())
    8787        {
     
    101101                orxout(internal_error, context::commands) << "Couldn't find console command with group \"" << group << "\" and name \"" << name << "\"" << endl;
    102102        }
    103         return 0;
     103        return nullptr;
    104104    }
    105105
     
    125125
    126126        // check if a command with this name already exists
    127         if (this->getCommand(group, name) != 0)
     127        if (this->getCommand(group, name) != nullptr)
    128128        {
    129129            if (group == "")
     
    146146    {
    147147        // iterate through all groups
    148         for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::iterator it_group = this->commandMap_.begin(); it_group != this->commandMap_.end(); )
     148        for (std::map<std::string, std::map<std::string, ConsoleCommand*>>::iterator it_group = this->commandMap_.begin(); it_group != this->commandMap_.end(); )
    149149        {
    150150            // iterate through all commands of each group
     
    168168
    169169        // iterate through all groups
    170         for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::iterator it_group = this->commandMapLC_.begin(); it_group != this->commandMapLC_.end(); )
     170        for (std::map<std::string, std::map<std::string, ConsoleCommand*>>::iterator it_group = this->commandMapLC_.begin(); it_group != this->commandMapLC_.end(); )
    171171        {
    172172            // iterate through all commands of each group
  • code/branches/cpp11_v3/src/libraries/core/command/ConsoleCommandManager.h

    r10624 r11054  
    3939#include "util/Singleton.h"
    4040
     41#include <map>
     42
    4143namespace orxonox
    4244{
     
    5456
    5557            /// Returns the map with all groups and commands.
    56             inline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommands()
     58            inline const std::map<std::string, std::map<std::string, ConsoleCommand*>>& getCommands()
    5759                { return this->commandMap_; }
    5860            /// Returns the map with all groups and commands in lowercase.
    59             inline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandsLC()
     61            inline const std::map<std::string, std::map<std::string, ConsoleCommand*>>& getCommandsLC()
    6062                { return this->commandMapLC_; }
    6163
     
    7173
    7274        private:
    73             std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMap_;
    74             std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMapLC_;
     75            std::map<std::string, std::map<std::string, ConsoleCommand*>> commandMap_;
     76            std::map<std::string, std::map<std::string, ConsoleCommand*>> commandMapLC_;
    7577
    7678            static ConsoleCommandManager* singletonPtr_s;
  • code/branches/cpp11_v3/src/libraries/core/command/Executor.cc

    r9550 r11054  
    6767
    6868    /**
    69         @brief Destructor
    70     */
    71     Executor::~Executor()
    72     {
    73     }
    74 
    75     /**
    7669        @brief Calls the wrapped function with arguments that are passed in a string.
    7770        @param arguments The arguments that should be passed to the function, separated by @a delimiter
    78         @param error A pointer to a variable (or NULL) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
     71        @param error A pointer to a variable (or nullptr) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
    7972        @param delimiter The delimiter that is used to separate the arguments in the string @a arguments
    8073        @param bPrintError If true, errors are printed to the console if the function couldn't be executed with the given arguments
     
    8982        @brief Calls the wrapped function with arguments that are passed as tokens in a SubString
    9083        @param arguments The arguments that should be passed to the function
    91         @param error A pointer to a variable (or NULL) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
     84        @param error A pointer to a variable (or nullptr) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
    9285        @param delimiter The delimiter that was used to separate the arguments in the SubString @a arguments (used to join the surplus arguments)
    9386        @param bPrintError If true, errors are printed to the console if the function couldn't be executed with the given arguments
     
    127120        @param arguments The arguments that should be converted
    128121        @param arg An array of MultiType where the converted arguments will be stored
    129         @param error A pointer to a variable (or NULL) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
     122        @param error A pointer to a variable (or nullptr) that is used to store the error code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
    130123        @param delimiter The delimiter that was used to separate the arguments in the SubString @a arguments (used to join the surplus arguments)
    131124        @return Returns the number of evaluated arguments
  • code/branches/cpp11_v3/src/libraries/core/command/Executor.h

    r9550 r11054  
    4242    orxonox::Executor is used to wrap an orxonox::Functor and to store default values for
    4343    its parameters. Usually one uses the function createExecutor() to create a new executor.
    44     This function returns an orxonox::ExecutorPtr which is a typedef of @ref orxonox::SharedPtr
    45     "SharedPtr<Executor>", used to manage the pointer to the executor.
     44    This function returns an orxonox::ExecutorPtr which is a typedef of "std::shared_ptr<Executor>",
     45    used to manage the pointer to the executor.
    4646
    4747    Executors are mostly used to execute callbacks. Because some callback functions need arguments,
     
    7474    @endcode
    7575
    76     Because executors that were created with createExecutor() are managed by an orxonox::SharedPtr,
    77     they don't need to be deleted after usage.
     76    Executors don't need to be deleted after usage normally because they are managed by an
     77    std::shared_ptr when they were created with createExecutor().
    7878*/
    7979
     
    100100            Executor(const FunctorPtr& functor, const std::string& name = "");
    101101            Executor(const Executor& other);
    102             virtual ~Executor();
     102            virtual ~Executor() = default;
    103103
    104104            /// Calls the wrapped function with 0 arguments. If the function needs more arguments, the executor's default values are used.
     
    121121                { return (*this->functor_)(arg1, arg2, arg3, arg4, arg5); }
    122122
    123             MultiType parse(const std::string& arguments, int* error = 0, const std::string& delimiter = " ", bool bPrintError = false) const;
    124             MultiType parse(const SubString& arguments, int* error = 0, const std::string& delimiter = " ", bool bPrintError = false) const;
    125 
    126             int evaluateArguments(const SubString& arguments, MultiType arg[MAX_FUNCTOR_ARGUMENTS], int* error = 0, const std::string& delimiter = " ") const;
     123            MultiType parse(const std::string& arguments, int* error = nullptr, const std::string& delimiter = " ", bool bPrintError = false) const;
     124            MultiType parse(const SubString& arguments, int* error = nullptr, const std::string& delimiter = " ", bool bPrintError = false) const;
     125
     126            int evaluateArguments(const SubString& arguments, MultiType arg[MAX_FUNCTOR_ARGUMENTS], int* error = nullptr, const std::string& delimiter = " ") const;
    127127
    128128            /// Changes the functor.
     
    249249
    250250            /// Overloads Executor::parse() with an additional object-pointer.
    251             MultiType parse(T* object, const std::string& arguments, int* error = 0, const std::string& delimiter = " ", bool bPrintError = false) const
     251            MultiType parse(T* object, const std::string& arguments, int* error = nullptr, const std::string& delimiter = " ", bool bPrintError = false) const
    252252            {
    253253                T* oldobject = this->functorMember_->getObject();
     
    267267    inline ExecutorPtr createExecutor(const FunctorPtr& functor, const std::string& name = "")
    268268    {
    269         return new Executor(functor, name);
     269        return std::make_shared<Executor>(functor, name);
    270270    }
    271271
     
    274274    inline ExecutorMemberPtr<T> createExecutor(const FunctorMemberPtr<T>& functor, const std::string& name = "")
    275275    {
    276         return new ExecutorMember<T>(functor, name);
     276        return std::make_shared<ExecutorMember<T>>(functor, name);
    277277    }
    278278
     
    280280    inline ExecutorStaticPtr createExecutor(const FunctorStaticPtr& functor, const std::string& name = "")
    281281    {
    282         return new ExecutorStatic(functor, name);
     282        return std::make_shared<ExecutorStatic>(functor, name);
    283283    }
    284284}
  • code/branches/cpp11_v3/src/libraries/core/command/ExecutorPtr.h

    r7401 r11054  
    3232    @brief Typedefs and definitions of ExecutorPtr, ExecutorStaticPtr, and ExecutorMemberPtr
    3333
    34     Instances of orxonox::Executor are usually managed by an orxonox::SharedPtr. This ensures
     34    Instances of orxonox::Executor are usually managed by an std::shared_ptr. This ensures
    3535    that Executors will be destroyed after usage. To make things easier, there's a typedef
    36     that defines ExecutorPtr as SharedPtr<Executor>.
     36    that defines ExecutorPtr as std::shared_ptr<Executor>.
    3737
    3838    Because there's not only orxonox::Executor, but also orxonox::ExecutorStatic, and
     
    4949
    5050#include "core/CorePrereqs.h"
    51 #include "util/SharedPtr.h"
     51#include <memory>
    5252
    5353namespace orxonox
    5454{
    55     /// ExecutorPtr is just a typedef of SharedPtr
    56     typedef SharedPtr<Executor> ExecutorPtr;
    57 
    58     /// ExecutorStaticPtr is just a typedef of SharedChildPtr
    59     typedef SharedChildPtr<ExecutorStatic, ExecutorPtr> ExecutorStaticPtr;
    60 
    61     /// It's not possible to use a typedef for ExecutorMemberPtr<T>, so we have to create a child-class instead. It inherits all functions from SharedChildPtr, but needs to (re-)implement some constructors.
     55    using ExecutorPtr = std::shared_ptr<Executor>;
     56    using ExecutorStaticPtr = std::shared_ptr<ExecutorStatic>;
    6257    template <class T>
    63     class ExecutorMemberPtr : public SharedChildPtr<ExecutorMember<T>, ExecutorPtr>
    64     {
    65         public:
    66             inline ExecutorMemberPtr() : SharedChildPtr<ExecutorMember<T>, ExecutorPtr>() {}
    67             inline ExecutorMemberPtr(ExecutorMember<T>* pointer) : SharedChildPtr<ExecutorMember<T>, ExecutorPtr>(pointer) {}
    68             inline ExecutorMemberPtr(const SharedPtr<ExecutorMember<T> >& other) : SharedChildPtr<ExecutorMember<T>, ExecutorPtr>(other) {}
    69     };
     58    using ExecutorMemberPtr = std::shared_ptr<ExecutorMember<T>>;
    7059}
    7160
  • code/branches/cpp11_v3/src/libraries/core/command/Functor.h

    r9667 r11054  
    4040
    4141    To create a Functor, the helper function createFunctor() is used. It returns an instance
    42     of orxonox::FunctorPtr which is simply a typedef of @ref orxonox::SharedPtr "SharedPtr<Functor>".
    43     This means you don't have to delete the Functor after using it, because it is managed
    44     by the SharedPtr.
     42    of orxonox::FunctorPtr which is simply a typedef of "std::shared_ptr<Functor>". This
     43    means you don't have to delete the Functor after using it, because it is managed
     44    by the std::shared_ptr.
    4545
    4646    Example:
     
    187187
    188188        public:
    189             virtual ~Functor() {}
     189            virtual ~Functor() = default;
    190190
    191191            /// Calls the function-pointer with up to five arguments. In case of a member-function, the assigned object-pointer is used to call the function. @return Returns the return-value of the function (if any; MultiType::Null otherwise)
     
    215215            virtual void* getRawObjectPointer() const = 0;
    216216
    217             /// Enables or disables the safe mode which causes the functor to change the object pointer to NULL if the object is deleted (only member functors).
     217            /// Enables or disables the safe mode which causes the functor to change the object pointer to nullptr if the object is deleted (only member functors).
    218218            virtual void setSafeMode(bool bSafeMode) = 0;
    219219
     
    242242        public:
    243243            /// Constructor: Stores the object-pointer.
    244             FunctorMember(O* object = 0) : object_(object), bSafeMode_(false) {}
     244            FunctorMember(O* object = nullptr) : object_(object), bSafeMode_(false) {}
    245245            virtual ~FunctorMember() { if (this->bSafeMode_) { this->unregisterObject(this->object_); } }
    246246
    247             /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MultiType::Null otherwise)
     247            /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be nullptr. @return Returns the return-value of the function (if any; MultiType::Null otherwise)
    248248            virtual MultiType operator()(O* object, const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) = 0;
    249249
    250250            // see Functor::operator()()
    251             MultiType operator()(const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null)
     251            virtual MultiType operator()(const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) override
    252252            {
    253253                // call the function if an object was assigned
     
    262262
    263263            // see Functor::getType()
    264             inline Functor::Type::Enum getType() const
     264            virtual inline Functor::Type::Enum getType() const override
    265265                { return Functor::Type::Member; }
    266266
     
    280280
    281281            // see Functor::setRawObjectPointer()
    282             inline void setRawObjectPointer(void* object)
     282            virtual inline void setRawObjectPointer(void* object) override
    283283                { this->setObject((O*)object); }
    284284            // see Functor::getRawObjectPointer()
    285             inline void* getRawObjectPointer() const
     285            virtual inline void* getRawObjectPointer() const override
    286286                { return this->object_; }
    287287
    288288            // see Functor::setSafeMode()
    289             inline void setSafeMode(bool bSafeMode)
     289            virtual inline void setSafeMode(bool bSafeMode) override
    290290            {
    291291                if (bSafeMode == this->bSafeMode_)
     
    301301
    302302        protected:
    303             /// Casts the object and registers as destruction listener.
    304             inline void registerObject(O* object)
    305                 { Destroyable* base = dynamic_cast<Destroyable*>(object); if (base) { this->registerAsDestructionListener(base); } }
    306             /// Casts the object and unregisters as destruction listener.
    307             inline void unregisterObject(O* object)
    308                 { Destroyable* base = dynamic_cast<Destroyable*>(object); if (base) { this->unregisterAsDestructionListener(base); } }
    309 
    310             /// Will be called by Destroyable::~Destroyable() if the stored object is deleted and the Functor is in safe mode.
    311             inline void objectDeleted()
    312                 { this->object_ = 0; }
    313 
    314             O* object_;     ///< The stored object-pointer, used to execute a member-function (or NULL for static functions)
    315             bool bSafeMode_; ///< If true, the functor is in safe mode and registers itself as listener at the object and changes the pointer to NULL if the object is deleted
     303            /// Casts the object and registers as destruction listener if the object is a Destroyable.
     304            inline void registerObject(Destroyable* object)
     305                { this->registerAsDestructionListener(object); }
     306
     307            inline void registerObject(void* object) {}
     308
     309            /// Casts the object and unregisters as destruction listener if the object is a Destroyable.
     310            inline void unregisterObject(Destroyable* object)
     311                { this->unregisterAsDestructionListener(object); }
     312
     313            inline void unregisterObject(void* object) {}
     314
     315            /// Will be called by Destroyable::~Destroyable() if the stored object is a Destroyable and deleted and the Functor is in safe mode.
     316            virtual inline void objectDeleted() override
     317                { this->object_ = nullptr; }
     318
     319            O* object_;     ///< The stored object-pointer, used to execute a member-function (or nullptr for static functions)
     320            bool bSafeMode_; ///< If true, the functor is in safe mode and registers itself as listener at the object and changes the pointer to nullptr if the object is deleted
    316321    };
    317322
     
    322327        public:
    323328            /// Constructor: Stores the object-pointer.
    324             FunctorMember(void* object = 0) {}
    325 
    326             /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MultiType::Null otherwise)
     329            FunctorMember(void* object = nullptr) {}
     330
     331            /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be nullptr. @return Returns the return-value of the function (if any; MultiType::Null otherwise)
    327332            virtual MultiType operator()(void* object, const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) = 0;
    328333
    329334            // see Functor::operator()()
    330             MultiType operator()(const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null)
    331             {
    332                 return (*this)((void*)0, param1, param2, param3, param4, param5);
     335            virtual MultiType operator()(const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) override
     336            {
     337                return (*this)((void*)nullptr, param1, param2, param3, param4, param5);
    333338            }
    334339
    335340            // see Functor::getType()
    336             inline Functor::Type::Enum getType() const
     341            virtual inline Functor::Type::Enum getType() const override
    337342                { return Functor::Type::Static; }
    338343
    339344            // see Functor::setRawObjectPointer()
    340             inline void setRawObjectPointer(void*)
     345            virtual inline void setRawObjectPointer(void*) override
    341346                { orxout(internal_warning) << "Can't assign an object pointer to a static functor" << endl; }
    342347            // see Functor::getRawObjectPointer()
    343             inline void* getRawObjectPointer() const
    344                 { return 0; }
     348            virtual inline void* getRawObjectPointer() const override
     349                { return nullptr; }
    345350
    346351            // see Functor::setSafeMode()
    347             inline void setSafeMode(bool) {}
     352            virtual inline void setSafeMode(bool) override {}
    348353    };
    349354
     
    352357
    353358    /**
    354         @brief FunctorPointer is a child class of FunctorMember and expands it with a function-pointer.
    355         @param F The type of the function-pointer
    356         @param O The type of the function's class (or void if it's a static function)
     359        @brief FunctorPointer is a child class of FunctorMember and extends it with a function-pointer (or a function-object).
     360        @param F The type of the function-pointer (or the function-object)
     361        @param O The type of the function's class (or void if it's a static function or a function-object)
    357362
    358363        The template FunctorPointer has an additional template parameter that defines the type
    359         of the function-pointer. This can be handy if you want to get or set the function-pointer.
    360         You can then use a static_cast to cast a Functor to FunctorPointer if you know the type
    361         of the function-pointer.
     364        of the function-pointer (or the function-object). This can be handy if you want to get
     365        or set the function-pointer (or the function-object). You can then use a static_cast
     366        to cast a Functor to FunctorPointer if you know the type of the function.
    362367
    363368        However FunctorPointer is not aware of the types of the different parameters or the
     
    369374        public:
    370375            /// Constructor: Initializes the base class and stores the function-pointer.
    371             FunctorPointer(F functionPointer, O* object = 0) : FunctorMember<O>(object), functionPointer_(functionPointer) {}
     376            FunctorPointer(F functionPointer, O* object = nullptr) : FunctorMember<O>(object), functionPointer_(functionPointer) {}
    372377
    373378            /// Changes the function-pointer.
     
    378383                { return this->functionPointer_; }
    379384
    380             // see Functor::getFullIdentifier()
    381             const std::type_info& getFullIdentifier() const
    382                 { return typeid(F); }
    383 
    384385        protected:
    385386            F functionPointer_;     ///< The stored function-pointer
     
    388389    namespace detail
    389390    {
    390         // Helper class to get the type of the function pointer with the given class, parameters, return-value, and constness
    391         template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctionPointer                                            { typedef R (O::*Type)(P1, P2, P3, P4, P5); };
    392         template <class R, class O, class P1, class P2, class P3, class P4, class P5>               struct FunctionPointer<R, O, false, P1, P2, P3, P4, P5>           { typedef R (O::*Type)(P1, P2, P3, P4, P5); };
    393         template <class R, class O, class P1, class P2, class P3, class P4>                         struct FunctionPointer<R, O, false, P1, P2, P3, P4, void>         { typedef R (O::*Type)(P1, P2, P3, P4); };
    394         template <class R, class O, class P1, class P2, class P3>                                   struct FunctionPointer<R, O, false, P1, P2, P3, void, void>       { typedef R (O::*Type)(P1, P2, P3); };
    395         template <class R, class O, class P1, class P2>                                             struct FunctionPointer<R, O, false, P1, P2, void, void, void>     { typedef R (O::*Type)(P1, P2); };
    396         template <class R, class O, class P1>                                                       struct FunctionPointer<R, O, false, P1, void, void, void, void>   { typedef R (O::*Type)(P1); };
    397         template <class R, class O>                                                                 struct FunctionPointer<R, O, false, void, void, void, void, void> { typedef R (O::*Type)(); };
    398         template <class R, class O, class P1, class P2, class P3, class P4, class P5> struct FunctionPointer<R, O, true, P1, P2, P3, P4, P5>           { typedef R (O::*Type)(P1, P2, P3, P4, P5) const; };
    399         template <class R, class O, class P1, class P2, class P3, class P4>           struct FunctionPointer<R, O, true, P1, P2, P3, P4, void>         { typedef R (O::*Type)(P1, P2, P3, P4) const; };
    400         template <class R, class O, class P1, class P2, class P3>                     struct FunctionPointer<R, O, true, P1, P2, P3, void, void>       { typedef R (O::*Type)(P1, P2, P3) const; };
    401         template <class R, class O, class P1, class P2>                               struct FunctionPointer<R, O, true, P1, P2, void, void, void>     { typedef R (O::*Type)(P1, P2) const; };
    402         template <class R, class O, class P1>                                         struct FunctionPointer<R, O, true, P1, void, void, void, void>   { typedef R (O::*Type)(P1) const; };
    403         template <class R, class O>                                                   struct FunctionPointer<R, O, true, void, void, void, void, void> { typedef R (O::*Type)() const; };
    404         template <class R, class P1, class P2, class P3, class P4, class P5> struct FunctionPointer<R, void, false, P1, P2, P3, P4, P5>           { typedef R (*Type)(P1, P2, P3, P4, P5); };
    405         template <class R, class P1, class P2, class P3, class P4>           struct FunctionPointer<R, void, false, P1, P2, P3, P4, void>         { typedef R (*Type)(P1, P2, P3, P4); };
    406         template <class R, class P1, class P2, class P3>                     struct FunctionPointer<R, void, false, P1, P2, P3, void, void>       { typedef R (*Type)(P1, P2, P3); };
    407         template <class R, class P1, class P2>                               struct FunctionPointer<R, void, false, P1, P2, void, void, void>     { typedef R (*Type)(P1, P2); };
    408         template <class R, class P1>                                         struct FunctionPointer<R, void, false, P1, void, void, void, void>   { typedef R (*Type)(P1); };
    409         template <class R>                                                   struct FunctionPointer<R, void, false, void, void, void, void, void> { typedef R (*Type)(); };
    410 
    411         // Helper class, used to call a function-pointer with a given object and parameters and to return its return-value (if available)
    412         template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller                                              { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2, param3, param4, param5); } };
    413         template <class R, class O, bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<R, O, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { return (object->*functionPointer)(param1, param2, param3, param4); } };
    414         template <class R, class O, bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<R, O, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { return (object->*functionPointer)(param1, param2, param3); } };
    415         template <class R, class O, bool isconst, class P1, class P2>                               struct FunctorCaller<R, O, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { return (object->*functionPointer)(param1, param2); } };
    416         template <class R, class O, bool isconst, class P1>                                         struct FunctorCaller<R, O, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (object->*functionPointer)(param1); } };
    417         template <class R, class O, bool isconst>                                                   struct FunctorCaller<R, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (object->*functionPointer)(); } };
    418         template <class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2, param3, param4, param5); return MultiType::Null; } };
    419         template <class O, bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { (object->*functionPointer)(param1, param2, param3, param4); return MultiType::Null; } };
    420         template <class O, bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<void, O, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { (object->*functionPointer)(param1, param2, param3); return MultiType::Null; } };
    421         template <class O, bool isconst, class P1, class P2>                               struct FunctorCaller<void, O, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(param1, param2); return MultiType::Null; } };
    422         template <class O, bool isconst, class P1>                                         struct FunctorCaller<void, O, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(param1); return MultiType::Null; } };
    423         template <class O, bool isconst>                                                   struct FunctorCaller<void, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(); return MultiType::Null; } };
    424         template <class R, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<R, void, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, P4, P5>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2, param3, param4, param5); } };
    425         template <class R, bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<R, void, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { return (*functionPointer)(param1, param2, param3, param4); } };
    426         template <class R, bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<R, void, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { return (*functionPointer)(param1, param2, param3); } };
    427         template <class R, bool isconst, class P1, class P2>                               struct FunctorCaller<R, void, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { return (*functionPointer)(param1, param2); } };
    428         template <class R, bool isconst, class P1>                                         struct FunctorCaller<R, void, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (*functionPointer)(param1); } };
    429         template <class R, bool isconst>                                                   struct FunctorCaller<R, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (*functionPointer)(); } };
    430         template <bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, P5>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2, param3, param4, param5); return MultiType::Null; } };
    431         template <bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { (*functionPointer)(param1, param2, param3, param4); return MultiType::Null; } };
    432         template <bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<void, void, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { (*functionPointer)(param1, param2, param3); return MultiType::Null; } };
    433         template <bool isconst, class P1, class P2>                               struct FunctorCaller<void, void, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(param1, param2); return MultiType::Null; } };
    434         template <bool isconst, class P1>                                         struct FunctorCaller<void, void, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(param1); return MultiType::Null; } };
    435         template <bool isconst>                                                   struct FunctorCaller<void, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(); return MultiType::Null; } };
    436 
    437         // Helper class, used to identify the header of a function-pointer (independent of its class)
    438         template <class R, class P1, class P2, class P3, class P4, class P5>
    439         struct FunctorHeaderIdentifier
    440         {};
     391        // Helper class to get the type of the function-pointer (or the function-object) with the given class, parameters, return-value, and constness
     392        template <class F, class R, class O, bool isconst, class... Params> struct FunctionType /* generic type is undefined */;
     393        template <         class R, class O,               class... Params> struct FunctionType<void, R, O,    false, Params...> { typedef R (O::*Type)(Params...); };       // spezialization: non-const member function
     394        template <         class R, class O,               class... Params> struct FunctionType<void, R, O,    true,  Params...> { typedef R (O::*Type)(Params...) const; }; // spezialization: const member function
     395        template <         class R,                        class... Params> struct FunctionType<void, R, void, false, Params...> { typedef R (*Type)(Params...); };          // spezialization: static function
     396        template <class F, class R,                        class... Params> struct FunctionType<F,    R, void, false, Params...> { typedef F Type; };                        // spezialization: function object
     397
     398        // Helper class, used to call a function with a given object and parameters and to return its return-value (if available)
     399        template <class F, class R, class O, bool isconst, class... Params> struct FunctorCaller /* generic type is undefined */;
     400        template <         class R, class O, bool isconst, class... Params> struct FunctorCaller<void, R,    O,    isconst, Params...> { template <class... UnusedParams> static inline MultiType call(typename detail::FunctionType<void, R,    O,    isconst, Params...>::Type functionPointer, O* object, const Params&... parameters, const UnusedParams&...) { return (object->*functionPointer)(parameters...); } };                  // spezialization: member function with return value
     401        template <                  class O, bool isconst, class... Params> struct FunctorCaller<void, void, O,    isconst, Params...> { template <class... UnusedParams> static inline MultiType call(typename detail::FunctionType<void, void, O,    isconst, Params...>::Type functionPointer, O* object, const Params&... parameters, const UnusedParams&...) { (object->*functionPointer)(parameters...); return MultiType::Null; } }; // spezialization: member function without return value
     402        template <         class R,                        class... Params> struct FunctorCaller<void, R,    void, false,   Params...> { template <class... UnusedParams> static inline MultiType call(typename detail::FunctionType<void, R,    void, false,   Params...>::Type functionPointer, void*,     const Params&... parameters, const UnusedParams&...) { return (*functionPointer)(parameters...); } };                          // spezialization: static function with return value
     403        template <                                         class... Params> struct FunctorCaller<void, void, void, false,   Params...> { template <class... UnusedParams> static inline MultiType call(typename detail::FunctionType<void, void, void, false,   Params...>::Type functionPointer, void*,     const Params&... parameters, const UnusedParams&...) { (*functionPointer)(parameters...); return MultiType::Null; } };         // spezialization: static function without return value
     404        template <class F, class R,                        class... Params> struct FunctorCaller<F,    R,    void, false,   Params...> { template <class... UnusedParams> static inline MultiType call(typename detail::FunctionType<F,    R,    void, false,   Params...>::Type functor,         void*,     const Params&... parameters, const UnusedParams&...) { return functor(parameters...); } };                                     // spezialization: function object with return value
     405        template <class F,                                 class... Params> struct FunctorCaller<F,    void, void, false,   Params...> { template <class... UnusedParams> static inline MultiType call(typename detail::FunctionType<F,    void, void, false,   Params...>::Type functor,         void*,     const Params&... parameters, const UnusedParams&...) { functor(parameters...); return MultiType::Null; } };                    // spezialization: function object without return value
    441406
    442407        // Helper class to determine if a function has a returnvalue
     
    448413        { enum { result = false }; };
    449414
    450         // Helper class to count the number of parameters
    451         template <class P1, class P2, class P3, class P4, class P5>
    452         struct FunctorParamCount
    453         { enum { result = 5 }; };
    454         template <class P1, class P2, class P3, class P4>
    455         struct FunctorParamCount<P1, P2, P3, P4, void>
    456         { enum { result = 4 }; };
    457         template <class P1, class P2, class P3>
    458         struct FunctorParamCount<P1, P2, P3, void, void>
    459         { enum { result = 3 }; };
    460         template <class P1, class P2>
    461         struct FunctorParamCount<P1, P2, void, void, void>
    462         { enum { result = 2 }; };
    463         template <class P1>
    464         struct FunctorParamCount<P1, void, void, void, void>
    465         { enum { result = 1 }; };
     415        // Helper class to determine the N-th parameter of a variadic template (with 0 being the index of the first parameter)
     416        template <int n, typename T = void, typename... Other>
     417        struct GetNthParamType
     418        { typedef typename GetNthParamType<n - 1, Other...>::Type Type; };
     419        template <typename T, typename... Other>
     420        struct GetNthParamType<0, T, Other...>
     421        { typedef T Type; };
     422
     423        // Helper structs to deduce the first N types of a parameter pack
     424        template<class... Types> struct type_list {};
     425
     426        template <class T1, class... AllTypes>
     427        struct make_type_list_helper
     428        {
     429            template <std::size_t N, class... Types>
     430            struct make_type_list_impl : make_type_list_helper<AllTypes...>::template make_type_list_impl<N - 1, Types..., T1> {};
     431
     432            template <class... Types>
     433            struct make_type_list_impl<1u, Types...> : type_list<Types..., T1> {};
     434        };
     435
     436        template <class T1>
     437        struct make_type_list_helper<T1>
     438        {
     439            template <std::size_t N, class... Types>
     440            struct make_type_list_impl : type_list<Types..., T1> {};
     441        };
     442
     443        template <std::size_t N, class... Types>
     444        struct make_type_list : make_type_list_helper<Types...>::template make_type_list_impl<N> {};
     445
     446        template <class... Types>
     447        struct make_type_list<0u, Types...> : type_list<> {};
     448
     449        template <std::size_t N>
     450        struct make_type_list<N> : type_list<> {};
     451
    466452        template <>
    467         struct FunctorParamCount<void, void, void, void, void>
    468         { enum { result = 0 }; };
     453        struct make_type_list<0u> : type_list<> {};
    469454    }
    470455
     
    473458        that need to know the exact types of the parameters, return-value, and class.
    474459
     460        @param F the type of the function-object (or void if a function-pointer is used).
    475461        @param R The type of the return-value of the function
    476462        @param O The class of the function
    477463        @param isconst True if the function is a const member-function
    478         @param P1 The type of the first parameter
    479         @param P2 The type of the second parameter
    480         @param P3 The type of the third parameter
    481         @param P4 The type of the fourth parameter
    482         @param P5 The type of the fifth parameter
     464        @param Params The types of the parameters
    483465
    484466        This template has many parameters and is usually not used directly. It is created by
     
    489471        All template arguments can be void.
    490472    */
    491     template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5>
    492     class FunctorTemplate : public FunctorPointer<typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type, O>
    493     {
     473    template <class F, class R, class O, bool isconst, class... Params>
     474    class FunctorTemplate : public FunctorPointer<typename detail::FunctionType<F, R, O, isconst, Params...>::Type, O>
     475    {
     476        static_assert(sizeof...(Params) <= 5, "Only up to 5 parameters are supported");
     477
    494478        public:
    495479            /// Constructor: Initializes the base class.
    496             FunctorTemplate(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object = 0) : FunctorPointer<typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type, O>(functionPointer, object) {}
     480            FunctorTemplate(typename detail::FunctionType<F, R, O, isconst, Params...>::Type functionPointer, O* object = nullptr) : FunctorPointer<typename detail::FunctionType<F, R, O, isconst, Params...>::Type, O>(functionPointer, object) {}
    497481
    498482            // see FunctorMember::operator()()
    499             MultiType operator()(O* object, const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null)
    500             {
    501                 return detail::FunctorCaller<R, O, isconst, P1, P2, P3, P4, P5>::call(this->functionPointer_, object, param1, param2, param3, param4, param5);
     483            virtual MultiType operator()(O* object, const MultiType& param1 = MultiType::Null, const MultiType& param2 = MultiType::Null, const MultiType& param3 = MultiType::Null, const MultiType& param4 = MultiType::Null, const MultiType& param5 = MultiType::Null) override
     484            {
     485                return detail::FunctorCaller<F, R, O, isconst, Params...>::call(this->functionPointer_, object, param1, param2, param3, param4, param5);
    502486            }
    503487
    504488            // see Functor::clone()
    505             FunctorPtr clone()
    506             {
    507                 return new FunctorTemplate(*this);
     489            virtual FunctorPtr clone() override
     490            {
     491                return std::make_shared<FunctorTemplate>(*this);
    508492            }
    509493
    510494            // see Functor::evaluateArgument()
    511             void evaluateArgument(unsigned int index, MultiType& argument) const
     495            virtual void evaluateArgument(unsigned int index, MultiType& argument) const override
    512496            {
    513497                switch (index)
    514498                {
    515                     case 0: argument.convert<P1>(); break;
    516                     case 1: argument.convert<P2>(); break;
    517                     case 2: argument.convert<P3>(); break;
    518                     case 3: argument.convert<P4>(); break;
    519                     case 4: argument.convert<P5>(); break;
     499                    case 0: argument.convert<typename detail::GetNthParamType<0, Params...>::Type>(); break;
     500                    case 1: argument.convert<typename detail::GetNthParamType<1, Params...>::Type>(); break;
     501                    case 2: argument.convert<typename detail::GetNthParamType<2, Params...>::Type>(); break;
     502                    case 3: argument.convert<typename detail::GetNthParamType<3, Params...>::Type>(); break;
     503                    case 4: argument.convert<typename detail::GetNthParamType<4, Params...>::Type>(); break;
    520504                }
    521505            }
    522506
    523507            // see Functor::getParamCount()
    524             unsigned int getParamCount() const
    525             {
    526                 return detail::FunctorParamCount<P1, P2, P3, P4, P5>::result;
     508            virtual unsigned int getParamCount() const override
     509            {
     510                return sizeof...(Params);
    527511            }
    528512
    529513            // see Functor::hasReturnvalue()
    530             bool hasReturnvalue() const
     514            virtual bool hasReturnvalue() const override
    531515            {
    532516                return detail::FunctorHasReturnvalue<R>::result;
     
    534518
    535519            // see Functor::getTypenameParam()
    536             std::string getTypenameParam(unsigned int index) const
     520            virtual std::string getTypenameParam(unsigned int index) const override
    537521            {
    538522                switch (index)
    539523                {
    540                     case 0:  return typeToString<P1>();
    541                     case 1:  return typeToString<P2>();
    542                     case 2:  return typeToString<P3>();
    543                     case 3:  return typeToString<P4>();
    544                     case 4:  return typeToString<P5>();
     524                    case 0:  return typeToString<typename detail::GetNthParamType<0, Params...>::Type>();
     525                    case 1:  return typeToString<typename detail::GetNthParamType<1, Params...>::Type>();
     526                    case 2:  return typeToString<typename detail::GetNthParamType<2, Params...>::Type>();
     527                    case 3:  return typeToString<typename detail::GetNthParamType<3, Params...>::Type>();
     528                    case 4:  return typeToString<typename detail::GetNthParamType<4, Params...>::Type>();
    545529                    default: return "";
    546530                }
     
    548532
    549533            // see Functor::getTypenameReturnvalue()
    550             std::string getTypenameReturnvalue() const
     534            virtual std::string getTypenameReturnvalue() const override
    551535            {
    552536                return typeToString<R>();
    553537            }
    554538
     539            // see Functor::getFullIdentifier()
     540            virtual const std::type_info& getFullIdentifier() const override
     541            {
     542                return typeid(typename detail::FunctionType<void, R, O, isconst, Params...>::Type);
     543            }
     544
    555545            // see Functor::getHeaderIdentifier()
    556             const std::type_info& getHeaderIdentifier() const
    557             {
    558                 return typeid(detail::FunctorHeaderIdentifier<R, P1, P2, P3, P4, P5>);
     546            virtual const std::type_info& getHeaderIdentifier() const override
     547            {
     548                return typeid(typename detail::FunctionType<void, R, void, false, Params...>::Type);
    559549            }
    560550
    561551            // see Functor::getHeaderIdentifier(unsigned int)
    562             const std::type_info& getHeaderIdentifier(unsigned int params) const
     552            virtual const std::type_info& getHeaderIdentifier(unsigned int params) const override
    563553            {
    564554                switch (params)
    565555                {
    566                     case 0:  return typeid(detail::FunctorHeaderIdentifier<R, void, void, void, void, void>);
    567                     case 1:  return typeid(detail::FunctorHeaderIdentifier<R, P1, void, void, void, void>);
    568                     case 2:  return typeid(detail::FunctorHeaderIdentifier<R, P1, P2, void, void, void>);
    569                     case 3:  return typeid(detail::FunctorHeaderIdentifier<R, P1, P2, P3, void, void>);
    570                     case 4:  return typeid(detail::FunctorHeaderIdentifier<R, P1, P2, P3, P4, void>);
    571                     default: return typeid(detail::FunctorHeaderIdentifier<R, P1, P2, P3, P4, P5>);
     556                    case 0:  return this->getTypelistIdentifier(detail::make_type_list<0, Params...>{});
     557                    case 1:  return this->getTypelistIdentifier(detail::make_type_list<1, Params...>{});
     558                    case 2:  return this->getTypelistIdentifier(detail::make_type_list<2, Params...>{});
     559                    case 3:  return this->getTypelistIdentifier(detail::make_type_list<3, Params...>{});
     560                    case 4:  return this->getTypelistIdentifier(detail::make_type_list<4, Params...>{});
     561                    default: return this->getTypelistIdentifier(detail::make_type_list<5, Params...>{});
    572562                }
    573563            }
     564
     565    private:
     566            /// Helper function that deduces a parameter pack of types and returns the corresponding identifier
     567            template<class... Types>
     568            const std::type_info& getTypelistIdentifier(detail::type_list<Types...>) const
     569            {
     570                return typeid(typename detail::FunctionType<void, R, void, false, Types...>::Type);
     571            }
    574572    };
    575573
    576     template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    577     template <class R, class O, class OO, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4), OO* object)     { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    578     template <class R, class O, class OO, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3), OO* object)         { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    579     template <class R, class O, class OO, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2), OO* object)             { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    580     template <class R, class O, class OO, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1), OO* object)                 { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    581     template <class R, class O, class OO>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(), OO* object)                   { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    582     template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    583     template <class R, class O, class OO, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const, OO* object)     { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    584     template <class R, class O, class OO, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const, OO* object)         { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    585     template <class R, class O, class OO, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const, OO* object)             { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    586     template <class R, class O, class OO, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const, OO* object)                 { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    587     template <class R, class O, class OO>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const, OO* object)                   { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    588 
    589     template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    590     template <class R, class O, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4))     { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    591     template <class R, class O, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3))         { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    592     template <class R, class O, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2))             { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    593     template <class R, class O, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1))                 { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    594     template <class R, class O>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)())                   { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    595     template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    596     template <class R, class O, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const)     { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    597     template <class R, class O, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const)         { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    598     template <class R, class O, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const)             { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    599     template <class R, class O, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const)                 { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    600     template <class R, class O>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const)                   { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    601 
    602     template <class R, class P1, class P2, class P3, class P4, class P5> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, P5>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    603     template <class R, class P1, class P2, class P3, class P4>           inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4))     { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    604     template <class R, class P1, class P2, class P3>                     inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3))         { return new FunctorTemplate<R, void, false, P1, P2, P3, void, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    605     template <class R, class P1, class P2>                               inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2))             { return new FunctorTemplate<R, void, false, P1, P2, void, void, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    606     template <class R, class P1>                                         inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1))                 { return new FunctorTemplate<R, void, false, P1, void, void, void, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    607     template <class R>                                                   inline FunctorStaticPtr createFunctor(R (*functionPointer)())                   { return new FunctorTemplate<R, void, false, void, void, void, void, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
     574
     575    namespace detail
     576    {
     577        // Helper functions to deduce types and constness of operator() and return the correct FunctorTemplate
     578        template <class F>
     579        struct CallableHelper
     580        {
     581            template <class R, class... Params> static inline FunctorStaticPtr create(const F& functionObject, R(F::*)(Params...))       { return std::make_shared<FunctorTemplate<F, R, void, false, Params...>>(functionObject); }
     582            template <class R, class... Params> static inline FunctorStaticPtr create(const F& functionObject, R(F::*)(Params...) const) { return std::make_shared<FunctorTemplate<F, R, void, false, Params...>>(functionObject); } // note: both const and non-const function-objects are treated as static functors with isconst=false.
     583        };
     584    }
     585
     586    template <class R, class O, class OO, class... Params> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(Params...),       OO* object) { return std::make_shared<FunctorTemplate<void, R, O, false, Params...>>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     587    template <class R, class O, class OO, class... Params> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(Params...) const, OO* object) { return std::make_shared<FunctorTemplate<void, R, O, true,  Params...>>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     588
     589    template <class R, class O, class... Params> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(Params...))       { return std::make_shared<FunctorTemplate<void, R, O, false, Params...>>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer
     590    template <class R, class O, class... Params> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(Params...) const) { return std::make_shared<FunctorTemplate<void, R, O, true,  Params...>>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer
     591
     592    template <class R, class... Params> inline FunctorStaticPtr createFunctor(R (*functionPointer)(Params...)) { return std::make_shared<FunctorTemplate<void, R, void, false, Params...>>(functionPointer); } ///< Creates a new FunctorStatic with the given function-pointer
     593
     594    /** Take care that this functor does not outlive objects that have been captured by reference in a lambda. */
     595    template <class F> inline FunctorStaticPtr createFunctor(const F& functionObject) { return detail::CallableHelper<F>::create(functionObject, &F::operator()); } ///< Creates a new Functor with a callable object
    608596}
    609597
  • code/branches/cpp11_v3/src/libraries/core/command/FunctorPtr.h

    r7401 r11054  
    3232    @brief Typedefs and definitions of FunctorPtr, FunctorMemberPtr, FunctorStaticPtr, and FunctorPointerPtr
    3333
    34     Instances of orxonox::Functor are usually managed by an orxonox::SharedPtr. This ensures
     34    Instances of orxonox::Functor are usually managed by an std::shared_ptr. This ensures
    3535    that Functors will be destroyed after usage. To make things easier, there's a typedef
    36     that defines FunctorPtr as SharedPtr<Functor>.
     36    that defines FunctorPtr as std::shared_ptr<Functor>.
    3737
    3838    Because there's not only orxonox::Functor, but also orxonox::FunctorStatic, and
     
    5151
    5252#include "core/CorePrereqs.h"
    53 #include "util/SharedPtr.h"
     53#include <memory>
    5454
    5555namespace orxonox
    5656{
    57     /// FunctorPtr is just a typedef of SharedPtr
    58     typedef SharedPtr<Functor> FunctorPtr;
    59 
    60     /// It's not possible to use a typedef for FunctorMemberPtr<T>, so we have to create a child-class instead. It inherits all functions from SharedChildPtr, but needs to (re-)implement some constructors.
     57    using FunctorPtr = std::shared_ptr<Functor>;
    6158    template <class T>
    62     class FunctorMemberPtr : public SharedChildPtr<FunctorMember<T>, FunctorPtr>
    63     {
    64         public:
    65             inline FunctorMemberPtr() : SharedChildPtr<FunctorMember<T>, FunctorPtr>() {}
    66             inline FunctorMemberPtr(FunctorMember<T>* pointer) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(pointer) {}
    67             inline FunctorMemberPtr(const SharedPtr<FunctorMember<T> >& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
    68     };
    69 
    70     /// FunctorStaticPtr is just FunctorMemberPtr with @a T = void
    71     typedef FunctorMemberPtr<void> FunctorStaticPtr;
    72 
    73     /// It's not possible to use a typedef for FunctorPointerPtr<T>, so we have to create a child-class instead. It inherits all functions from SharedChildPtr, but needs to (re-)implement some constructors.
     59    using FunctorMemberPtr = std::shared_ptr<FunctorMember<T>>;
     60    using FunctorStaticPtr = std::shared_ptr<FunctorMember<void>>;
    7461    template <class F, class T>
    75     class FunctorPointerPtr : public SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >
    76     {
    77         public:
    78             inline FunctorPointerPtr() : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >() {}
    79             inline FunctorPointerPtr(FunctorPointer<F, T>* pointer) : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >(pointer) {}
    80             inline FunctorPointerPtr(const SharedPtr<FunctorPointer<F, T> >& other) : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >(other) {}
    81     };
     62    using FunctorPointerPtr = std::shared_ptr<FunctorPointer<F, T>>;
    8263}
    8364
  • code/branches/cpp11_v3/src/libraries/core/command/IOConsolePOSIX.cc

    r9667 r11054  
    4444namespace orxonox
    4545{
    46     IOConsole* IOConsole::singletonPtr_s = NULL;
     46    IOConsole* IOConsole::singletonPtr_s = nullptr;
    4747
    4848    namespace EscapeMode
     
    6262        , promptString_("orxonox # ")
    6363        , bStatusPrinted_(false)
    64         , originalTerminalSettings_(0)
     64        , originalTerminalSettings_(nullptr)
    6565    {
    6666        this->setTerminalMode();
     
    326326            tcsetattr(0, TCSANOW, IOConsole::singletonPtr_s->originalTerminalSettings_);
    327327            delete IOConsole::singletonPtr_s->originalTerminalSettings_;
    328             IOConsole::singletonPtr_s->originalTerminalSettings_ = 0;
     328            IOConsole::singletonPtr_s->originalTerminalSettings_ = nullptr;
    329329        }
    330330    }
     
    353353        const char* s;
    354354        if (!this->terminalWidth_ && (s = getenv("COLUMNS")))
    355             this->terminalWidth_  = strtol(s, NULL, 10);
     355            this->terminalWidth_  = strtol(s, nullptr, 10);
    356356        if (!this->terminalWidth_)
    357357            this->terminalWidth_ = 80;
    358358        if (!this->terminalHeight_ && (s = getenv("LINES")))
    359             this->terminalHeight_ = strtol(s, NULL, 10);
     359            this->terminalHeight_ = strtol(s, nullptr, 10);
    360360        if (!this->terminalHeight_)
    361361            this->terminalHeight_ = 24;
  • code/branches/cpp11_v3/src/libraries/core/command/IOConsolePOSIX.h

    r8858 r11054  
    6565
    6666        // Methods from ShellListener
    67         void linesChanged();
    68         void lineAdded();
    69         void inputChanged();
    70         void cursorChanged();
    71         void executed();
    72         void exit();
     67        virtual void linesChanged() override;
     68        virtual void lineAdded() override;
     69        virtual void inputChanged() override;
     70        virtual void cursorChanged() override;
     71        virtual void executed() override;
     72        virtual void exit() override;
    7373
    7474        bool willPrintStatusLines();
  • code/branches/cpp11_v3/src/libraries/core/command/IOConsoleWindows.cc

    r9676 r11054  
    4141namespace orxonox
    4242{
    43     IOConsole* IOConsole::singletonPtr_s = NULL;
     43    IOConsole* IOConsole::singletonPtr_s = nullptr;
    4444
    4545    //! Redirects std::cout, creates the corresponding Shell and changes the terminal mode
     
    300300                this->terminalWidth_ - 1, this->inputLineRow_ + this->inputLineHeight_ + this->statusLines_ - 1);
    301301            this->inputLineRow_ += linesDown;
    302             ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, NULL, makeCOORD(0, this->inputLineRow_), &fillChar);
     302            ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, nullptr, makeCOORD(0, this->inputLineRow_), &fillChar);
    303303            // Move cursor down to the new bottom so the user can see the status lines
    304304            COORD pos = makeCOORD(0, this->inputLineRow_ + this->inputLineHeight_ - 1 + this->statusLines_);
     
    312312            // Scroll output up
    313313            SMALL_RECT oldRect = makeSMALL_RECT(0, lines - linesDown, this->terminalWidth_ - 1, this->inputLineRow_ - 1);
    314             ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, NULL, makeCOORD(0, 0), &fillChar);
     314            ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, nullptr, makeCOORD(0, 0), &fillChar);
    315315        }
    316316    }
     
    360360            SMALL_RECT oldRect = makeSMALL_RECT(0, statusLineRow, this->terminalWidth_ - 1, statusLineRow + this->statusLines_);
    361361            CHAR_INFO fillChar = {{' '}, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED};
    362             ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, NULL, makeCOORD(0, statusLineRow + newLines), &fillChar);
     362            ScrollConsoleScreenBuffer(stdOutHandle_, &oldRect, nullptr, makeCOORD(0, statusLineRow + newLines), &fillChar);
    363363            // Clear potential leftovers
    364364            if (-newLines - this->statusLines_ > 0)
  • code/branches/cpp11_v3/src/libraries/core/command/IOConsoleWindows.h

    r9676 r11054  
    6767
    6868        // Methods from ShellListener
    69         void linesChanged();
    70         void lineAdded();
    71         void inputChanged();
    72         void cursorChanged();
    73         void executed();
    74         void exit();
     69        virtual void linesChanged() override;
     70        virtual void lineAdded() override;
     71        virtual void inputChanged() override;
     72        virtual void cursorChanged() override;
     73        virtual void executed() override;
     74        virtual void exit() override;
    7575
    7676        void resetTerminalMode();
  • code/branches/cpp11_v3/src/libraries/core/command/IRC.cc

    r10624 r11054  
    4444namespace orxonox
    4545{
    46     static const unsigned int IRC_TCL_THREADID  = 1421421421;   ///< The ID of the thread in TclThreadManager that is used for the IRC connection
     46    static constexpr unsigned int IRC_TCL_THREADID  = 1421421421;   ///< The ID of the thread in TclThreadManager that is used for the IRC connection
    4747
    4848    SetConsoleCommand("IRC", "say",  &IRC::say);
     
    6666    IRC::IRC()
    6767    {
    68         this->interpreter_ = 0;
     68        this->interpreter_ = nullptr;
    6969    }
    7070
  • code/branches/cpp11_v3/src/libraries/core/command/IRC.h

    r7401 r11054  
    6565
    6666            IRC();
    67             IRC(const IRC& other);              ///< Copy-constructor: Not implemented
    68             ~IRC() {}                           ///< Destructor
     67            ~IRC() = default;
     68
     69            // non-copyable:
     70            IRC(const IRC&) = delete;
     71            IRC& operator=(const IRC&) = delete;
    6972
    7073            Tcl::interpreter* interpreter_;     ///< The Tcl interpreter that is used for the IRC connection
  • code/branches/cpp11_v3/src/libraries/core/command/Shell.cc

    r10624 r11054  
    258258        vectorize(text, '\n', &lines);
    259259
    260         for (size_t i = 0; i < lines.size(); ++i)
    261             this->addLine(lines[i], type);
     260        for (const std::string& line : lines)
     261            this->addLine(line, type);
    262262    }
    263263
  • code/branches/cpp11_v3/src/libraries/core/command/Shell.h

    r10624 r11054  
    6161
    6262        public:
    63             virtual ~ShellListener() {}
     63            ShellListener() = default;
     64            virtual ~ShellListener() = default;
    6465
    6566        private:
     
    128129            const std::string& getInput() const;
    129130
    130             typedef std::list<std::pair<std::string, LineType> > LineList;
     131            typedef std::list<std::pair<std::string, LineType>> LineList;
    131132            LineList::const_iterator getNewestLineIterator() const;
    132133            LineList::const_iterator getEndIterator() const;
     
    148149
    149150        private:
    150             Shell(const Shell& other);
     151            // non-copyable:
     152            Shell(const Shell&) = delete;
     153            Shell& operator=(const Shell&) = delete;
    151154
    152155            // DevModeListener
    153             void devModeChanged(bool value);
     156            virtual void devModeChanged(bool value) override;
    154157
    155158            void addToHistory(const std::string& command);
     
    157160            void clearInput();
    158161            // BaseWriter
    159             virtual void printLine(const std::string& line, OutputLevel level);
     162            virtual void printLine(const std::string& line, OutputLevel level) override;
    160163
    161164            void configureInputBuffer();
  • code/branches/cpp11_v3/src/libraries/core/command/TclBind.cc

    r10624 r11054  
    4747    SetConsoleCommand("bgerror", &TclBind::bgerror).hide();
    4848
    49     TclBind* TclBind::singletonPtr_s = 0;
     49    TclBind* TclBind::singletonPtr_s = nullptr;
    5050
    5151    /**
     
    5555    TclBind::TclBind(const std::string& datapath)
    5656    {
    57         this->interpreter_ = 0;
     57        this->interpreter_ = nullptr;
    5858        this->bSetTclDataPath_ = false;
    5959        this->setDataPath(datapath);
     
    228228        @brief Executes Tcl-code and returns the return-value.
    229229        @param tclcode A string that contains Tcl-code
    230         @param error A pointer to an integer (or NULL) that is used to write an error-code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
     230        @param error A pointer to an integer (or nullptr) that is used to write an error-code (see @ref CommandExecutorErrorCodes "CommandExecutor error codes")
    231231        @return Returns the return-value of the executed code (or an empty string if there's no return-value)
    232232    */
  • code/branches/cpp11_v3/src/libraries/core/command/TclBind.h

    r8079 r11054  
    121121            static void tcl_execute(Tcl::object const &args);
    122122
    123             static std::string eval(const std::string& tclcode, int* error = 0);
     123            static std::string eval(const std::string& tclcode, int* error = nullptr);
    124124
    125125        private:
    126             TclBind(const TclBind& other);      ///< Copy-constructor, not implemented
     126            // non-copyable:
     127            TclBind(const TclBind&) = delete;
     128            TclBind& operator=(const TclBind&) = delete;
    127129
    128130            static std::string tcl_helper(Tcl::object const &args, bool bQuery);
  • code/branches/cpp11_v3/src/libraries/core/command/TclThreadList.h

    r7401 r11054  
    262262        boost::shared_lock<boost::shared_mutex> lock(this->mutex_);
    263263
    264         for (typename std::list<T>::const_iterator it = this->list_.begin(); it != this->list_.end(); ++it)
    265             if (*it == value)
     264        for (const T& element : this->list_)
     265            if (element == value)
    266266                return true;
    267267
  • code/branches/cpp11_v3/src/libraries/core/command/TclThreadManager.cc

    r10624 r11054  
    3434#include "TclThreadManager.h"
    3535
    36 #include <boost/bind.hpp>
     36#include <functional>
    3737#include <boost/thread/thread.hpp>
    3838#include <boost/thread/locks.hpp>
     
    8686    };
    8787
    88     TclThreadManager* TclThreadManager::singletonPtr_s = 0;
     88    TclThreadManager* TclThreadManager::singletonPtr_s = nullptr;
    8989
    9090    /**
     
    145145            {
    146146                boost::shared_lock<boost::shared_mutex> lock(*this->interpreterBundlesMutex_);
    147                 for (std::map<unsigned int, TclInterpreterBundle*>::const_iterator it = this->interpreterBundles_.begin(); it != this->interpreterBundles_.end(); ++it)
     147                for (const auto& mapEntry : this->interpreterBundles_)
    148148                {
    149                     if (it->first == 0)
     149                    if (mapEntry.first == 0)
    150150                        continue; // We'll handle the default interpreter later (and without threads of course)
    151151
    152                     TclInterpreterBundle* bundle = it->second;
     152                    TclInterpreterBundle* bundle = mapEntry.second;
    153153                    if (!bundle->queue_.empty())
    154154                    {
     
    163163                                {
    164164                                    // Start a thread to execute the command
    165                                     boost::thread(boost::bind(&tclThread, bundle, command));
     165                                    boost::thread(std::bind(&tclThread, bundle, command));
    166166                                }
    167167                                else
     
    289289        catch (const Tcl::tcl_error& e)
    290290        {
    291             bundle->interpreter_ = 0;
     291            bundle->interpreter_ = nullptr;
    292292            orxout(user_error, context::tcl) << "Tcl error while creating Tcl-interpreter (" << id_string << "): " << e.what() << endl;
    293293        }
     
    488488    void TclThreadManager::source(const std::string& file)
    489489    {
    490         boost::thread(boost::bind(&sourceThread, file));
     490        boost::thread(std::bind(&sourceThread, file));
    491491    }
    492492
     
    521521        {
    522522            TclThreadManager::error("No Tcl-interpreter with ID " + multi_cast<std::string>(id) + " existing.");
    523             return 0;
     523            return nullptr;
    524524        }
    525525    }
     
    551551
    552552        std::list<unsigned int> threads;
    553         for (std::map<unsigned int, TclInterpreterBundle*>::const_iterator it = this->interpreterBundles_.begin(); it != this->interpreterBundles_.end(); ++it)
    554             if (it->first > 0 && it->first <= this->numInterpreterBundles_) // only list autonumbered interpreters (created with create()) - exclude the default interpreter 0 and all manually numbered interpreters)
    555                 threads.push_back(it->first);
     553        for (const auto& mapEntry : this->interpreterBundles_)
     554            if (mapEntry.first > 0 && mapEntry.first <= this->numInterpreterBundles_) // only list autonumbered interpreters (created with create()) - exclude the default interpreter 0 and all manually numbered interpreters)
     555                threads.push_back(mapEntry.first);
    556556        return threads;
    557557    }
  • code/branches/cpp11_v3/src/libraries/core/commandline/CommandLineIncludes.h

    r10535 r11054  
    6464            ~StaticallyInitializedCommandLineArgument() { delete argument_; }
    6565
    66             virtual void load()
     66            virtual void load() override
    6767                { CommandLineParser::addArgument(this->argument_); }
    6868
    69             virtual void unload()
     69            virtual void unload() override
    7070                { CommandLineParser::removeArgument(this->argument_); }
    7171
  • code/branches/cpp11_v3/src/libraries/core/commandline/CommandLineParser.cc

    r10542 r11054  
    4040namespace orxonox
    4141{
    42     CommandLineParser* CommandLineParser::singletonPtr_s = 0;
     42    CommandLineParser* CommandLineParser::singletonPtr_s = nullptr;
    4343
    4444    /**
     
    110110            {
    111111                // first shove all the shortcuts in a map
    112                 for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
    113                     it != cmdLineArgs_.end(); ++it)
     112                for (const auto& mapEntry : cmdLineArgs_)
    114113                {
    115                     OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
     114                    OrxAssert(cmdLineArgsShortcut_.find(mapEntry.second->getShortcut()) == cmdLineArgsShortcut_.end(),
    116115                        "Cannot have two command line shortcut with the same name.");
    117                     if (!it->second->getShortcut().empty())
    118                         cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
     116                    if (!mapEntry.second->getShortcut().empty())
     117                        cmdLineArgsShortcut_[mapEntry.second->getShortcut()] = mapEntry.second;
    119118                }
    120119                bFirstTimeParse_ = false;
     
    124123            std::string shortcut;
    125124            std::string value;
    126             for (unsigned int i = 0; i < arguments.size(); ++i)
    127             {
    128                 if (arguments[i].size() != 0)
     125            for (const std::string& argument : arguments)
     126            {
     127                if (argument.size() != 0)
    129128                {
    130129                    // sure not ""
    131                     if (arguments[i][0] == '-')
     130                    if (argument[0] == '-')
    132131                    {
    133132                        // start with "-"
    134                         if (arguments[i].size() == 1)
     133                        if (argument.size() == 1)
    135134                        {
    136135                            // argument[i] is "-", probably a minus sign
    137136                            value += "- ";
    138137                        }
    139                         else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
     138                        else if (argument[1] <= 57 && argument[1] >= 48)
    140139                        {
    141140                            // negative number as a value
    142                             value += arguments[i] + ' ';
     141                            value += argument + ' ';
    143142                        }
    144143                        else
     
    161160                            }
    162161
    163                             if (arguments[i][1] == '-')
     162                            if (argument[1] == '-')
    164163                            {
    165164                                // full name argument with "--name"
    166                                 name = arguments[i].substr(2);
     165                                name = argument.substr(2);
    167166                            }
    168167                            else
    169168                            {
    170169                                // shortcut with "-s"
    171                                 shortcut = arguments[i].substr(1);
     170                                shortcut = argument.substr(1);
    172171                            }
    173172
     
    186185
    187186                        // Concatenate strings as long as there's no new argument by "-" or "--"
    188                         value += arguments[i] + ' ';
     187                        value += argument + ' ';
    189188                    }
    190189                }
     
    257256        // determine maximum name size
    258257        size_t maxNameSize = 0;
    259         for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
    260             it != inst.cmdLineArgs_.end(); ++it)
    261         {
    262             maxNameSize = std::max(it->second->getName().size(), maxNameSize);
     258        for (const auto& mapEntry : inst.cmdLineArgs_)
     259        {
     260            maxNameSize = std::max(mapEntry.second->getName().size(), maxNameSize);
    263261        }
    264262
     
    267265        infoStr << "Available options:" << endl;
    268266
    269         for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
    270             it != inst.cmdLineArgs_.end(); ++it)
    271         {
    272             if (!it->second->getShortcut().empty())
    273                 infoStr << " [-" << it->second->getShortcut() << "] ";
     267        for (const auto& mapEntry : inst.cmdLineArgs_)
     268        {
     269            if (!mapEntry.second->getShortcut().empty())
     270                infoStr << " [-" << mapEntry.second->getShortcut() << "] ";
    274271            else
    275272                infoStr << "      ";
    276             infoStr << "--" << it->second->getName() << ' ';
    277             if (it->second->getValue().isType<bool>())
     273            infoStr << "--" << mapEntry.second->getName() << ' ';
     274            if (mapEntry.second->getValue().isType<bool>())
    278275                infoStr << "    ";
    279276            else
    280277                infoStr << "ARG ";
    281278            // fill with the necessary amount of blanks
    282             infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
    283             infoStr << ": " << it->second->getInformation();
     279            infoStr << std::string(maxNameSize - mapEntry.second->getName().size(), ' ');
     280            infoStr << ": " << mapEntry.second->getInformation();
    284281            infoStr << endl;
    285282        }
  • code/branches/cpp11_v3/src/libraries/core/commandline/CommandLineParser.h

    r10542 r11054  
    107107
    108108    private:
    109         //! Undefined copy constructor
    110         CommandLineArgument(const CommandLineArgument& instance);
     109        // non-copyable:
     110        CommandLineArgument(const CommandLineArgument&) = delete;
     111        CommandLineArgument& operator=(const CommandLineArgument&) = delete;
    111112
    112113        //! Parses the value string of a command line argument.
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFile.cc

    r10624 r11054  
    3535
    3636#include <boost/filesystem.hpp>
     37
     38#include <iterator>
     39#include <algorithm>
     40#include <fstream>
    3741
    3842#include "util/Convert.h"
     
    9397                        try
    9498                        {
    95                             boost::filesystem::copy_file(defaultFilepath, filepath);
     99                            std::ifstream input(defaultFilepath.string().c_str(), std::ifstream::in | std::ifstream::binary);
     100                            std::ofstream output(filepath.string().c_str(), std::ofstream::out | std::ofstream::binary);
     101                            copy(std::istreambuf_iterator<char>(input), std::istreambuf_iterator<char>(), std::ostream_iterator<char>(output));
    96102                            orxout(internal_info, context::config) << "Copied " << this->filename_ << " from the default config folder." << endl;
    97103                        }
     
    108114        if (file.is_open())
    109115        {
    110             ConfigFileSection* newsection = 0;
     116            ConfigFileSection* newsection = nullptr;
    111117
    112118            while (file.good() && !file.eof())
     
    135141                }
    136142
    137                 if (newsection != 0)
     143                if (newsection != nullptr)
    138144                {
    139145                    if (isComment(line))
     
    228234        }
    229235
    230         for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    231         {
    232             file << (*it)->getFileEntry() << endl;
    233 
    234             for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
     236        for (ConfigFileSection* section : this->sections_)
     237        {
     238            file << section->getFileEntry() << endl;
     239
     240            for (std::list<ConfigFileEntry*>::const_iterator it_entries = section->getEntriesBegin(); it_entries != section->getEntriesEnd(); ++it_entries)
    235241                file << (*it_entries)->getFileEntry() << endl;
    236242
     
    270276
    271277    /**
    272         @brief Returns a pointer to the section with given name (or NULL if the section doesn't exist).
    273     */
    274     ConfigFileSection* ConfigFile::getSection(const std::string& section) const
    275     {
    276         for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    277             if ((*it)->getName() == section)
    278                 return (*it);
    279         return NULL;
     278        @brief Returns a pointer to the section with given name (or nullptr if the section doesn't exist).
     279    */
     280    ConfigFileSection* ConfigFile::getSection(const std::string& sectionName) const
     281    {
     282        for (ConfigFileSection* section : this->sections_)
     283            if (section->getName() == sectionName)
     284                return section;
     285        return nullptr;
    280286    }
    281287
     
    283289        @brief Returns a pointer to the section with given name. If it doesn't exist, the section is created.
    284290    */
    285     ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& section)
    286     {
    287         for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    288             if ((*it)->getName() == section)
    289                 return (*it);
     291    ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& sectionName)
     292    {
     293        for (ConfigFileSection* section : this->sections_)
     294            if (section->getName() == sectionName)
     295                return section;
    290296
    291297        this->bUpdated_ = true;
    292298
    293         return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(section)));
     299        return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(sectionName)));
    294300    }
    295301
     
    301307        bool sectionsUpdated = false;
    302308
    303         for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
    304         {
    305             if ((*it)->bUpdated_)
     309        for (ConfigFileSection* section : this->sections_)
     310        {
     311            if (section->bUpdated_)
    306312            {
    307313                sectionsUpdated = true;
    308                 (*it)->bUpdated_ = false;
     314                section->bUpdated_ = false;
    309315            }
    310316        }
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFileEntry.h

    r9559 r11054  
    5151        public:
    5252            /// Destructor
    53             virtual ~ConfigFileEntry() {};
     53            virtual ~ConfigFileEntry() = default;
    5454
    5555            /// Changes the value of the entry.
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFileEntryComment.h

    r9559 r11054  
    5454
    5555            /// Destructor
    56             inline virtual ~ConfigFileEntryComment() {}
     56            virtual inline ~ConfigFileEntryComment() = default;
    5757
    58             inline virtual const std::string& getName() const
     58            virtual inline const std::string& getName() const override
    5959                { return this->comment_; }
    6060
    61             inline virtual void setComment(const std::string& comment)
     61            virtual inline void setComment(const std::string& comment) override
    6262                { this->comment_ = comment; }
    6363
    64             inline virtual void setValue(const std::string& value)
     64            virtual inline void setValue(const std::string& value) override
    6565                {}
    66             inline virtual const std::string& getValue() const
     66            virtual inline const std::string& getValue() const override
    6767                { return BLANKSTRING; }
    6868
    69             inline void setString(bool bString)
     69            virtual inline void setString(bool bString) override
    7070                {}
    7171
    72             inline virtual const std::string& getFileEntry() const
     72            virtual inline const std::string& getFileEntry() const override
    7373                { return this->comment_; }
    7474
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFileEntryValue.h

    r9684 r11054  
    6767
    6868            /// Destructor
    69             inline virtual ~ConfigFileEntryValue() {}
     69            virtual inline ~ConfigFileEntryValue() = default;
    7070
    71             inline virtual const std::string& getName() const
     71            virtual inline const std::string& getName() const override
    7272                { return this->name_; }
    7373
    74             inline virtual void setComment(const std::string& comment)
     74            virtual inline void setComment(const std::string& comment) override
    7575                { this->additionalComment_ = comment; this->update(); }
    7676
    77             inline virtual void setValue(const std::string& value)
     77            virtual inline void setValue(const std::string& value) override
    7878                { this->value_ = value; this->update(); }
    79             inline virtual const std::string& getValue() const
     79            virtual inline const std::string& getValue() const override
    8080                { return this->value_; }
    8181
    82             inline void virtual setString(bool bString)
     82            virtual inline void setString(bool bString) override
    8383                { this->bString_ = bString; this->update(); }
    8484
    85             inline virtual const std::string& getFileEntry() const
     85            virtual inline const std::string& getFileEntry() const override
    8686                { return this->fileEntry_; }
    8787
    8888            /// Returns the "key" of the value (in this case it's just the name of the entry, but for vectors it's different)
    89             inline virtual const std::string& getKeyString() const
     89            virtual inline const std::string& getKeyString() const
    9090                { return this->name_; }
    9191
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFileEntryVectorValue.h

    r9559 r11054  
    6565
    6666            /// Destructor
    67             inline ~ConfigFileEntryVectorValue() {}
     67            inline ~ConfigFileEntryVectorValue() = default;
    6868
    69             inline unsigned int getIndex() const
     69            virtual inline unsigned int getIndex() const override
    7070                { return this->index_; }
    7171
    7272            /// Returns the "key" of the value (the name of the vector plus the index of the element)
    73             inline const std::string& getKeyString() const
     73            virtual inline const std::string& getKeyString() const override
    7474                { return this->keyString_; }
    7575
    7676        private:
    77             void update();
     77            virtual void update() override;
    7878
    7979            unsigned int index_;        ///< The index of the element in the vector
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFileManager.cc

    r9559 r11054  
    4242    ///////////////////////
    4343
    44     ConfigFileManager* ConfigFileManager::singletonPtr_s = 0;
     44    ConfigFileManager* ConfigFileManager::singletonPtr_s = nullptr;
    4545
    46     /// Constructor: Initializes the array of config files with NULL.
     46    /// Constructor: Initializes the array of config files with nullptr.
    4747    ConfigFileManager::ConfigFileManager()
    4848    {
    49         this->configFiles_.assign(NULL);
     49        this->configFiles_.fill(nullptr);
    5050    }
    5151
     
    5353    ConfigFileManager::~ConfigFileManager()
    5454    {
    55         for (boost::array<ConfigFile*, 3>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
    56             if (*it)
    57                 delete (*it);
     55        for (ConfigFile* configFile : this->configFiles_)
     56            if (configFile)
     57                delete configFile;
    5858    }
    5959
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFileManager.h

    r9559 r11054  
    3838#include "core/CorePrereqs.h"
    3939
    40 #include <boost/array.hpp>
     40#include <array>
    4141
    4242#include "util/Singleton.h"
     
    6767
    6868        private:
    69             ConfigFileManager(const ConfigFileManager&);    ///< Copy-constructor: not implemented
     69            // non-copyable:
     70            ConfigFileManager(const ConfigFileManager&) = delete;
     71            ConfigFileManager& operator=(const ConfigFileManager&) = delete;
    7072
    71             boost::array<ConfigFile*, 3> configFiles_;      ///< Stores the config files for each type in an array (must have the same size like ConfigFileType::Value)
     73            std::array<ConfigFile*, 3> configFiles_;        ///< Stores the config files for each type in an array (must have the same size like ConfigFileType::Value)
    7274            static ConfigFileManager* singletonPtr_s;       ///< Stores the singleton-pointer
    7375    };
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFileSection.cc

    r9559 r11054  
    8080    {
    8181        unsigned int size = 0;
    82         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
    83             if ((*it)->getName() == name)
    84                 if ((*it)->getIndex() >= size)
    85                     size = (*it)->getIndex() + 1;
     82        for (ConfigFileEntry* entry : this->entries_)
     83            if (entry->getName() == name)
     84                if (entry->getIndex() >= size)
     85                    size = entry->getIndex() + 1;
    8686        return size;
    8787    }
     
    9999
    100100    /**
    101         @brief Returns the entry with given name (or NULL if it doesn't exist).
     101        @brief Returns the entry with given name (or nullptr if it doesn't exist).
    102102
    103103        @param name     The name of the entry
     
    105105    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name) const
    106106    {
    107         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
     107        for (ConfigFileEntry* entry : this->entries_)
    108108        {
    109             if ((*it)->getName() == name)
    110                 return *it;
     109            if (entry->getName() == name)
     110                return entry;
    111111        }
    112         return NULL;
     112        return nullptr;
    113113    }
    114114
    115115    /**
    116         @brief Returns the entry of a vector element with given name and index (or NULL if it doesn't exist).
     116        @brief Returns the entry of a vector element with given name and index (or nullptr if it doesn't exist).
    117117
    118118        @param name     The name of the vector
     
    121121    ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name, unsigned int index) const
    122122    {
    123         for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
     123        for (ConfigFileEntry* entry : this->entries_)
    124124        {
    125             if (((*it)->getName() == name) && ((*it)->getIndex() == index))
    126                 return *it;
     125            if ((entry->getName() == name) && (entry->getIndex() == index))
     126                return entry;
    127127        }
    128         return NULL;
     128        return nullptr;
    129129    }
    130130
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigValueContainer.cc

    r9559 r11054  
    5353        this->sectionname_ = sectionname;
    5454        this->varname_ = varname;
    55         this->callback_ = 0;
     55        this->callback_ = nullptr;
    5656        this->bContainerIsNew_ = true;
    5757        this->bDoInitialCallback_ = false;
     
    191191                for (unsigned int i = this->valueVector_.size(); i <= index; i++)
    192192                {
    193                     this->valueVector_.push_back(MultiType());
     193                    this->valueVector_.emplace_back();
    194194                }
    195195            }
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigValueContainer.h

    r9667 r11054  
    5959        public:
    6060            virtual void call(void* object) = 0;
    61             inline virtual ~ConfigValueCallbackBase() {}
     61            virtual inline ~ConfigValueCallbackBase() {}
    6262    };
    6363
     
    6767        public:
    6868            inline ConfigValueCallback(void (T::*function) (void)) : function_(function) {}
    69             inline virtual ~ConfigValueCallback() {}
    70             inline virtual void call(void* object)
     69            virtual inline ~ConfigValueCallback() = default;
     70            virtual inline void call(void* object) override
    7171            {
    7272                if (!IdentifierManager::getInstance().isCreatingHierarchy())
     
    130130
    131131                this->value_ = V();
    132                 for (unsigned int i = 0; i < defvalue.size(); i++)
    133                     this->valueVector_.push_back(MultiType(defvalue[i]));
     132                for (const D& defvalueElement : defvalue)
     133                    this->valueVector_.emplace_back(defvalueElement);
    134134
    135135                this->initVector();
     
    183183                    std::vector<T> temp = *value;
    184184                    value->clear();
    185                     for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
    186                         value->push_back(this->valueVector_[i]);
     185                    for (const MultiType& vectorEntry : this->valueVector_)
     186                        value->push_back(vectorEntry);
    187187
    188188                    if (value->size() != temp.size())
     
    211211                {
    212212                    value->clear();
    213                     for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
    214                         value->push_back(this->valueVector_[i]);
     213                    for (const MultiType& vectorEntry : this->valueVector_)
     214                        value->push_back(vectorEntry);
    215215                }
    216216                return *this;
     
    223223            inline const std::string& getSectionName() const
    224224                { return this->sectionname_; }
    225             /// Returns the associated identifier (can be NULL).
     225            /// Returns the associated identifier (can be nullptr).
    226226            inline Identifier* getIdentifier() const
    227227                { return this->identifier_; }
  • code/branches/cpp11_v3/src/libraries/core/config/SettingsConfigFile.cc

    r10624 r11054  
    5757    SetConsoleCommand(__CC_getConfig_name,       &SettingsConfigFile::getConfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries());
    5858
    59     SettingsConfigFile* SettingsConfigFile::singletonPtr_s = 0;
     59    SettingsConfigFile* SettingsConfigFile::singletonPtr_s = nullptr;
    6060
    6161    /**
     
    7777    SettingsConfigFile::~SettingsConfigFile()
    7878    {
    79         ModifyConsoleCommand(__CC_load_name).setObject(0);
    80         ModifyConsoleCommand(__CC_setFilename_name).setObject(0);
    81         ModifyConsoleCommand(__CC_config_name).setObject(0);
    82         ModifyConsoleCommand(__CC_tconfig_name).setObject(0);
    83         ModifyConsoleCommand(__CC_getConfig_name).setObject(0);
     79        ModifyConsoleCommand(__CC_load_name).setObject(nullptr);
     80        ModifyConsoleCommand(__CC_setFilename_name).setObject(nullptr);
     81        ModifyConsoleCommand(__CC_config_name).setObject(nullptr);
     82        ModifyConsoleCommand(__CC_tconfig_name).setObject(nullptr);
     83        ModifyConsoleCommand(__CC_getConfig_name).setObject(nullptr);
    8484    }
    8585
     
    106106    void SettingsConfigFile::addConfigValueContainer(ConfigValueContainer* container)
    107107    {
    108         if (container == NULL)
     108        if (container == nullptr)
    109109            return;
    110110        std::pair<std::string, ConfigValueContainer*> second(getLowercase(container->getName()), container);
     
    118118    void SettingsConfigFile::removeConfigValueContainer(ConfigValueContainer* container)
    119119    {
    120         if (container == NULL)
     120        if (container == nullptr)
    121121            return;
    122122        const std::string& sectionLC = getLowercase(container->getSectionName());
     
    142142        // todo: can this be done more efficiently? looks like some identifiers will be updated multiple times.
    143143
    144         for (ContainerMap::const_iterator it = this->containers_.begin(); it != this->containers_.end(); ++it)
    145         {
    146             it->second.second->update();
    147             it->second.second->getIdentifier()->updateConfigValues();
     144        for (const auto& mapEntry : this->containers_)
     145        {
     146            mapEntry.second.second->update();
     147            mapEntry.second.second->getIdentifier()->updateConfigValues();
    148148        }
    149149    }
     
    269269            {
    270270                std::string value;
    271                 it->second.second->getValue<std::string, void>(&value, NULL);
     271                it->second.second->getValue<std::string, void>(&value, nullptr);
    272272                return value;
    273273            }
  • code/branches/cpp11_v3/src/libraries/core/config/SettingsConfigFile.h

    r9684 r11054  
    6363
    6464        public:
    65             typedef std::multimap<std::string, std::pair<std::string, ConfigValueContainer*> > ContainerMap;
     65            typedef std::multimap<std::string, std::pair<std::string, ConfigValueContainer*>> ContainerMap;
    6666
    6767            SettingsConfigFile(const std::string& filename);
    6868            ~SettingsConfigFile();
    6969
    70             void load(); // tolua_export
     70            virtual void load() override; // tolua_export
    7171            void setFilename(const std::string& filename); // tolua_export
    7272            void clean(bool bCleanComments = false); // tolua_export
  • code/branches/cpp11_v3/src/libraries/core/input/Button.cc

    r9983 r11054  
    5353    Button::Button()
    5454        : bButtonThresholdUser_(false)
    55         , paramCommandBuffer_(0)
     55        , paramCommandBuffer_(nullptr)
    5656    {
    5757        nCommands_[0]=0;
     
    7575                    delete commands_[j][i];
    7676                delete[] commands_[j];
    77                 commands_[j] = 0;
     77                commands_[j] = nullptr;
    7878                nCommands_[j] = 0;
    7979            }
     
    196196
    197197                    // add command to the buffer if not yet existing
    198                     for (unsigned int iParamCmd = 0; iParamCmd < paramCommandBuffer_->size(); iParamCmd++)
    199                     {
    200                         if ((*paramCommandBuffer_)[iParamCmd]->evaluation_.getConsoleCommand()
     198                    for (BufferedParamCommand* command : *paramCommandBuffer_)
     199                    {
     200                        if (command->evaluation_.getConsoleCommand()
    201201                            == eval.getConsoleCommand())
    202202                        {
    203203                            // already in list
    204                             cmd->paramCommand_ = (*paramCommandBuffer_)[iParamCmd];
     204                            cmd->paramCommand_ = command;
    205205                            break;
    206206                        }
    207207                    }
    208                     if (cmd->paramCommand_ == 0)
     208                    if (cmd->paramCommand_ == nullptr)
    209209                    {
    210210                        cmd->paramCommand_ = new BufferedParamCommand();
     
    239239            }
    240240            else
    241                 commands_[j] = 0;
     241                commands_[j] = nullptr;
    242242        }
    243243    }
  • code/branches/cpp11_v3/src/libraries/core/input/HalfAxis.h

    r7859 r11054  
    4949            : relVal_(0.0f)
    5050            , absVal_(0.0f)
    51             , paramCommands_(0)
     51            , paramCommands_(nullptr)
    5252            , nParamCommands_(0)
    5353            , pressed_(false)
     
    5656        using Button::execute;
    5757        bool execute();
    58         bool addParamCommand(ParamCommand* command);
    59         void clear();
     58        virtual bool addParamCommand(ParamCommand* command) override;
     59        virtual void clear() override;
    6060        void reset();
    6161
  • code/branches/cpp11_v3/src/libraries/core/input/InputBuffer.cc

    r9667 r11054  
    7575    InputBuffer::~InputBuffer()
    7676    {
    77         for (std::list<BaseInputBufferListenerTuple*>::const_iterator it = this->listeners_.begin();
    78             it != this->listeners_.end(); ++it)
    79             delete *it;
     77        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     78            delete listener;
    8079    }
    8180
     
    110109    void InputBuffer::insert(const std::string& input, bool update)
    111110    {
    112         for (unsigned int i = 0; i < input.size(); ++i)
    113         {
    114             this->insert(input[i], false);
     111        for (const char& inputChar : input)
     112        {
     113            this->insert(inputChar, false);
    115114
    116115            if (update)
    117                 this->updated(input[i], false);
     116                this->updated(inputChar, false);
    118117        }
    119118
     
    170169    void InputBuffer::updated()
    171170    {
    172         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    173         {
    174             if ((*it)->bListenToAllChanges_)
    175                 (*it)->callFunction();
     171        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     172        {
     173            if (listener->bListenToAllChanges_)
     174                listener->callFunction();
    176175        }
    177176    }
     
    179178    void InputBuffer::updated(const char& update, bool bSingleInput)
    180179    {
    181         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    182         {
    183             if ((!(*it)->trueKeyFalseChar_) && ((*it)->bListenToAllChanges_ || ((*it)->char_ == update)) && (!(*it)->bOnlySingleInput_ || bSingleInput))
    184                 (*it)->callFunction();
     180        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     181        {
     182            if ((!listener->trueKeyFalseChar_) && (listener->bListenToAllChanges_ || (listener->char_ == update)) && (!listener->bOnlySingleInput_ || bSingleInput))
     183                listener->callFunction();
    185184        }
    186185    }
     
    201200            return;
    202201
    203         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    204         {
    205             if ((*it)->trueKeyFalseChar_ && ((*it)->key_ == evt.getKeyCode()))
    206                 (*it)->callFunction();
     202        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     203        {
     204            if (listener->trueKeyFalseChar_ && (listener->key_ == evt.getKeyCode()))
     205                listener->callFunction();
    207206        }
    208207
  • code/branches/cpp11_v3/src/libraries/core/input/InputBuffer.h

    r9667 r11054  
    4747              trueKeyFalseChar_(trueKeyFalseChar), char_(_char), key_(key)
    4848        { }
    49         virtual ~BaseInputBufferListenerTuple() { }
     49        virtual ~BaseInputBufferListenerTuple() = default;
    5050        virtual void callFunction() = 0;
    5151        bool bListenToAllChanges_;
     
    6565              listener_(listener), function_(function)
    6666        { }
    67         virtual ~InputBufferListenerTuple() { }
    68         void callFunction()
     67        virtual ~InputBufferListenerTuple() = default;
     68        virtual void callFunction() override
    6969        {
    7070            (listener_->*function_)();
     
    165165                { if (this->cursor_ > 0) { --this->cursor_; } }
    166166
    167             void buttonPressed(const KeyEvent& evt);
     167            virtual void buttonPressed(const KeyEvent& evt) override;
    168168
    169169        private:
    170170            bool charIsAllowed(const char& input);
    171171
    172             void buttonHeld   (const KeyEvent& evt);
    173             void processKey   (const KeyEvent& evt);
     172            virtual void buttonHeld (const KeyEvent& evt) override;
     173            void processKey (const KeyEvent& evt);
    174174
    175             void keyboardUpdated(float dt);
     175            virtual void keyboardUpdated(float dt) override;
    176176
    177177            std::string buffer_;
  • code/branches/cpp11_v3/src/libraries/core/input/InputCommands.h

    r9978 r11054  
    5757    public:
    5858        BaseCommand() : bFixedKeybindMode_(false) {}
    59         virtual ~BaseCommand() { }
     59        virtual ~BaseCommand() = default;
    6060
    6161        virtual bool execute(float abs = 1.0f, float rel = 1.0f) = 0;
     
    7676    {
    7777    public:
    78         bool execute(float abs = 1.0f, float rel = 1.0f);
    79         CommandEvaluation* getEvaluation();
    80         virtual SimpleCommand* clone() { return new SimpleCommand(*this); }
     78        virtual bool execute(float abs = 1.0f, float rel = 1.0f) override;
     79        virtual CommandEvaluation* getEvaluation() override;
     80        virtual SimpleCommand* clone() override { return new SimpleCommand(*this); }
    8181
    8282        CommandEvaluation evaluation_;
     
    103103    {
    104104    public:
    105         ParamCommand() : scale_(1.0f), paramCommand_(0) { }
    106         bool execute(float abs = 1.0f, float rel = 1.0f);
    107         CommandEvaluation* getEvaluation();
    108         virtual ParamCommand* clone() { return new ParamCommand(*this); }
     105        ParamCommand() : scale_(1.0f), paramCommand_(nullptr) { }
     106        virtual bool execute(float abs = 1.0f, float rel = 1.0f) override;
     107        virtual CommandEvaluation* getEvaluation() override;
     108        virtual ParamCommand* clone() override { return new ParamCommand(*this); }
    109109
    110110        float scale_;
     
    118118            return &this->paramCommand_->evaluation_;
    119119        else
    120             return 0;
     120            return nullptr;
    121121    }
    122122}
  • code/branches/cpp11_v3/src/libraries/core/input/InputDevice.h

    r8858 r11054  
    6060        //! Only resets the members
    6161        InputDevice(unsigned int id) : bCalibrating_(false), deviceID_(id) { }
    62         virtual ~InputDevice() { }
     62        virtual ~InputDevice() = default;
    6363        //! Returns the device class (derived) name as string
    6464        virtual std::string getClassName() const = 0;
     
    9999
    100100    private:
    101         InputDevice(const InputDevice& rhs); //!< Don't use!
     101        // non-copyable:
     102        InputDevice(const InputDevice&) = delete;
     103        InputDevice& operator=(const InputDevice&) = delete;
    102104
    103105        bool bCalibrating_;                  //!< Whether the device is in calibration mode
     
    153155
    154156        //! Captures OIS events (which then get distributed to the derived class) and creates the button held events
    155         void update(const Clock& time)
     157        virtual void update(const Clock& time) override
    156158        {
    157159            oisDevice_->capture();
    158160
    159161            // Call all the states with the held button event
    160             for (unsigned int iB = 0; iB < pressedButtons_.size(); ++iB)
    161                 for (unsigned int iS = 0; iS < inputStates_.size(); ++iS)
    162                     inputStates_[iS]->buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
    163                         this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(pressedButtons_[iB]));
     162            for (ButtonType& button : pressedButtons_)
     163                for (InputState* state : inputStates_)
     164                    state->template buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
     165                        this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    164166
    165167            // Call states with device update events
    166             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    167                 inputStates_[i]->update(time.getDeltaTime(), this->getDeviceID());
     168            for (InputState* state : inputStates_)
     169                state->update(time.getDeltaTime(), this->getDeviceID());
    168170
    169171            static_cast<DeviceClass*>(this)->updateImpl(time);
     
    171173
    172174        //! Clears the list of pressed buttons and calls the derived class's method
    173         void clearBuffers()
     175        virtual void clearBuffers() override
    174176        {
    175177            pressedButtons_.clear();
     
    180182        OISDeviceClass* getOISDevice()   { return this->oisDevice_; }
    181183        // Returns the name of the derived class as string
    182         std::string getClassName() const { return DeviceClass::getClassNameImpl(); }
     184        virtual std::string getClassName() const override { return DeviceClass::getClassNameImpl(); }
    183185
    184186    protected:
     
    196198
    197199            // Call states
    198             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    199                 inputStates_[i]->buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     200            for (InputState* state : inputStates_)
     201                state->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    200202        }
    201203
     
    218220
    219221            // Call states
    220             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    221                 inputStates_[i]->buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     222            for (InputState* state : inputStates_)
     223                state->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    222224        }
    223225
  • code/branches/cpp11_v3/src/libraries/core/input/InputHandler.h

    r8729 r11054  
    119119    {
    120120    public:
    121         virtual ~InputHandler() { }
     121        virtual ~InputHandler() = default;
    122122
    123123        template<class T> void buttonEvent(unsigned int device, T button, ButtonEvent::TPress)
  • code/branches/cpp11_v3/src/libraries/core/input/InputManager.cc

    r10624 r11054  
    3939#include <ois/OISException.h>
    4040#include <ois/OISInputManager.h>
    41 #include <boost/foreach.hpp>
    4241#include <loki/ScopeGuard.h>
    4342
     
    7271    InputHandler InputHandler::EMPTY;
    7372
    74     InputManager* InputManager::singletonPtr_s = 0;
     73    InputManager* InputManager::singletonPtr_s = nullptr;
    7574
    7675    //! Defines the |= operator for easier use.
     
    9493    InputManager::InputManager()
    9594        : internalState_(Bad)
    96         , oisInputManager_(0)
     95        , oisInputManager_(nullptr)
    9796        , devices_(2)
    9897        , exclusiveMouse_(false)
    99         , emptyState_(0)
    100         , calibratorCallbackHandler_(0)
     98        , emptyState_(nullptr)
     99        , calibratorCallbackHandler_(nullptr)
    101100    {
    102101        RegisterObject(InputManager);
     
    149148        // When loading the devices they should not already be loaded
    150149        assert(internalState_ & Bad);
    151         assert(devices_[InputDeviceEnumerator::Mouse] == 0);
    152         assert(devices_[InputDeviceEnumerator::Keyboard] == 0);
     150        assert(devices_[InputDeviceEnumerator::Mouse] == nullptr);
     151        assert(devices_[InputDeviceEnumerator::Keyboard] == nullptr);
    153152        assert(devices_.size() == InputDeviceEnumerator::FirstJoyStick);
    154153
     
    210209        catch (const std::exception& ex)
    211210        {
    212             oisInputManager_ = NULL;
     211            oisInputManager_ = nullptr;
    213212            internalState_ |= Bad;
    214213            ThrowException(InitialisationFailed, "Could not initialise the input system: " << ex.what());
     
    294293
    295294        // Reset console commands
    296         ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(0);
    297         ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(0);
     295        ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(nullptr);
     296        ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(nullptr);
    298297
    299298        orxout(internal_status, context::input) << "InputManager: Destruction complete." << endl;
     
    310309        orxout(verbose, context::input) << "InputManager: Destroying devices..." << endl;
    311310
    312         BOOST_FOREACH(InputDevice*& device, devices_)
    313         {
    314             if (device == NULL)
     311        for (InputDevice*& device : devices_)
     312        {
     313            if (device == nullptr)
    315314                continue;
    316315            const std::string& className = device->getClassName();
    317316            delete device;
    318             device = 0;
     317            device = nullptr;
    319318            orxout(verbose, context::input) << className << " destroyed." << endl;
    320319        }
    321320        devices_.resize(InputDeviceEnumerator::FirstJoyStick);
    322321
    323         assert(oisInputManager_ != NULL);
     322        assert(oisInputManager_ != nullptr);
    324323        try
    325324        {
     
    331330                                                   << "Potential resource leak!" << endl;
    332331        }
    333         oisInputManager_ = NULL;
     332        oisInputManager_ = nullptr;
    334333
    335334        internalState_ |= Bad;
     
    374373        // check whether a state has changed its EMPTY situation
    375374        bool bUpdateRequired = false;
    376         for (std::map<int, InputState*>::iterator it = activeStates_.begin(); it != activeStates_.end(); ++it)
    377         {
    378             if (it->second->hasExpired())
    379             {
    380                 it->second->resetExpiration();
     375        for (const auto& mapEntry : activeStates_)
     376        {
     377            if (mapEntry.second->hasExpired())
     378            {
     379                mapEntry.second->resetExpiration();
    381380                bUpdateRequired = true;
    382381            }
     
    387386        // Capture all the input and collect the function calls
    388387        // No event gets triggered here yet!
    389         BOOST_FOREACH(InputDevice* device, devices_)
    390             if (device != NULL)
     388        for  (InputDevice* device : devices_)
     389            if (device != nullptr)
    391390                device->update(time);
    392391
    393392        // Collect function calls for the update
    394         for (unsigned int i = 0; i < activeStatesTicked_.size(); ++i)
    395             activeStatesTicked_[i]->update(time.getDeltaTime());
     393        for (InputState* state : activeStatesTicked_)
     394            state->update(time.getDeltaTime());
    396395
    397396        // Execute all cached function calls in order
     
    402401        // If we delay the calls, then OIS and and the InputStates are not anymore
    403402        // in the call stack and can therefore be edited.
    404         for (size_t i = 0; i < this->callBuffer_.size(); ++i)
    405             this->callBuffer_[i]();
     403        for (auto& function : this->callBuffer_)
     404            function();
    406405
    407406        this->callBuffer_.clear();
     
    419418        for (unsigned int i = 0; i < devices_.size(); ++i)
    420419        {
    421             if (devices_[i] == NULL)
     420            if (devices_[i] == nullptr)
    422421                continue;
    423422            std::vector<InputState*>& states = devices_[i]->getStateListRef();
     
    438437        // Using an std::set to avoid duplicates
    439438        std::set<InputState*> tempSet;
    440         for (unsigned int i = 0; i < devices_.size(); ++i)
    441             if (devices_[i] != NULL)
    442                 for (unsigned int iState = 0; iState < devices_[i]->getStateListRef().size(); ++iState)
    443                     tempSet.insert(devices_[i]->getStateListRef()[iState]);
     439        for (InputDevice* device : devices_)
     440            if (device != nullptr)
     441                for (unsigned int iState = 0; iState < device->getStateListRef().size(); ++iState)
     442                    tempSet.insert(device->getStateListRef()[iState]);
    444443
    445444        // Copy the content of the std::set back to the actual vector
    446445        activeStatesTicked_.clear();
    447         for (std::set<InputState*>::const_iterator it = tempSet.begin();it != tempSet.end(); ++it)
    448             activeStatesTicked_.push_back(*it);
     446        for (InputState* state : tempSet)
     447            activeStatesTicked_.push_back(state);
    449448
    450449        // Check whether we have to change the mouse mode
     
    466465    void InputManager::clearBuffers()
    467466    {
    468         BOOST_FOREACH(InputDevice* device, devices_)
    469             if (device != NULL)
     467        for (InputDevice* device : devices_)
     468            if (device != nullptr)
    470469                device->clearBuffers();
    471470    }
     
    476475                        << "When done, put the axex in the middle position and press enter." << endl;
    477476
    478         BOOST_FOREACH(InputDevice* device, devices_)
    479             if (device != NULL)
     477        for (InputDevice* device : devices_)
     478            if (device != nullptr)
    480479                device->startCalibration();
    481480
     
    487486    void InputManager::stopCalibration()
    488487    {
    489         BOOST_FOREACH(InputDevice* device, devices_)
    490             if (device != NULL)
     488        for (InputDevice* device : devices_)
     489            if (device != nullptr)
    491490                device->stopCalibration();
    492491
     
    509508    {
    510509        Mouse* mouse = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse]);
    511         if (mouse != NULL)
     510        if (mouse != nullptr)
    512511        {
    513512            const OIS::MouseState state = mouse->getOISDevice()->getMouseState();
     
    526525    {
    527526        if (name.empty())
    528             return 0;
     527            return nullptr;
    529528        if (statesByName_.find(name) == statesByName_.end())
    530529        {
     
    532531            {
    533532                // Make sure we don't add two high priority states with the same priority
    534                 for (std::map<std::string, InputState*>::const_iterator it = this->statesByName_.begin();
    535                     it != this->statesByName_.end(); ++it)
     533                for (const auto& mapEntry : this->statesByName_)
    536534                {
    537                     if (it->second->getPriority() == priority)
     535                    if (mapEntry.second->getPriority() == priority)
    538536                    {
    539537                        orxout(internal_warning, context::input) << "Could not add an InputState with the same priority '"
    540538                            << static_cast<int>(priority) << "' != 0." << endl;
    541                         return 0;
     539                        return nullptr;
    542540                    }
    543541                }
     
    551549        {
    552550            orxout(internal_warning, context::input) << "Could not add an InputState with the same name '" << name << "'." << endl;
    553             return 0;
     551            return nullptr;
    554552        }
    555553    }
     
    561559            return it->second;
    562560        else
    563             return 0;
     561            return nullptr;
    564562    }
    565563
  • code/branches/cpp11_v3/src/libraries/core/input/InputManager.h

    r8729 r11054  
    3535#include <string>
    3636#include <vector>
    37 #include <boost/function.hpp>
     37#include <functional>
    3838
    3939#include "util/Singleton.h"
     
    134134            Returns a pointer to a InputState referenced by name.
    135135        @return
    136             Returns NULL if state was not found.
     136            Returns nullptr if state was not found.
    137137        */
    138138        InputState* getState(const std::string& name);
     
    186186        // Function call caching
    187187        //-------------------------------
    188         void pushCall(const boost::function<void ()>& function)
     188        void pushCall(const std::function<void ()>& function)
    189189            { this->callBuffer_.push_back(function); }
    190190
     
    192192
    193193    private: // functions
    194         // don't mess with a Singleton
    195         InputManager(const InputManager&);
     194        // non-copyable:
     195        InputManager(const InputManager&) = delete;
     196        InputManager& operator=(const InputManager&) = delete;
    196197
    197198        // Internal methods
     
    208209
    209210        // From WindowEventListener
    210         void windowFocusChanged(bool bFocus);
     211        virtual void windowFocusChanged(bool bFocus) override;
    211212
    212213    private: // variables
     
    225226        std::vector<InputState*>            activeStatesTicked_;   //!< Like activeStates_, but only contains the ones that currently receive events
    226227
    227         std::vector<boost::function<void ()> > callBuffer_;        //!< Caches all calls from InputStates to be executed afterwards (see preUpdate)
     228        std::vector<std::function<void ()>> callBuffer_;        //!< Caches all calls from InputStates to be executed afterwards (see preUpdate)
    228229
    229230        static InputManager*                singletonPtr_s;        //!< Pointer reference to the singleton
  • code/branches/cpp11_v3/src/libraries/core/input/InputPrereqs.h

    r8729 r11054  
    454454        OrxEnumConstructors(InputStatePriority);
    455455
    456         static const int Empty        = -1;
    457         static const int Dynamic      = 0;
    458 
    459         static const int HighPriority = 1000;
    460         static const int Console      = HighPriority + 0;
    461         static const int Calibrator   = HighPriority + 1;
    462         static const int Detector     = HighPriority + 2;
     456        static constexpr int Empty        = -1;
     457        static constexpr int Dynamic      = 0;
     458
     459        static constexpr int HighPriority = 1000;
     460        static constexpr int Console      = HighPriority + 0;
     461        static constexpr int Calibrator   = HighPriority + 1;
     462        static constexpr int Detector     = HighPriority + 2;
    463463    };
    464464}
  • code/branches/cpp11_v3/src/libraries/core/input/InputState.cc

    r8729 r11054  
    4040        , bExpired_(true)
    4141        , handlers_(2)
    42         , joyStickHandlerAll_(0)
    43         , enterFunctor_(0)
    44         , leaveFunctor_(0)
     42        , joyStickHandlerAll_(nullptr)
     43        , enterFunctor_(nullptr)
     44        , leaveFunctor_(nullptr)
    4545    {
    4646        if (priority >= InputStatePriority::HighPriority || priority == InputStatePriority::Empty)
     
    4949            priority_ = 0;
    5050
    51         handlers_.resize(InputDeviceEnumerator::FirstJoyStick + this->getJoyStickList().size(), NULL);
     51        handlers_.resize(InputDeviceEnumerator::FirstJoyStick + this->getJoyStickList().size(), nullptr);
    5252    }
    5353
     
    5555    {
    5656        if (device < handlers_.size())
    57             return handlers_[device] != NULL;
     57            return handlers_[device] != nullptr;
    5858        else
    5959            return false;
     
    6464    {
    6565        unsigned int oldSize = handlers_.size();
    66         handlers_.resize(InputDeviceEnumerator::FirstJoyStick + joyStickList.size(), NULL);
     66        handlers_.resize(InputDeviceEnumerator::FirstJoyStick + joyStickList.size(), nullptr);
    6767
    6868        for (unsigned int i = oldSize; i < handlers_.size(); ++i)
  • code/branches/cpp11_v3/src/libraries/core/input/InputState.h

    r8729 r11054  
    3535#include <string>
    3636#include <vector>
    37 #include <boost/function.hpp>
    38 #include <boost/bind.hpp>
     37#include <functional>
    3938
    4039#include "util/tribool.h"
     
    4443
    4544#define INPUT_STATE_PUSH_CALL(deviceIndex, functionName, ...) \
    46     InputManager::getInstance().pushCall(boost::function<void ()>(boost::bind(&InputHandler::functionName, handlers_[deviceIndex], __VA_ARGS__)))
     45    InputManager::getInstance().pushCall(std::function<void ()>(std::bind(&InputHandler::functionName, handlers_[deviceIndex], __VA_ARGS__)))
    4746
    4847namespace orxonox
     
    156155    private:
    157156        InputState(const std::string& name, bool bAlwaysGetsInput, bool bTransparent, InputStatePriority priority);
    158         ~InputState() { }
    159 
    160         void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList);
     157        ~InputState() = default;
     158
     159        virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList) override;
    161160
    162161        //! Sets the priority (only to be used by the InputManager!)
     
    179178    {
    180179        for (unsigned int i = 0; i < handlers_.size(); ++i)
    181             if (handlers_[i] != NULL)
     180            if (handlers_[i] != nullptr)
    182181                INPUT_STATE_PUSH_CALL(i, allDevicesUpdated, dt);
    183182    }
     
    188187        {
    189188        case InputDeviceEnumerator::Keyboard:
    190             if (handlers_[keyboardIndex_s] != NULL)
     189            if (handlers_[keyboardIndex_s] != nullptr)
    191190                INPUT_STATE_PUSH_CALL(keyboardIndex_s, keyboardUpdated, dt);
    192191            break;
    193192
    194193        case InputDeviceEnumerator::Mouse:
    195             if (handlers_[mouseIndex_s] != NULL)
     194            if (handlers_[mouseIndex_s] != nullptr)
    196195                INPUT_STATE_PUSH_CALL(mouseIndex_s, mouseUpdated, dt);
    197196            break;
    198197
    199198        default: // joy sticks
    200             if (handlers_[device] != NULL)
     199            if (handlers_[device] != nullptr)
    201200                INPUT_STATE_PUSH_CALL(device, joyStickUpdated, device - firstJoyStickIndex_s, dt);
    202201            break;
     
    208207    {
    209208        assert(device < handlers_.size());
    210         if (handlers_[device] != NULL)
     209        if (handlers_[device] != nullptr)
    211210        {
    212211            // We have to store the function pointer to tell the compiler about its actual type because of overloading
    213212            void (InputHandler::*function)(unsigned int, ButtonTypeParam, EventType) = &InputHandler::buttonEvent<ButtonTypeParam>;
    214             InputManager::getInstance().pushCall(boost::function<void ()>(boost::bind(function, handlers_[device], device, button, EventType())));
     213            InputManager::getInstance().pushCall(std::function<void ()>(std::bind(function, handlers_[device], device, button, EventType())));
    215214        }
    216215    }
     
    218217    ORX_FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
    219218    {
    220         if (handlers_[mouseIndex_s] != NULL)
     219        if (handlers_[mouseIndex_s] != nullptr)
    221220            INPUT_STATE_PUSH_CALL(mouseIndex_s, mouseMoved, abs, rel, clippingSize);
    222221    }
     
    224223    ORX_FORCEINLINE void InputState::mouseScrolled(int abs, int rel)
    225224    {
    226         if (handlers_[mouseIndex_s] != NULL)
     225        if (handlers_[mouseIndex_s] != nullptr)
    227226            INPUT_STATE_PUSH_CALL(mouseIndex_s, mouseScrolled, abs, rel);
    228227    }
     
    231230    {
    232231        assert(device < handlers_.size());
    233         if (handlers_[device] != NULL)
     232        if (handlers_[device] != nullptr)
    234233            INPUT_STATE_PUSH_CALL(device, axisMoved, device - firstJoyStickIndex_s, axis, value);
    235234    }
  • code/branches/cpp11_v3/src/libraries/core/input/JoyStick.cc

    r10624 r11054  
    3131#include <climits>
    3232#include <ois/OISJoyStick.h>
    33 #include <boost/foreach.hpp>
    3433
    3534#include "util/StringUtils.h"
     
    7372        //deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Vector3));
    7473
    75         BOOST_FOREACH(std::string& idString, deviceNames_s)
     74        for (const std::string& idString : deviceNames_s)
    7675        {
    7776            if (deviceName_ == idString)
     
    128127    {
    129128        // Set initial values
    130         BOOST_FOREACH(int& minVal, configMinValues_)
     129        for (int& minVal : configMinValues_)
    131130            minVal = INT_MAX;
    132         BOOST_FOREACH(int& minVal, configMaxValues_)
     131        for (int& minVal : configMaxValues_)
    133132            minVal = INT_MIN;
    134         BOOST_FOREACH(int& zeroVal, configZeroValues_)
     133        for (int& zeroVal : configZeroValues_)
    135134            zeroVal = 0;
    136135    }
     
    187186    void JoyStick::clearBuffersImpl()
    188187    {
    189         for (int j = 0; j < 4; ++j)
    190             povStates_[j] = 0;
     188        for (int& state : povStates_)
     189            state = 0;
    191190    }
    192191
     
    209208                fValue *= negativeCoeffs_[axis];
    210209
    211             BOOST_FOREACH(InputState* state, inputStates_)
     210            for (InputState* state : inputStates_)
    212211                state->joyStickAxisMoved(this->getDeviceID(), axis, fValue);
    213212        }
  • code/branches/cpp11_v3/src/libraries/core/input/JoyStick.h

    r9667 r11054  
    7070        //! Assigns a generated ID string and loads the calibration (if present)
    7171        JoyStick(unsigned int id, OIS::InputManager* oisInputManager);
    72         ~JoyStick() { }
     72        ~JoyStick() = default;
    7373        void setConfigValues();
    7474
     
    7777
    7878    private:
    79         void calibrationStarted();
    80         void calibrationStopped();
     79        virtual void calibrationStarted() override;
     80        virtual void calibrationStopped() override;
    8181        void evaluateCalibration();
    8282
     
    8686
    8787        //! OIS event handler
    88         bool buttonPressed (const OIS::JoyStickEvent &arg, int button)
     88        virtual bool buttonPressed (const OIS::JoyStickEvent &arg, int button) override
    8989        {
    9090            super::buttonPressed(static_cast<JoyStickButtonCode::ByEnum>(button));
     
    9393
    9494        //! OIS event handler
    95         bool buttonReleased(const OIS::JoyStickEvent &arg, int button)
     95        virtual bool buttonReleased(const OIS::JoyStickEvent &arg, int button) override
    9696        {
    9797            super::buttonReleased(static_cast<JoyStickButtonCode::ByEnum>(button));
     
    9999        }
    100100
    101         bool axisMoved     (const OIS::JoyStickEvent &arg, int axis);
    102         bool sliderMoved   (const OIS::JoyStickEvent &arg, int id);
    103         bool povMoved      (const OIS::JoyStickEvent &arg, int id);
     101        virtual bool axisMoved     (const OIS::JoyStickEvent &arg, int axis) override;
     102        virtual bool sliderMoved   (const OIS::JoyStickEvent &arg, int id) override;
     103        virtual bool povMoved      (const OIS::JoyStickEvent &arg, int id) override;
    104104        //! OIS event handler (don't remove that because of OIS version issues!)
    105         bool vector3Moved  (const OIS::JoyStickEvent &arg, int id) { return true; }
     105        virtual bool vector3Moved  (const OIS::JoyStickEvent &arg, int id) override { return true; }
    106106
    107107        //! Returns the class name as string
  • code/branches/cpp11_v3/src/libraries/core/input/JoyStickQuantityListener.cc

    r10624 r11054  
    4747    {
    4848        joyStickList_s = joyStickList;
    49         for (ObjectList<JoyStickQuantityListener>::iterator it = ObjectList<JoyStickQuantityListener>::begin(); it; ++it)
    50             it->JoyStickQuantityChanged(joyStickList);
     49        for (JoyStickQuantityListener* listener : ObjectList<JoyStickQuantityListener>())
     50            listener->JoyStickQuantityChanged(joyStickList);
    5151    }
    5252}
  • code/branches/cpp11_v3/src/libraries/core/input/JoyStickQuantityListener.h

    r9667 r11054  
    4848    protected:
    4949        JoyStickQuantityListener();
    50         virtual ~JoyStickQuantityListener() { }
     50        virtual ~JoyStickQuantityListener() = default;
    5151
    5252        //! Returns a list with all JoySticks currently loaded
  • code/branches/cpp11_v3/src/libraries/core/input/KeyBinder.cc

    r11052 r11054  
    5353        : deriveTime_(0.0f)
    5454        , filename_(filename)
    55         , configFile_(NULL)
    56         , fallbackConfigFile_(NULL)
     55        , configFile_(nullptr)
     56        , fallbackConfigFile_(nullptr)
    5757    {
    5858        mouseRelative_[0] = 0;
     
    153153    void KeyBinder::buttonThresholdChanged()
    154154    {
    155         for (unsigned int i = 0; i < allHalfAxes_.size(); i++)
    156             if (!allHalfAxes_[i]->bButtonThresholdUser_)
    157                 allHalfAxes_[i]->buttonThreshold_ = this->buttonThreshold_;
     155        for (HalfAxis* halfAxis : allHalfAxes_)
     156            if (!halfAxis->bButtonThresholdUser_)
     157                halfAxis->buttonThreshold_ = this->buttonThreshold_;
    158158    }
    159159
     
    170170
    171171        // load the bindings if required
    172         if (configFile_ != NULL)
     172        if (configFile_ != nullptr)
    173173        {
    174174            for (unsigned int iDev = oldValue; iDev < joySticks_.size(); ++iDev)
     
    188188    {
    189189        while (joyStickAxes_.size() < joySticks_.size())
    190             joyStickAxes_.push_back(shared_ptr<JoyStickAxisVector>(new JoyStickAxisVector()));
     190            joyStickAxes_.push_back(std::make_shared<JoyStickAxisVector>());
    191191        while (joyStickButtons_.size() < joySticks_.size())
    192             joyStickButtons_.push_back(shared_ptr<JoyStickButtonVector>(new JoyStickButtonVector()));
     192            joyStickButtons_.push_back(std::make_shared<JoyStickButtonVector>());
    193193        // For the case the new size is smaller
    194194        this->joyStickAxes_.resize(joySticks_.size());
     
    274274
    275275        // Parse bindings and create the ConfigValueContainers if necessary
    276         for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    277         {
    278             it->second->readBinding(this->configFile_, this->fallbackConfigFile_);
    279             addButtonToCommand(it->second->bindingString_, it->second);
     276        for (const auto& mapEntry : allButtons_)
     277        {
     278            mapEntry.second->readBinding(this->configFile_, this->fallbackConfigFile_);
     279            addButtonToCommand(mapEntry.second->bindingString_, mapEntry.second);
    280280        }
    281281
     
    420420    void KeyBinder::clearBindings()
    421421    {
    422         for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    423             it->second->clear();
    424 
    425         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
    426             delete paramCommandBuffer_[i];
     422        for (const auto& mapEntry : allButtons_)
     423            mapEntry.second->clear();
     424
     425        for (BufferedParamCommand* command : paramCommandBuffer_)
     426            delete command;
    427427        paramCommandBuffer_.clear();
    428428    }
     
    434434    {
    435435        // iterate over all buttons
    436         for (std::map<std::string, Button*>::iterator it = this->allButtons_.begin(); it != this->allButtons_.end(); ++it)
    437         {
    438             Button* button = it->second;
     436        for (const auto& mapEntry : this->allButtons_)
     437        {
     438            Button* button = mapEntry.second;
    439439
    440440            // iterate over all modes
     
    479479                        {
    480480                            delete[] button->commands_[mode_index];
    481                             button->commands_[mode_index] = 0;
     481                            button->commands_[mode_index] = nullptr;
    482482                        }
    483483
     
    505505        this->mousePosition_[1] = 0.0f;
    506506
    507         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    508             mouseAxes_[i].reset();
     507        for (HalfAxis& axis : mouseAxes_)
     508            axis.reset();
    509509    }
    510510
     
    545545        }
    546546
    547         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
     547        for (HalfAxis& axis : mouseAxes_)
    548548        {
    549549            // Why dividing relative value by dt? The reason lies in the simple fact, that when you
     
    555555            {
    556556                // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway..
    557                 mouseAxes_[i].relVal_ /= dt;
    558             }
    559 
    560             tickHalfAxis(mouseAxes_[i]);
     557                axis.relVal_ /= dt;
     558            }
     559
     560            tickHalfAxis(axis);
    561561        }
    562562    }
  • code/branches/cpp11_v3/src/libraries/core/input/KeyBinder.h

    r11052 r11054  
    3636#include <vector>
    3737#include <map>
    38 #include <boost/shared_ptr.hpp>
     38#include <memory>
    3939
    4040#include "InputHandler.h"
     
    8585        void compilePointerLists();
    8686        // from JoyStickQuantityListener interface
    87         virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList);
    88 
    89         void allDevicesUpdated(float dt);
    90         void mouseUpdated(float dt);
    91         void joyStickUpdated(unsigned int joyStick, float dt);
     87        virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList) override;
     88
     89        virtual void allDevicesUpdated(float dt) override;
     90        virtual void mouseUpdated(float dt) override;
     91        virtual void joyStickUpdated(unsigned int joyStick, float dt) override;
    9292        // internal
    9393        void tickHalfAxis(HalfAxis& halfAxis);
    9494
    95         void buttonPressed (const KeyEvent& evt);
    96         void buttonReleased(const KeyEvent& evt);
    97         void buttonHeld    (const KeyEvent& evt);
    98 
    99         void buttonPressed (MouseButtonCode::ByEnum button);
    100         void buttonReleased(MouseButtonCode::ByEnum button);
    101         void buttonHeld    (MouseButtonCode::ByEnum button);
    102         void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
    103         void mouseScrolled (int abs, int rel);
    104 
    105         void buttonPressed (unsigned int device, JoyStickButtonCode::ByEnum button);
    106         void buttonReleased(unsigned int device, JoyStickButtonCode::ByEnum button);
    107         void buttonHeld    (unsigned int device, JoyStickButtonCode::ByEnum button);
    108         void axisMoved     (unsigned int device, unsigned int axis, float value);
     95        virtual void buttonPressed (const KeyEvent& evt) override;
     96        virtual void buttonReleased(const KeyEvent& evt) override;
     97        virtual void buttonHeld    (const KeyEvent& evt) override;
     98
     99        virtual void buttonPressed (MouseButtonCode::ByEnum button) override;
     100        virtual void buttonReleased(MouseButtonCode::ByEnum button) override;
     101        virtual void buttonHeld    (MouseButtonCode::ByEnum button) override;
     102        virtual void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) override;
     103        virtual void mouseScrolled (int abs, int rel) override;
     104
     105        virtual void buttonPressed (unsigned int device, JoyStickButtonCode::ByEnum button) override;
     106        virtual void buttonReleased(unsigned int device, JoyStickButtonCode::ByEnum button) override;
     107        virtual void buttonHeld    (unsigned int device, JoyStickButtonCode::ByEnum button) override;
     108        virtual void axisMoved     (unsigned int device, unsigned int axis, float value) override;
    109109
    110110    protected: // variables
     
    128128        };
    129129        //! Actual key bindings for joy stick buttons
    130         std::vector<shared_ptr<JoyStickButtonVector> > joyStickButtons_;
     130        std::vector<std::shared_ptr<JoyStickButtonVector>> joyStickButtons_;
    131131        //! Helper class to use something like std:vector<HalfAxis[48]>
    132132        struct JoyStickAxisVector
     
    136136        };
    137137        //! Actual key bindings for joy stick axes (and sliders)
    138         std::vector<shared_ptr<JoyStickAxisVector> > joyStickAxes_;
     138        std::vector<std::shared_ptr<JoyStickAxisVector>> joyStickAxes_;
    139139
    140140        //! Pointer map with all Buttons, including half axes
     
    143143        std::vector<HalfAxis*> allHalfAxes_;
    144144        //! Maps input commands to all Button names, including half axes
    145         std::map< std::string, std::vector<std::string> > allCommands_;
     145        std::map< std::string, std::vector<std::string>> allCommands_;
    146146
    147147        /**
     
    160160        //! Name of the file used in this KeyBinder (constant!)
    161161        const std::string filename_;
    162         //! Config file used. NULL in case of KeyDetector. Also indicates whether we've already loaded.
     162        //! Config file used. nullptr in case of KeyDetector. Also indicates whether we've already loaded.
    163163        ConfigFile* configFile_;
    164164        //! Config file from the data directory that only serves as fallback
     
    227227    {
    228228        // execute all buffered bindings (additional parameter)
    229         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
     229        for (BufferedParamCommand* command : paramCommandBuffer_)
    230230        {
    231             paramCommandBuffer_[i]->rel_ *= dt;
    232             paramCommandBuffer_[i]->execute();
     231            command->rel_ *= dt;
     232            command->execute();
    233233        }
    234234
    235235        // always reset the relative movement of the mouse
    236         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    237             mouseAxes_[i].relVal_ = 0.0f;
     236        for (HalfAxis& axis : mouseAxes_)
     237            axis.relVal_ = 0.0f;
    238238    }
    239239}// tolua_export
  • code/branches/cpp11_v3/src/libraries/core/input/KeyBinderManager.cc

    r10624 r11054  
    5656
    5757    KeyBinderManager::KeyBinderManager()
    58         : currentBinder_(NULL)
     58        : currentBinder_(nullptr)
    5959        , bDefaultFileLoaded_(true)
    6060        , bBinding_(false)
     
    7676    {
    7777        // Delete all remaining KeyBinders
    78         for (std::map<std::string, KeyBinder*>::const_iterator it = this->binders_.begin(); it != this->binders_.end(); ++it)
    79             delete it->second;
     78        for (const auto& mapEntry : this->binders_)
     79            delete mapEntry.second;
    8080
    8181        // Reset console commands
    82         ModifyConsoleCommand(__CC_keybind_name ).setObject(0);
    83         ModifyConsoleCommand(__CC_tkeybind_name).setObject(0);
    84         ModifyConsoleCommand(__CC_unbind_name  ).setObject(0);
    85         ModifyConsoleCommand(__CC_tunbind_name ).setObject(0);
     82        ModifyConsoleCommand(__CC_keybind_name ).setObject(nullptr);
     83        ModifyConsoleCommand(__CC_tkeybind_name).setObject(nullptr);
     84        ModifyConsoleCommand(__CC_unbind_name  ).setObject(nullptr);
     85        ModifyConsoleCommand(__CC_tunbind_name ).setObject(nullptr);
    8686    }
    8787
     
    205205    void KeyBinderManager::registerKeybindCallback(LuaFunctor* function)
    206206    {
    207         this->callbackFunction_ = function;
     207        this->callbackFunction_.reset(function);
    208208    }
    209209}
  • code/branches/cpp11_v3/src/libraries/core/input/KeyBinderManager.h

    r9667 r11054  
    3434#include <map>
    3535#include <string>
     36#include <memory>
    3637
    3738#include "util/Singleton.h"
     
    101102
    102103    private:
    103         KeyBinderManager(const KeyBinderManager&);
     104        // non-copyable:
     105        KeyBinderManager(const KeyBinderManager&) = delete;
     106        KeyBinderManager& operator=(const KeyBinderManager&) = delete;
     107
    104108        void keybindInternal(const std::string& command, bool bTemporary);
    105109        void keybindKeyPressed(const std::string& keyName);
     
    107111
    108112        // KeyBinder management
    109         KeyBinder* currentBinder_;                   //! Currently selected KeyBinder (never NULL!)
    110         std::map<std::string, KeyBinder*> binders_;  //! All loaded KeyBinders
    111         bool bDefaultFileLoaded_;                    //! Tells whether the default one is loaded
    112         std::string defaultFilename_;                //! Name of the file with the default key bindings
     113        KeyBinder* currentBinder_;                      //! Currently selected KeyBinder (never nullptr!)
     114        std::map<std::string, KeyBinder*> binders_;     //! All loaded KeyBinders
     115        bool bDefaultFileLoaded_;                       //! Tells whether the default one is loaded
     116        std::string defaultFilename_;                   //! Name of the file with the default key bindings
    113117
    114118        // keybind command related
    115         SharedPtr<LuaFunctor> callbackFunction_;     //! Function to be called when key was pressed after "keybind" command
    116         bool bBinding_;                              //! Tells whether a key binding process is active
    117         bool bTemporary_;                            //! Stores tkeybind/keybind value
    118         std::string command_;                        //! Stores the command received by (t)keybind
     119        std::shared_ptr<LuaFunctor> callbackFunction_;  //! Function to be called when key was pressed after "keybind" command
     120        bool bBinding_;                                 //! Tells whether a key binding process is active
     121        bool bTemporary_;                               //! Stores tkeybind/keybind value
     122        std::string command_;                           //! Stores the command received by (t)keybind
    119123
    120124        static KeyBinderManager* singletonPtr_s;
  • code/branches/cpp11_v3/src/libraries/core/input/KeyDetector.cc

    r10624 r11054  
    6262    KeyDetector::~KeyDetector()
    6363    {
    64         inputState_->setHandler(NULL);
     64        inputState_->setHandler(nullptr);
    6565        InputManager::getInstance().destroyState("detector");
    6666        ModifyConsoleCommand(__CC_KeyDetector_callback_name).resetFunction();
     
    7070    {
    7171        // Assign every button/axis the same command, but with its name as argument
    72         for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    73             it->second->parse(__CC_KeyDetector_callback_name + ' ' + it->second->groupName_ + "." + it->second->name_);
     72        for (const auto& mapEntry : allButtons_)
     73            mapEntry.second->parse(__CC_KeyDetector_callback_name + ' ' + mapEntry.second->groupName_ + "." + mapEntry.second->name_);
    7474    }
    7575
  • code/branches/cpp11_v3/src/libraries/core/input/KeyDetector.h

    r8729 r11054  
    4848
    4949    private:
    50         KeyDetector(const KeyDetector&);
     50        // non-copyable:
     51        KeyDetector(const KeyDetector&) = delete;
     52        KeyDetector& operator=(const KeyDetector&) = delete;
    5153
    5254        void callback(const std::string& name);
    53         void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList);
     55        virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList) override;
    5456        void assignCommands();
    5557
  • code/branches/cpp11_v3/src/libraries/core/input/Keyboard.h

    r8729 r11054  
    6363        //! Only resets the keyboard modifiers. Initialising is done in the base class.
    6464        Keyboard(unsigned int id, OIS::InputManager* oisInputManager) : super(id, oisInputManager), modifiers_(0) { }
    65         ~Keyboard() { }
     65        ~Keyboard() = default;
    6666
    6767    private:
     
    7575        }
    7676
    77         bool keyPressed(const OIS::KeyEvent& arg);
    78         bool keyReleased(const OIS::KeyEvent& arg);
     77        virtual bool keyPressed(const OIS::KeyEvent& arg) override;
     78        virtual bool keyReleased(const OIS::KeyEvent& arg) override;
    7979
    8080        //! Returns the class name as string
  • code/branches/cpp11_v3/src/libraries/core/input/Mouse.cc

    r10624 r11054  
    6868    {
    6969#ifdef ORXONOX_PLATFORM_LINUX
    70         ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(0);
    71         ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(0);
     70        ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(nullptr);
     71        ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(nullptr);
    7272#endif
    7373    }
     
    8282            IntVector2 rel(e.state.X.rel, e.state.Y.rel);
    8383            IntVector2 clippingSize(e.state.width, e.state.height);
    84             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    85                 inputStates_[i]->mouseMoved(abs, rel, clippingSize);
     84            for (InputState* state : inputStates_)
     85                state->mouseMoved(abs, rel, clippingSize);
    8686        }
    8787
     
    8989        if (e.state.Z.rel != 0)
    9090        {
    91             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    92                 inputStates_[i]->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
     91            for (InputState* state : inputStates_)
     92                state->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
    9393        }
    9494
  • code/branches/cpp11_v3/src/libraries/core/input/Mouse.h

    r7809 r11054  
    7474    private:
    7575        //! OIS event handler
    76         bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
     76        virtual bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
    7777        {
    7878            super::buttonPressed(static_cast<MouseButtonCode::ByEnum>(id));
     
    8181
    8282        //! OIS event handler
    83         bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
     83        virtual bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
    8484        {
    8585            super::buttonReleased(static_cast<MouseButtonCode::ByEnum>(id));
     
    8787        }
    8888
    89         bool mouseMoved(const OIS::MouseEvent &arg);
     89        virtual bool mouseMoved(const OIS::MouseEvent &arg) override;
    9090
    91         void windowResized(unsigned int newWidth, unsigned int newHeight);
     91        virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override;
    9292
    9393        // Returns the class name as string
  • code/branches/cpp11_v3/src/libraries/core/module/DynLib.cc

    r10540 r11054  
    5656    {
    5757        mName = name;
    58         m_hInst = NULL;
     58        m_hInst = nullptr;
    5959    }
    6060
     
    127127            FORMAT_MESSAGE_FROM_SYSTEM |
    128128            FORMAT_MESSAGE_IGNORE_INSERTS,
    129             NULL,
     129            nullptr,
    130130            GetLastError(),
    131131            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
    132132            (LPTSTR) &lpMsgBuf,
    133133            0,
    134             NULL
     134            nullptr
    135135            );
    136136        std::string ret = (char*)lpMsgBuf;
  • code/branches/cpp11_v3/src/libraries/core/module/DynLib.h

    r10541 r11054  
    4545#if defined(ORXONOX_PLATFORM_WINDOWS)
    4646#    define DYNLIB_HANDLE hInstance
    47 #    define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, LOAD_WITH_ALTERED_SEARCH_PATH )
     47#    define DYNLIB_LOAD( a ) LoadLibraryEx( a, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH )
    4848#    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
    4949#    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
     
    104104                the symbol.
    105105            @par
    106                 If the function fails, the returned value is <b>NULL</b>.
     106                If the function fails, the returned value is <b>nullptr</b>.
    107107
    108108        */
  • code/branches/cpp11_v3/src/libraries/core/module/DynLibManager.cc

    r10540 r11054  
    3838    //-----------------------------------------------------------------------
    3939    //! Static pointer to the singleton
    40     DynLibManager* DynLibManager::singletonPtr_s  = 0;
     40    DynLibManager* DynLibManager::singletonPtr_s  = nullptr;
    4141
    4242    //-----------------------------------------------------------------------
     
    7575    {
    7676        // Unload & delete resources in turn
    77         for (DynLibList::iterator it = mLibList.begin(); it != mLibList.end(); ++it)
     77        for (const auto& mapEntry : mLibList)
    7878        {
    79             it->second->unload();
    80             delete it->second;
     79            mapEntry.second->unload();
     80            delete mapEntry.second;
    8181        }
    8282
  • code/branches/cpp11_v3/src/libraries/core/module/ModuleInstance.cc

    r10549 r11054  
    3333namespace orxonox
    3434{
    35     ModuleInstance* ModuleInstance::currentModuleInstance_s = NULL;
     35    ModuleInstance* ModuleInstance::currentModuleInstance_s = nullptr;
    3636
    3737    ModuleInstance::ModuleInstance(const std::string& libraryName)
    3838        : libraryName_(libraryName)
    39         , dynLib_(NULL)
     39        , dynLib_(nullptr)
    4040    {
    4141    }
     
    5959    {
    6060        const std::set<StaticallyInitializedInstance*>& instances = this->staticallyInitializedInstancesByType_[type];
    61         for (std::set<StaticallyInitializedInstance*>::iterator it = instances.begin(); it != instances.end(); ++it)
    62             (*it)->load();
     61        for (StaticallyInitializedInstance* instance : instances)
     62            instance->load();
    6363    }
    6464
     
    7373    void ModuleInstance::deleteAllStaticallyInitializedInstances()
    7474    {
    75         std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*> > copy(this->staticallyInitializedInstancesByType_);
     75        std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>> copy(this->staticallyInitializedInstancesByType_);
    7676        this->staticallyInitializedInstancesByType_.clear();
    77         for (std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*> >::iterator it1 = copy.begin(); it1 != copy.end(); ++it1)
    78             for (std::set<StaticallyInitializedInstance*>::iterator it2 = it1->second.begin(); it2 != it1->second.end(); ++it2)
    79                 delete (*it2);
     77        for (const auto& mapEntry : copy)
     78            for (StaticallyInitializedInstance* instance : mapEntry.second)
     79                delete instance;
    8080    }
    8181
  • code/branches/cpp11_v3/src/libraries/core/module/ModuleInstance.h

    r10549 r11054  
    6969
    7070        private:
    71             std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*> > staticallyInitializedInstancesByType_;
     71            std::map<StaticInitialization::Type, std::set<StaticallyInitializedInstance*>> staticallyInitializedInstancesByType_;
    7272            std::string libraryName_;
    7373            DynLib* dynLib_;
  • code/branches/cpp11_v3/src/libraries/core/module/Plugin.cc

    r11015 r11054  
    3939    {
    4040        this->referenceCounter_ = 0;
    41         this->moduleInstance_ = NULL;
     41        this->moduleInstance_ = nullptr;
    4242    }
    4343
     
    4545    {
    4646        // force unloading of the module when the plugin is destroyed
    47         if (this->moduleInstance_ != NULL)
     47        if (this->moduleInstance_ != nullptr)
    4848            this->unloadModule();
    4949    }
  • code/branches/cpp11_v3/src/libraries/core/module/PluginManager.cc

    r11017 r11054  
    5454    SetConsoleCommand("PluginManager", __CC_PluginManager_unload_name, &PluginManager::unloadPlugin);
    5555
    56     PluginManager* PluginManager::singletonPtr_s  = 0;
     56    PluginManager* PluginManager::singletonPtr_s  = nullptr;
    5757
    5858    RegisterAbstractClass(PluginManager).inheritsFrom<Configurable>();
     
    7070    PluginManager::~PluginManager()
    7171    {
    72         ModifyConsoleCommand("PluginManager", __CC_PluginManager_load_name).setObject(NULL);
    73         ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(NULL);
     72        ModifyConsoleCommand("PluginManager", __CC_PluginManager_load_name).setObject(nullptr);
     73        ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(nullptr);
    7474
    75         for (std::map<std::string, PluginReference*>::iterator it = this->references_.begin(); it != this->references_.end(); ++it)
    76             delete it->second;
    77         for (std::map<std::string, Plugin*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)
    78             delete it->second;
     75        for (const auto& mapEntry : this->references_)
     76            delete mapEntry.second;
     77        for (const auto& mapEntry : this->plugins_)
     78            delete mapEntry.second;
    7979    }
    8080
     
    9696    {
    9797        const std::vector<std::string>& pluginPaths = ApplicationPaths::getInstance().getPluginPaths();
    98         for (std::vector<std::string>::const_iterator it = pluginPaths.begin(); it != pluginPaths.end(); ++it)
     98        for (const std::string& libraryName : pluginPaths)
    9999        {
    100100            std::string name;
    101             std::string libraryName = (*it);
    102101            std::string filename = libraryName +  + specialConfig::pluginExtension;
    103102            std::ifstream infile(filename.c_str());
     
    117116    {
    118117        Plugin* plugin = this->plugins_[name];
    119         if (plugin != NULL)
     118        if (plugin != nullptr)
    120119            plugin->reference();
    121120        else
     
    126125    {
    127126        Plugin* plugin = this->plugins_[name];
    128         if (plugin != NULL)
     127        if (plugin != nullptr)
    129128            plugin->dereference(this->bMerelyDeactivatePlugins_);
    130129        else
     
    137136    void PluginManager::loadPlugin(const std::string& name)
    138137    {
    139         if (this->references_[name] == NULL)
     138        if (this->references_[name] == nullptr)
    140139        {
    141140            this->references_[name] = new PluginReference(name);
     
    152151    {
    153152        PluginReference* reference = this->references_[name];
    154         if (reference != NULL)
     153        if (reference != nullptr)
    155154        {
    156             this->references_[name] = NULL;
     155            this->references_[name] = nullptr;
    157156            delete reference;
    158157        }
  • code/branches/cpp11_v3/src/libraries/core/module/StaticInitializationHandler.h

    r10532 r11054  
    3737    {
    3838        public:
    39             StaticInitializationHandler() {}
    40             virtual ~StaticInitializationHandler() {}
     39            StaticInitializationHandler() = default;
     40            virtual ~StaticInitializationHandler() = default;
    4141
    4242            virtual void setupHandler() = 0;
  • code/branches/cpp11_v3/src/libraries/core/module/StaticInitializationHandlerIncludes.h

    r10535 r11054  
    5353            ~StaticallyInitializedStaticInitializationHandler() { delete handler_; }
    5454
    55             virtual void load();
    56             virtual void unload();
     55            virtual void load() override;
     56            virtual void unload() override;
    5757
    5858            inline StaticInitializationHandler& getHandler()
  • code/branches/cpp11_v3/src/libraries/core/module/StaticInitializationManager.cc

    r10542 r11054  
    3333namespace orxonox
    3434{
    35     StaticInitializationManager* StaticInitializationManager::singletonPtr_s = 0;
     35    StaticInitializationManager* StaticInitializationManager::singletonPtr_s = nullptr;
    3636
    3737    void StaticInitializationManager::addHandler(StaticInitializationHandler* handler)
     
    5050    {
    5151        // attention: loading a module may add new handlers to the list
    52         for (std::list<StaticInitializationHandler*>::iterator it = this->handlers_.begin(); it != this->handlers_.end(); ++it)
    53             (*it)->loadModule(module);
     52        for (StaticInitializationHandler* handler : this->handlers_)
     53            handler->loadModule(module);
    5454    }
    5555
  • code/branches/cpp11_v3/src/libraries/core/module/StaticInitializationManager.h

    r10542 r11054  
    4343
    4444        public:
    45             StaticInitializationManager() {}
    46             virtual ~StaticInitializationManager() {}
     45            StaticInitializationManager() = default;
     46            virtual ~StaticInitializationManager() = default;
    4747
    4848            void addHandler(StaticInitializationHandler* handler);
  • code/branches/cpp11_v3/src/libraries/core/object/ClassFactory.h

    r9667 r11054  
    5353    {
    5454        public:
    55             virtual ~Factory() {}
     55            Factory() = default;
     56            virtual ~Factory() = default;
    5657            virtual Identifiable* fabricate(Context* context) = 0;
    5758    };
  • code/branches/cpp11_v3/src/libraries/core/object/Context.cc

    r10624 r11054  
    4040    RegisterClass(Context);
    4141
    42     Context* Context::rootContext_s = 0;
     42    Context* Context::rootContext_s = nullptr;
    4343
    4444    Context* getContextForInitializationOfOtherContexts()
     
    4646        static size_t count = 0;
    4747        // the first time this is called, ++count returns 1 and the context is created
    48         // the second time this is called, ++count returns 2 and NULL is returned because we're in the constructor of the context itself
     48        // the second time this is called, ++count returns 2 and nullptr is returned because we're in the constructor of the context itself
    4949        // for each future call the context (now completely created) is returned
    5050        if (++count == 2)
    51             return NULL;
     51            return nullptr;
    5252        else
    5353        {
    54             static Context context(NULL);
     54            static Context context(nullptr);
    5555            return &context;
    5656        }
     
    7070        // unregister context from object lists before object lists are destroyed
    7171        this->unregisterObject();
    72         for (size_t i = 0; i < this->objectLists_.size(); ++i)
    73             delete this->objectLists_[i];
     72        for (ObjectListBase* objectList : this->objectLists_)
     73            delete objectList;
    7474    }
    7575
     
    8282    {
    8383        delete Context::rootContext_s;
    84         Context::rootContext_s = NULL;
     84        Context::rootContext_s = nullptr;
    8585    }
    8686
    8787    /*static*/ Context* Context::getRootContext()
    8888    {
    89         OrxVerify(Context::rootContext_s != NULL, "Root Context is undefined");
     89        OrxVerify(Context::rootContext_s != nullptr, "Root Context is undefined");
    9090        return Context::rootContext_s;
    9191    }
     
    105105        ObjectListBase* objectList = this->getObjectList(identifier);
    106106        delete objectList;
    107         this->objectLists_[identifier->getClassID()] = NULL;
     107        this->objectLists_[identifier->getClassID()] = nullptr;
    108108    }
    109109}
  • code/branches/cpp11_v3/src/libraries/core/object/DestroyLaterManager.h

    r10624 r11054  
    4545            virtual ~DestroyLaterManager();
    4646
    47             virtual void preUpdate(const Clock& time) { /*no action*/ }
    48             virtual void postUpdate(const Clock& time);
     47            virtual void preUpdate(const Clock& time) override { /*no action*/ }
     48            virtual void postUpdate(const Clock& time) override;
    4949
    5050            void retain(Destroyable* instance)
     
    5252
    5353        private:
    54             std::vector<StrongPtr<Destroyable> > retainedInstances_;
     54            std::vector<StrongPtr<Destroyable>> retainedInstances_;
    5555
    5656            static DestroyLaterManager* singletonPtr_s;
  • code/branches/cpp11_v3/src/libraries/core/object/Destroyable.cc

    r11019 r11054  
    7070    void Destroyable::destroy()
    7171    {
    72         assert(this); // Just in case someone tries to delete a NULL pointer
     72        assert(this); // Just in case someone tries to delete a nullptr
    7373        this->requestedDestruction_ = true;
    7474        if (this->referenceCount_ == 0)
  • code/branches/cpp11_v3/src/libraries/core/object/Iterator.h

    r10624 r11054  
    7070    */
    7171    template <class T>
    72     class Iterator : public IteratorBase<T, Iterator<T> >
     72    class Iterator : public IteratorBase<T, Iterator<T>>
    7373    {
    7474        public:
     
    7676                @brief Constructor: Sets the element, whereon the iterator points, to zero.
    7777            */
    78             inline Iterator() : IteratorBase<T, Iterator<T> >() {}
    79 
    80             /**
    81                 @brief Constructor: Sets this element to a given element
    82                 @param element The element
    83             */
    84             inline Iterator(ObjectListBaseElement* element) : IteratorBase<T, Iterator<T> >(element) {}
     78            inline Iterator() : IteratorBase<T, Iterator<T>>() {}
    8579
    8680            /**
     
    8882                @param other The other Iterator
    8983            */
    90             inline Iterator(const IteratorBase<T, Iterator<T> >& other) : IteratorBase<T, Iterator<T> >(other) {}
     84            template <class OT, class OI>
     85            inline Iterator(const IteratorBase<OT, OI>& other) : IteratorBase<T, Iterator<T>>(other) {}
    9186
    9287            /**
  • code/branches/cpp11_v3/src/libraries/core/object/IteratorBase.h

    r10624 r11054  
    3737
    3838#include "core/CorePrereqs.h"
    39 
    40 #include <boost/static_assert.hpp>
    41 #include <boost/type_traits/is_base_of.hpp>
    4239
    4340#include "ObjectListBase.h"
     
    5249    class IteratorBase : public ObjectListElementRemovalListener
    5350    {
    54         BOOST_STATIC_ASSERT((boost::is_base_of<Listable, T>::value));
    55 
    56         protected:
     51        static_assert(std::is_base_of<Listable, T>::value, "IteratorBase can only be used with Listables");
     52
     53        public:
    5754            /**
    5855                @brief Constructor: Sets the element, whereon the iterator points, to the given element.
    59                 This constructor is protected and only for internal usage (don't mess with the BaseElements directly).
    60             */
    61             inline IteratorBase(ObjectListBaseElement* element = NULL)
     56            */
     57            inline IteratorBase(ObjectListElement<T>* element = nullptr)
    6258            {
    6359                this->element_ = element;
     
    6561            }
    6662
    67 
    68         public:
    69             /**
    70                 @brief Constructor: Sets the element, whereon the iterator points, to the given element.
    71             */
    72             inline IteratorBase(ObjectListElement<T>* element)
    73             {
    74                 this->element_ = element;
    75                 this->registerIterator();
    76             }
    77 
    7863            /**
    7964                @brief Constructor: Sets the element, whereon the iterator points, to the given element of another type.
    8065                The element's type O must be a derivative of the Iterator's type T.
    8166            */
    82             template <class O>
    83             inline IteratorBase(ObjectListElement<O>* element)
    84             {
    85                 (void)static_cast<T*>((O*)NULL); // Check type: The element's type O must be a derivative of the Iterator's type T.
    86                 this->element_ = element;
    87                 this->registerIterator();
    88             }
    89 
    90             /**
    91                 @brief Constructor: Sets this element to the element of another Iterator.
    92                 @param other The other Iterator
    93             */
    94             inline IteratorBase(const IteratorBase& other)
    95             {
    96                 this->element_ = other.element_;
     67            template <class OT, class OI>
     68            inline IteratorBase(const IteratorBase<OT, OI>& other)
     69            {
     70                this->element_ = other.getElement();
    9771                this->registerIterator();
    9872            }
     
    172146                @return True if the Iterator points to an existing object.
    173147            */
    174             inline operator bool() const
    175             {
    176                 return (this->element_ != NULL);
     148            inline explicit operator bool() const
     149            {
     150                return (this->element_ != nullptr);
    177151            }
    178152
     
    201175                @param object The object to compare with
    202176            */
    203             virtual void removedElement(ObjectListBaseElement* element)
     177            virtual void removedElement(ObjectListBaseElement* element) override
    204178            {
    205179                if (this->element_ == element)
    206180                    this->operator++();
     181            }
     182
     183            inline ObjectListBaseElement* getElement() const
     184            {
     185                return this->element_;
    207186            }
    208187
     
    226205                }
    227206                else
    228                     this->list_ = NULL;
     207                    this->list_ = nullptr;
    229208            }
    230209
  • code/branches/cpp11_v3/src/libraries/core/object/Listable.cc

    r10624 r11054  
    4444        @brief Constructor: Allocates space in the element list.
    4545    */
    46     Listable::Listable()
     46    Listable::Listable() : Listable(Context::getRootContext())
    4747    {
    48         this->context_ = Context::getRootContext();
    49         this->elements_.reserve(6);
    50 
    51         RegisterObject(Listable);
    5248    }
    5349
     
    7672    void Listable::unregisterObject()
    7773    {
    78         for (size_t i = 0; i < this->elements_.size(); ++i)
    79             Listable::deleteObjectListElement(this->elements_[i]);
     74        for (ObjectListBaseElement* element : this->elements_)
     75            Listable::deleteObjectListElement(element);
    8076        this->elements_.clear();
    8177    }
     
    9187        this->elements_.clear();
    9288
    93         for (size_t i = 0; i < copy.size(); ++i)
     89        for (ObjectListBaseElement* element : copy)
    9490        {
    95             copy[i]->changeContext(this->context_, context);
    96             Listable::deleteObjectListElement(copy[i]);
     91            element->changeContext(this->context_, context);
     92            Listable::deleteObjectListElement(element);
    9793        }
    9894
  • code/branches/cpp11_v3/src/libraries/core/object/Listable.h

    r9667 r11054  
    4040#include <vector>
    4141
     42#include "util/SmallObjectAllocator.h"
    4243#include "core/class/Identifiable.h"
    4344
  • code/branches/cpp11_v3/src/libraries/core/object/ObjectList.h

    r10624 r11054  
    4747#include "core/CorePrereqs.h"
    4848
    49 #include <boost/static_assert.hpp>
    50 #include <boost/type_traits/is_base_of.hpp>
    51 
    5249#include "ObjectListBase.h"
    5350#include "ObjectListIterator.h"
     
    6966    class ObjectList
    7067    {
    71         BOOST_STATIC_ASSERT((boost::is_base_of<Listable, T>::value));
     68        static_assert(std::is_base_of<Listable, T>::value, "ObjectList can only be used with Listables");
    7269
    7370        public:
    7471            typedef ObjectListIterator<T> iterator;
    7572
    76             /// Returns the size of the list (for the root context)
    77             inline static size_t size()
    78             {   return size(Context::getRootContext());   }
     73            ObjectList() : ObjectList(Context::getRootContext()) {}
     74            ObjectList(Context* context) : ObjectList(context->getObjectList<T>()) {}
     75            ObjectList(ObjectListBase* list) : list_(list) {}
     76
    7977            /// Returns the size of the list
    80             inline static size_t size(Context* context)
    81             {
    82                 return context->getObjectList<T>()->size();
    83             }
     78            inline size_t size()
     79            {   return this->list_->size();   }
    8480
    85             /// Returns an Iterator to the first element in the list (for the root context).
    86             inline static ObjectListElement<T>* begin()
    87             {   return begin(Context::getRootContext());   }
    8881            /// Returns an Iterator to the first element in the list.
    89             inline static ObjectListElement<T>* begin(Context* context)
    90             {
    91                 ObjectListBase* list = context->getObjectList<T>();
    92                 return static_cast<ObjectListElement<T>*>(list->begin());
    93             }
     82            inline ObjectListIterator<T> begin()
     83            {   return static_cast<ObjectListElement<T>*>(this->list_->begin());   }
     84            /// Returns an Iterator to the element after the last element in the list.
     85            inline ObjectListIterator<T> end()
     86            {   return static_cast<ObjectListElement<T>*>(this->list_->end());   }
    9487
    95             /// Returns an Iterator to the element after the last element in the list (for the root context).
    96             inline static ObjectListElement<T>* end()
    97             {   return end(Context::getRootContext());   }
    98             /// Returns an Iterator to the element after the last element in the list.
    99             inline static ObjectListElement<T>* end(Context* context)
    100             {
    101                 ObjectListBase* list = context->getObjectList<T>();
    102                 return static_cast<ObjectListElement<T>*>(list->end());
    103             }
     88            /// Returns an Iterator to the last element in the list.
     89            inline ObjectListIterator<T> rbegin()
     90            {   return static_cast<ObjectListElement<T>*>(this->list_->rbegin());   }
     91            /// Returns an Iterator to the element before the first element in the list.
     92            inline ObjectListIterator<T> rend()
     93            {   return static_cast<ObjectListElement<T>*>(this->list_->rend());   }
    10494
    105             /// Returns an Iterator to the last element in the list (for the root context).
    106             inline static ObjectListElement<T>* rbegin()
    107             {   return rbegin(Context::getRootContext());   }
    108             /// Returns an Iterator to the last element in the list.
    109             inline static ObjectListElement<T>* rbegin(Context* context)
    110             {
    111                 ObjectListBase* list = context->getObjectList<T>();
    112                 return static_cast<ObjectListElement<T>*>(list->rbegin());
    113             }
    114 
    115             /// Returns an Iterator to the element before the first element in the list (for the root context).
    116             inline static ObjectListElement<T>* rend()
    117             {   return rend(Context::getRootContext());   }
    118             /// Returns an Iterator to the element before the first element in the list.
    119             inline static ObjectListElement<T>* rend(Context* context)
    120             {
    121                 ObjectListBase* list = context->getObjectList<T>();
    122                 return static_cast<ObjectListElement<T>*>(list->rend());
    123             }
     95        private:
     96            ObjectListBase* list_;
    12497    };
    12598}
  • code/branches/cpp11_v3/src/libraries/core/object/ObjectListBase.cc

    r9975 r11054  
    5858    ObjectListBase::ObjectListBase()
    5959    {
    60         this->first_ = 0;
    61         this->last_ = 0;
     60        this->first_ = nullptr;
     61        this->last_ = nullptr;
    6262        this->size_ = 0;
    6363    }
     
    7373            ObjectListBaseElement* next = current->next_;
    7474
    75             current->list_ = 0;
    76             current->next_ = 0;
    77             current->prev_ = 0;
     75            current->list_ = nullptr;
     76            current->next_ = nullptr;
     77            current->prev_ = nullptr;
    7878
    7979            current = next;
     
    9292    void ObjectListBase::notifyRemovalListeners(ObjectListBaseElement* element) const
    9393    {
    94         for (std::vector<ObjectListElementRemovalListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    95             (*it)->removedElement(element);
     94        for (ObjectListElementRemovalListener* listener : this->listeners_)
     95            listener->removedElement(element);
    9696    }
    9797
     
    155155            this->first_ = element->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list
    156156
    157         element->list_ = 0;
    158         element->next_ = 0;
    159         element->prev_ = 0;
     157        element->list_ = nullptr;
     158        element->next_ = nullptr;
     159        element->prev_ = nullptr;
    160160        --this->size_;
    161161    }
  • code/branches/cpp11_v3/src/libraries/core/object/ObjectListBase.h

    r9667 r11054  
    5757                @param objectBase The object to store
    5858            */
    59             ObjectListBaseElement(Listable* object) : next_(0), prev_(0), objectBase_(object), list_(0) {}
     59            ObjectListBaseElement(Listable* object) : next_(nullptr), prev_(nullptr), objectBase_(object), list_(nullptr) {}
    6060            virtual ~ObjectListBaseElement() { this->removeFromList(); }
    6161
     
    8282            ObjectListElement(T* object) : ObjectListBaseElement(static_cast<Listable*>(object)), object_(object) {}
    8383
    84             virtual void changeContext(Context* oldContext, Context* newContext)
     84            virtual void changeContext(Context* oldContext, Context* newContext) override
    8585            {
    8686                // add object to new context, but only if this element belongs exactly to the old context (and not to a sub-context to avoid re-adding objects
     
    104104    {
    105105        public:
    106             virtual ~ObjectListElementRemovalListener() {}
     106            ObjectListElementRemovalListener() = default;
     107            virtual ~ObjectListElementRemovalListener() = default;
    107108            virtual void removedElement(ObjectListBaseElement* element) = 0;
    108109    };
     
    136137            inline ObjectListBaseElement* begin() const { return this->first_; }
    137138            /// Returns a pointer to the element after the last element in the list. Works only with Iterator.
    138             inline ObjectListBaseElement* end() const { return 0; }
     139            inline ObjectListBaseElement* end() const { return nullptr; }
    139140            /// Returns a pointer to the last element in the list. Works only with Iterator.
    140141            inline ObjectListBaseElement* rbegin() const { return this->last_; }
    141142            /// Returns a pointer to the element in front of the first element in the list. Works only with Iterator.
    142             inline ObjectListBaseElement* rend() const { return 0; }
     143            inline ObjectListBaseElement* rend() const { return nullptr; }
    143144
    144145            inline void registerRemovalListener(ObjectListElementRemovalListener* listener) { this->listeners_.push_back(listener); }
  • code/branches/cpp11_v3/src/libraries/core/object/ObjectListIterator.h

    r10624 r11054  
    4141    Usage:
    4242    @code
    43     for (ObjectListIterator<myClass> it = ObjectList<myClass>::begin(); it != ObjectList<myClass>::end(); ++it)
     43    ObjectList<myClass> list;
     44    for (ObjectListIterator<myClass> it = list.begin(); it != list.end(); ++it)
    4445    {
    4546        it->someFunction(...);
     
    6869    */
    6970    template <class T>
    70     class ObjectListIterator : public IteratorBase<T, ObjectListIterator<T> >
     71    class ObjectListIterator : public IteratorBase<T, ObjectListIterator<T>>
    7172    {
    7273        public:
     
    7475                @brief Constructor: Sets the element, whereon the ObjectListIterator points, to zero.
    7576            */
    76             inline ObjectListIterator() : IteratorBase<T, ObjectListIterator<T> >() {}
     77            inline ObjectListIterator() : IteratorBase<T, ObjectListIterator<T>>() {}
    7778
    7879            /**
     
    8081                @param element The element to start with
    8182            */
    82             inline ObjectListIterator(ObjectListElement<T>* element) : IteratorBase<T, ObjectListIterator<T> >(element) {}
     83            inline ObjectListIterator(ObjectListElement<T>* element) : IteratorBase<T, ObjectListIterator<T>>(element) {}
    8384
    8485            /**
     
    8687                @param other The other ObjectListIterator
    8788            */
    88             inline ObjectListIterator(const IteratorBase<T, ObjectListIterator<T> >& other) : IteratorBase<T, ObjectListIterator<T> >(other) {}
     89            template <class OI>
     90            inline ObjectListIterator(const IteratorBase<T, OI>& other) : IteratorBase<T, ObjectListIterator<T>>(other) {}
    8991
    9092            /**
  • code/branches/cpp11_v3/src/libraries/core/object/StrongPtr.h

    r10624 r11054  
    4343    orxonox::StrongPtr is an implementation of a smart pointer - it wraps a pointer to an
    4444    object  and keeps this object alive until no StrongPtr points to this object anymore.
    45     In contrast to orxonox::SharedPtr, StrongPtr works only with classes that are derived
     45    In contrast to std::shared_ptr, StrongPtr works only with classes that are derived
    4646    from orxonox::Destroyable, because it's an intrusive implementation, meaning the
    4747    reference counter is stored in the object itself.
     
    5151    at any time and also convert it back to a normal pointer if you like. This is possible
    5252    because the reference counter is stored in the object itself and not in StrongPtr (in
    53     contrast to SharedPtr).
     53    contrast to std::shared_ptr).
    5454
    5555    @b Important: If you want to delete an object, you must not use @c delete @c object but
     
    138138        public:
    139139            /// Constructor: Initializes the strong pointer with a null pointer.
    140             inline StrongPtr() : pointer_(0), base_(0)
     140            inline StrongPtr() : pointer_(nullptr), base_(nullptr)
    141141            {
    142142            }
     
    158158            /// Copy-constructor for strong pointers to objects of another class.
    159159            template <class O>
    160             inline StrongPtr(const StrongPtr<O>& other) : pointer_(other.get()), base_(other.base_)
     160            inline StrongPtr(const StrongPtr<O>& other) : pointer_(other.get()), base_(other.getBase())
    161161            {
    162162                if (this->base_)
     
    172172            }
    173173
     174            /// Move-constructor
     175            inline StrongPtr(StrongPtr&& other) : pointer_(other.pointer_), base_(other.base_)
     176            {
     177                other.pointer_ = nullptr;
     178                other.base_ = nullptr;
     179            }
     180
    174181            /// Destructor: Decrements the reference counter.
    175182            inline ~StrongPtr()
     
    187194
    188195            /// Assigns the wrapped pointer of another StrongPtr.
    189             inline StrongPtr& operator=(const StrongPtr& other)
    190             {
    191                 StrongPtr(other).swap(*this);
     196            inline StrongPtr& operator=(StrongPtr other)
     197            {
     198                other.swap(*this);
    192199                return *this;
    193200            }
     
    230237            inline T* operator->() const
    231238            {
    232                 assert(this->pointer_ != 0);
     239                assert(this->pointer_ != nullptr);
    233240                return this->pointer_;
    234241            }
     
    237244            inline T& operator*() const
    238245            {
    239                 assert(this->pointer_ != 0);
     246                assert(this->pointer_ != nullptr);
    240247                return *this->pointer_;
    241248            }
    242249
    243             /// Returns true if the wrapped pointer is NULL.
    244             inline bool operator!() const
    245             {
    246                 return (this->pointer_ == 0);
     250            /// Returns true if the pointer is not nullptr.
     251            inline explicit operator bool() const
     252            {
     253                return (this->pointer_ != nullptr);
    247254            }
    248255
     
    262269            }
    263270
    264             /// Resets the strong pointer (equivalent to assigning a NULL pointer).
     271            /// Resets the strong pointer (equivalent to assigning a nullptr).
    265272            inline void reset()
    266273            {
  • code/branches/cpp11_v3/src/libraries/core/object/WeakPtr.h

    r10624 r11054  
    3737
    3838    A WeakPtr wraps a pointer to an object. If the object gets deleted, the WeakPtr becomes
    39     NULL. This can be used to store pointers to objects without knowing when they will be
     39    nullptr. This can be used to store pointers to objects without knowing when they will be
    4040    destroyed.
    4141
     
    5050    WeakPtr<MyClass> pointer = object;                  // create a WeakPtr and assign the object
    5151
    52     if (pointer)                                        // checks if pointer is not NULL (which is true)
     52    if (pointer)                                        // checks if pointer is not nullptr (which is true)
    5353        pointer->someFunction();                        // calls MyClass::someFunction()
    5454
    5555    object->destroy();                                  // calls destroy() which deletes the object
    5656
    57     if (pointer)                                        // checks if pointer is not NULL (which is now false)
     57    if (pointer)                                        // checks if pointer is not nullptr (which is now false)
    5858        pointer->someFunction();                        // this will not be executed
    5959    @endcode
     
    9191{
    9292    /**
    93         @brief WeakPtr wraps a pointer to an object, which becomes NULL if the object is deleted.
     93        @brief WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted.
    9494
    9595        @see See @ref WeakPtrExample "this description" for more information and an example.
     
    100100        public:
    101101            /// Constructor: Initializes the weak pointer with a null pointer.
    102             inline WeakPtr() : pointer_(0), base_(0), callback_(0)
     102            inline WeakPtr() : pointer_(nullptr), base_(nullptr), callback_(nullptr)
    103103            {
    104104            }
    105105
    106106            /// Constructor: Initializes the weak pointer with a pointer to an object.
    107             inline WeakPtr(T* pointer) : pointer_(pointer), base_(pointer), callback_(0)
     107            inline WeakPtr(T* pointer) : pointer_(pointer), base_(pointer), callback_(nullptr)
    108108            {
    109109                this->registerAsDestructionListener(this->base_);
     
    111111
    112112            /// Copy-constructor
    113             inline WeakPtr(const WeakPtr& other) : pointer_(other.pointer_), base_(other.base_), callback_(0)
     113            inline WeakPtr(const WeakPtr& other) : pointer_(other.pointer_), base_(other.base_), callback_(nullptr)
    114114            {
    115115                this->registerAsDestructionListener(this->base_);
     
    118118            /// Copy-constructor for weak pointers to objects of another class.
    119119            template <class O>
    120             inline WeakPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.base_), callback_(0)
     120            inline WeakPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.getBase()), callback_(nullptr)
    121121            {
    122122                this->registerAsDestructionListener(this->base_);
     
    124124
    125125            /// Destructor
    126             inline virtual ~WeakPtr()
     126            virtual inline ~WeakPtr()
    127127            {
    128128                this->unregisterAsDestructionListener(this->base_);
     
    137137
    138138            /// Assigns the wrapped pointer of another WeakPtr.
    139             inline WeakPtr& operator=(const WeakPtr& other)
    140             {
    141                 WeakPtr(other).swap(*this);
     139            inline WeakPtr& operator=(WeakPtr other)
     140            {
     141                other.swap(*this);
    142142                return *this;
    143143            }
     
    172172            inline T* operator->() const
    173173            {
    174                 assert(this->pointer_ != 0);
     174                assert(this->pointer_ != nullptr);
    175175                return this->pointer_;
    176176            }
     
    179179            inline T& operator*() const
    180180            {
    181                 assert(this->pointer_ != 0);
     181                assert(this->pointer_ != nullptr);
    182182                return *this->pointer_;
    183183            }
    184184
    185             /// Returns true if the wrapped pointer is NULL.
    186             inline bool operator!() const
    187             {
    188                 return (this->pointer_ == 0);
     185            /// Returns true if the pointer is not nullptr.
     186            inline explicit operator bool() const
     187            {
     188                return (this->pointer_ != nullptr);
    189189            }
    190190
     
    210210            }
    211211
    212             /// Resets the weak pointer (equivalent to assigning a NULL pointer).
     212            /// Resets the weak pointer (equivalent to assigning a nullptr).
    213213            inline void reset()
    214214            {
     
    230230        private:
    231231            /// Will be called by Destroyable::~Destroyable() if the stored object is deleted. Resets the wrapped pointer and executes the callback.
    232             inline void objectDeleted()
    233             {
    234                 this->base_ = 0;
    235                 this->pointer_ = 0;
     232            virtual inline void objectDeleted() override
     233            {
     234                this->base_ = nullptr;
     235                this->pointer_ = nullptr;
    236236                if (this->callback_)
    237237                    (*this->callback_)();
  • code/branches/cpp11_v3/src/libraries/core/singleton/Scope.h

    r10514 r11054  
    7272        protected:
    7373            ScopeListener() : bActivated_(false) { }
    74             virtual ~ScopeListener() { }
     74            virtual ~ScopeListener() = default;
    7575
    7676            //! Gets called if the scope is activated
  • code/branches/cpp11_v3/src/libraries/core/singleton/ScopeManager.cc

    r10542 r11054  
    3838namespace orxonox
    3939{
    40     ScopeManager* ScopeManager::singletonPtr_s = 0;
     40    ScopeManager* ScopeManager::singletonPtr_s = nullptr;
    4141
    4242    void ScopeManager::addScope(ScopeID::Value scope)
     
    7373    void ScopeManager::activateListenersForScope(ScopeID::Value scope)
    7474    {
    75         for (std::set<ScopeListener*>::iterator it = this->listeners_[scope].begin(); it != this->listeners_[scope].end(); ++it)
    76             this->activateListener(*it);
     75        for (ScopeListener* listener : this->listeners_[scope])
     76            this->activateListener(listener);
    7777    }
    7878
    7979    void ScopeManager::deactivateListenersForScope(ScopeID::Value scope)
    8080    {
    81         for (std::set<ScopeListener*>::iterator it = this->listeners_[scope].begin(); it != this->listeners_[scope].end(); ++it)
    82             this->deactivateListener(*it);
     81        for (ScopeListener* listener : this->listeners_[scope])
     82            this->deactivateListener(listener);
    8383    }
    8484
  • code/branches/cpp11_v3/src/libraries/core/singleton/ScopeManager.h

    r11012 r11054  
    8383
    8484            std::set<ScopeID::Value> activeScopes_;
    85             std::map<ScopeID::Value, std::set<ScopeListener*> > listeners_; //!< Stores all listeners for a scope
     85            std::map<ScopeID::Value, std::set<ScopeListener*>> listeners_; //!< Stores all listeners for a scope
    8686
    8787            static ScopeManager* singletonPtr_s;
  • code/branches/cpp11_v3/src/libraries/core/singleton/ScopedSingletonIncludes.h

    r11052 r11054  
    7171*/
    7272#define ManageScopedSingleton(className, scope, allowedToFail) \
    73     className* className::singletonPtr_s = NULL; \
     73    className* className::singletonPtr_s = nullptr; \
    7474    static ScopedSingletonWrapper& className##ScopedSingletonWrapper \
    7575        = (new orxonox::SI_SSW(new ClassScopedSingletonWrapper<className, allowedToFail>(#className), scope))->getWrapper()
     
    8787            ~StaticallyInitializedScopedSingletonWrapper() { delete wrapper_; }
    8888
    89             virtual void load();
    90             virtual void unload();
     89            virtual void load() override;
     90            virtual void unload() override;
    9191
    9292            inline ScopedSingletonWrapper& getWrapper()
  • code/branches/cpp11_v3/src/libraries/core/singleton/ScopedSingletonWrapper.h

    r10528 r11054  
    6464                : className_(className)
    6565            { }
    66             virtual ~ScopedSingletonWrapper() { }
     66            virtual ~ScopedSingletonWrapper() = default;
    6767
    6868        protected:
     
    9191        ClassScopedSingletonWrapper(const std::string& className)
    9292            : ScopedSingletonWrapper(className)
    93             , singletonPtr_(NULL)
     93            , singletonPtr_(nullptr)
    9494        {
    9595        }
     
    102102
    103103        //! Called if the Scope of the Singleton gets active (creates the instance)
    104         void activated()
     104        virtual void activated() override
    105105        {
    106             assert(singletonPtr_ == NULL);
     106            assert(singletonPtr_ == nullptr);
    107107            singletonPtr_ = new T();
    108108        }
    109109
    110110        //! Called if the Scope of this Singleton gets deactivated (destroys the instance)
    111         void deactivated()
     111        virtual void deactivated() override
    112112        {
    113             assert(singletonPtr_ != NULL);
     113            assert(singletonPtr_ != nullptr);
    114114            this->destroy(singletonPtr_);
    115             singletonPtr_ = NULL;
     115            singletonPtr_ = nullptr;
    116116        }
    117117
     
    146146        ClassScopedSingletonWrapper(const std::string& className)
    147147            : ScopedSingletonWrapper(className)
    148             , singletonPtr_(NULL)
     148            , singletonPtr_(nullptr)
    149149        {
    150150        }
     
    157157
    158158        //! Called if the Scope of the Singleton gets active (creates the instance)
    159         void activated()
     159        virtual void activated() override
    160160        {
    161             assert(singletonPtr_ == NULL);
     161            assert(singletonPtr_ == nullptr);
    162162            try
    163163                { singletonPtr_ = new T(); }
     
    169169
    170170        //! Called if the Scope of this Singleton gets deactivated (destroys the instance)
    171         void deactivated()
     171        virtual void deactivated() override
    172172        {
    173             if (singletonPtr_ != NULL)
     173            if (singletonPtr_ != nullptr)
    174174            {
    175175                this->destroy(singletonPtr_);
    176                 singletonPtr_ = NULL;
     176                singletonPtr_ = nullptr;
    177177            }
    178178        }
Note: See TracChangeset for help on using the changeset viewer.