Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/command/ConsoleCommand.cc

    r10624 r11071  
    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
Note: See TracChangeset for help on using the changeset viewer.