Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 19, 2010, 2:14:54 AM (14 years ago)
Author:
landauf
Message:

Moved ability to possess descriptions from Executor to ConsoleCommand, since no other executors use this feature. Also simplified this code a little by introducing a new shortcut in Language.h. XMLPort has to use a temporary solution for descriptions without Language support atm.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/ConsoleCommand.cc

    r7185 r7186  
    2929#include "ConsoleCommand.h"
    3030#include <cassert>
     31
     32#include "Language.h"
    3133
    3234namespace orxonox
     
    7173            this->argumentList_.clear();
    7274    }
     75
     76    ConsoleCommand& ConsoleCommand::description(const std::string& description)
     77    {
     78        this->description_ = std::string("ConsoleCommandDescription::" + this->name_ + "::function");
     79        AddLanguageEntry(this->description_, description);
     80        return (*this);
     81    }
     82
     83    const std::string& ConsoleCommand::getDescription() const
     84    {
     85        return GetLocalisation_noerror(this->description_);
     86    }
     87
     88    ConsoleCommand& ConsoleCommand::descriptionParam(unsigned int param, const std::string& description)
     89    {
     90        if (param < MAX_FUNCTOR_ARGUMENTS)
     91        {
     92            this->descriptionParam_[param] = std::string("ConsoleCommandDescription::" + this->name_ + "::param" + multi_cast<std::string>(param));
     93            AddLanguageEntry(this->descriptionParam_[param], description);
     94        }
     95        return (*this);
     96    }
     97
     98    const std::string& ConsoleCommand::getDescriptionParam(unsigned int param) const
     99    {
     100        if (param < MAX_FUNCTOR_ARGUMENTS)
     101            return GetLocalisation_noerror(this->descriptionParam_[param]);
     102
     103        return this->descriptionParam_[0];
     104    }
     105
     106    ConsoleCommand& ConsoleCommand::descriptionReturnvalue(const std::string& description)
     107    {
     108        this->descriptionReturnvalue_ = std::string("ConsoleCommandDescription::" + this->name_ + "::returnvalue");
     109        AddLanguageEntry(this->descriptionReturnvalue_, description);
     110        return (*this);
     111    }
     112
     113    const std::string& ConsoleCommand::getDescriptionReturnvalue(int param) const
     114    {
     115        return GetLocalisation_noerror(this->descriptionReturnvalue_);
     116    }
    73117}
    74118
Note: See TracChangeset for help on using the changeset viewer.