Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 28, 2010, 1:51:04 AM (14 years ago)
Author:
landauf
Message:

replaced the temporary names of all ConsoleCommand related classes and functions by their real names

Location:
code/branches/consolecommands3/src/libraries
Files:
23 edited

Legend:

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

    r7219 r7236  
    431431    static const std::string __CC_getConfig_name = "getConfig";
    432432
    433     _SetConsoleCommand(__CC_load_name,            &ConfigFile::load);
    434     _SetConsoleCommand(__CC_setFilename_name,     &SettingsConfigFile::setFilename);
    435     _SetConsoleCommand(__CC_config_name,          &SettingsConfigFile::config).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
    436     _SetConsoleCommand(__CC_tconfig_name,         &SettingsConfigFile::tconfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
    437     _SetConsoleCommand(__CC_getConfig_name,       &SettingsConfigFile::getConfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries());
     433    SetConsoleCommand(__CC_load_name,            &ConfigFile::load);
     434    SetConsoleCommand(__CC_setFilename_name,     &SettingsConfigFile::setFilename);
     435    SetConsoleCommand(__CC_config_name,          &SettingsConfigFile::config).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
     436    SetConsoleCommand(__CC_tconfig_name,         &SettingsConfigFile::tconfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
     437    SetConsoleCommand(__CC_getConfig_name,       &SettingsConfigFile::getConfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries());
    438438
    439439    SettingsConfigFile* SettingsConfigFile::singletonPtr_s = 0;
     
    442442        : ConfigFile(filename)
    443443    {
    444         _ModifyConsoleCommand(__CC_load_name).setObject(this);
    445         _ModifyConsoleCommand(__CC_setFilename_name).setObject(this);
    446         _ModifyConsoleCommand(__CC_config_name).setObject(this);
    447         _ModifyConsoleCommand(__CC_tconfig_name).setObject(this);
    448         _ModifyConsoleCommand(__CC_getConfig_name).setObject(this);
     444        ModifyConsoleCommand(__CC_load_name).setObject(this);
     445        ModifyConsoleCommand(__CC_setFilename_name).setObject(this);
     446        ModifyConsoleCommand(__CC_config_name).setObject(this);
     447        ModifyConsoleCommand(__CC_tconfig_name).setObject(this);
     448        ModifyConsoleCommand(__CC_getConfig_name).setObject(this);
    449449    }
    450450
    451451    SettingsConfigFile::~SettingsConfigFile()
    452452    {
    453         _ModifyConsoleCommand(__CC_load_name).setObject(0);
    454         _ModifyConsoleCommand(__CC_setFilename_name).setObject(0);
    455         _ModifyConsoleCommand(__CC_config_name).setObject(0);
    456         _ModifyConsoleCommand(__CC_tconfig_name).setObject(0);
    457         _ModifyConsoleCommand(__CC_getConfig_name).setObject(0);
     453        ModifyConsoleCommand(__CC_load_name).setObject(0);
     454        ModifyConsoleCommand(__CC_setFilename_name).setObject(0);
     455        ModifyConsoleCommand(__CC_config_name).setObject(0);
     456        ModifyConsoleCommand(__CC_tconfig_name).setObject(0);
     457        ModifyConsoleCommand(__CC_getConfig_name).setObject(0);
    458458    }
    459459
  • code/branches/consolecommands3/src/libraries/core/Core.cc

    r7219 r7236  
    8888        : identifierDestroyer_(Identifier::destroyAllIdentifiers)
    8989        // Cleanup guard for external console commands that don't belong to an Identifier
    90         , consoleCommandDestroyer_(_ConsoleCommand::destroyAll)
     90        , consoleCommandDestroyer_(ConsoleCommand::destroyAll)
    9191        , bGraphicsLoaded_(false)
    9292        , bStartIOConsole_(true)
  • code/branches/consolecommands3/src/libraries/core/CorePrereqs.h

    r7219 r7236  
    194194    class ArgumentCompletionListElement;
    195195    class CommandEvaluation;
    196     class _ConsoleCommand;
     196    class ConsoleCommand;
    197197    class Executor;
    198198    template <class T>
  • code/branches/consolecommands3/src/libraries/core/GUIManager.cc

    r7219 r7236  
    7171    static void key_esc()
    7272        { GUIManager::getInstance().keyESC(); }
    73     _SetConsoleCommand("keyESC", &key_esc);
     73    SetConsoleCommand("keyESC", &key_esc);
    7474
    7575    class CEGUILogger : public CEGUI::DefaultLogger
     
    9999    GUIManager* GUIManager::singletonPtr_s = 0;
    100100
    101     _SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, true);
    102     _SetConsoleCommand("hideGUI", &GUIManager::hideGUI);
     101    SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, true);
     102    SetConsoleCommand("hideGUI", &GUIManager::hideGUI);
    103103
    104104    /**
  • code/branches/consolecommands3/src/libraries/core/Game.cc

    r7219 r7236  
    5757    static void stop_game()
    5858        { Game::getInstance().stop(); }
    59     _SetConsoleCommand("exit", &stop_game);
     59    SetConsoleCommand("exit", &stop_game);
    6060    static void printFPS()
    6161        { COUT(0) << Game::getInstance().getAvgFPS() << std::endl; }
    62     _SetConsoleCommand("printFPS", &printFPS);
     62    SetConsoleCommand("printFPS", &printFPS);
    6363    static void printTickTime()
    6464        { COUT(0) << Game::getInstance().getAvgTickTime() << std::endl; }
    65     _SetConsoleCommand("printTickTime", &printTickTime);
     65    SetConsoleCommand("printTickTime", &printTickTime);
    6666
    6767    std::map<std::string, GameStateInfo> Game::gameStateDeclarations_s;
  • code/branches/consolecommands3/src/libraries/core/GraphicsManager.cc

    r7219 r7236  
    6666{
    6767    static const std::string __CC_printScreen_name = "printScreen";
    68     _DeclareConsoleCommand(__CC_printScreen_name, &prototype::void__void);
     68    DeclareConsoleCommand(__CC_printScreen_name, &prototype::void__void);
    6969
    7070    class OgreWindowEventListener : public Ogre::WindowEventListener
     
    134134
    135135        Ogre::WindowEventUtilities::removeWindowEventListener(renderWindow_, ogreWindowEventListener_.get());
    136         _ModifyConsoleCommand(__CC_printScreen_name).resetFunction();
     136        ModifyConsoleCommand(__CC_printScreen_name).resetFunction();
    137137
    138138        // Undeclare the resources
     
    324324
    325325        // add console commands
    326         _ModifyConsoleCommand(__CC_printScreen_name).setFunction(&GraphicsManager::printScreen, this);
     326        ModifyConsoleCommand(__CC_printScreen_name).setFunction(&GraphicsManager::printScreen, this);
    327327    }
    328328
  • code/branches/consolecommands3/src/libraries/core/command/ArgumentCompletionFunctions.cc

    r7235 r7236  
    6060        namespace detail
    6161        {
    62             bool groupIsVisible(const std::map<std::string, _ConsoleCommand*>& group, bool bOnlyShowHidden)
    63             {
    64                 for (std::map<std::string, _ConsoleCommand*>::const_iterator it_command = group.begin(); it_command != group.end(); ++it_command)
     62            bool groupIsVisible(const std::map<std::string, ConsoleCommand*>& group, bool bOnlyShowHidden)
     63            {
     64                for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = group.begin(); it_command != group.end(); ++it_command)
    6565                    if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden)
    6666                        return true;
     
    7474                std::string fragmentLC = getLowercase(fragment);
    7575
    76                 const std::map<std::string, std::map<std::string, _ConsoleCommand*> >& commands = _ConsoleCommand::getCommands();
    77                 for (std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group)
     76                const std::map<std::string, std::map<std::string, ConsoleCommand*> >& commands = ConsoleCommand::getCommands();
     77                for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.begin(); it_group != commands.end(); ++it_group)
    7878                    if (groupIsVisible(it_group->second, bOnlyShowHidden) && it_group->first != "" && (fragmentLC == "" || getLowercase(it_group->first).find_first_of(fragmentLC) == 0))
    7979                        groupList.push_back(ArgumentCompletionListElement(it_group->first, getLowercase(it_group->first)));
    8080
    81                 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = commands.find("");
     81                std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = commands.find("");
    8282                if (it_group != commands.end())
    8383                {
     
    8585                        groupList.push_back(ArgumentCompletionListElement("", "", "\n"));
    8686
    87                     for (std::map<std::string, _ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
     87                    for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
    8888                        if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(it_command->first).find_first_of(fragmentLC) == 0))
    8989                            groupList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
     
    102102                std::string groupLC = getLowercase(group);
    103103
    104                 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommands().begin();
    105                 for ( ; it_group != _ConsoleCommand::getCommands().end(); ++it_group)
     104                std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommands().begin();
     105                for ( ; it_group != ConsoleCommand::getCommands().end(); ++it_group)
    106106                    if (getLowercase(it_group->first) == groupLC)
    107107                        break;
    108108
    109                 if (it_group != _ConsoleCommand::getCommands().end())
    110                 {
    111                     for (std::map<std::string, _ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
     109                if (it_group != ConsoleCommand::getCommands().end())
     110                {
     111                    for (std::map<std::string, ConsoleCommand*>::const_iterator it_command = it_group->second.begin(); it_command != it_group->second.end(); ++it_command)
    112112                        if (it_command->second->isActive() && it_command->second->hasAccess() && (!it_command->second->isHidden())^bOnlyShowHidden)
    113113                            commandList.push_back(ArgumentCompletionListElement(it_command->first, getLowercase(it_command->first)));
     
    152152                return detail::_groupsandcommands(fragment, true);
    153153
    154             if (_ConsoleCommand::getCommandLC(getLowercase(tokens[0])))
     154            if (ConsoleCommand::getCommandLC(getLowercase(tokens[0])))
    155155                return ARGUMENT_COMPLETION_FUNCTION_CALL(command)(fragment);
    156156
    157157            if (tokens.size() == 1)
    158158            {
    159                 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommands().find(tokens[0]);
    160                 if (it_group != _ConsoleCommand::getCommands().end())
     159                std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommands().find(tokens[0]);
     160                if (it_group != ConsoleCommand::getCommands().end())
    161161                    return detail::_subcommands(fragment, tokens[0], true);
    162162                else
     
    164164            }
    165165
    166             if (_ConsoleCommand::getCommandLC(getLowercase(tokens[0]), getLowercase(tokens[1])))
     166            if (ConsoleCommand::getCommandLC(getLowercase(tokens[0]), getLowercase(tokens[1])))
    167167                return ARGUMENT_COMPLETION_FUNCTION_CALL(command)(fragment);
    168168
  • code/branches/consolecommands3/src/libraries/core/command/CommandEvaluation.cc

    r7235 r7236  
    213213            {
    214214                std::string groupLC = getLowercase(this->getToken(0));
    215                 std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommands().begin();
    216                 for ( ; it_group != _ConsoleCommand::getCommands().end(); ++it_group)
     215                std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommands().begin();
     216                for ( ; it_group != ConsoleCommand::getCommands().end(); ++it_group)
    217217                    if (getLowercase(it_group->first) == groupLC)
    218218                        return std::string("Error: There is no command in group \"") + this->getToken(0) + "\" starting with \"" + this->getToken(1) + "\".";
     
    380380    }
    381381
    382     /* static */ std::string CommandEvaluation::dump(const _ConsoleCommand* command)
     382    /* static */ std::string CommandEvaluation::dump(const ConsoleCommand* command)
    383383    {
    384384        std::string output = command->getName();
  • code/branches/consolecommands3/src/libraries/core/command/CommandEvaluation.h

    r7235 r7236  
    5959                { return (this->execCommand_ != 0); }
    6060
    61             inline _ConsoleCommand* getConsoleCommand() const
     61            inline ConsoleCommand* getConsoleCommand() const
    6262                { return this->execCommand_; }
    6363
     
    8484
    8585            static std::string dump(const ArgumentCompletionList& list);
    86             static std::string dump(const _ConsoleCommand* command);
     86            static std::string dump(const ConsoleCommand* command);
    8787
    8888            static std::string getCommonBegin(const ArgumentCompletionList& list);
    8989
    90             _ConsoleCommand* execCommand_;
    91             _ConsoleCommand* hintCommand_;
     90            ConsoleCommand* execCommand_;
     91            ConsoleCommand* hintCommand_;
    9292            SubString tokens_;
    9393            std::string string_;
  • code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.cc

    r7234 r7236  
    3838    static const std::string __CC_autocomplete_name = "autocomplete";
    3939
    40     _SetConsoleCommand(__CC_CommandExecutor_name, __CC_autocomplete_name, &CommandExecutor::_autocomplete)
     40    SetConsoleCommand(__CC_CommandExecutor_name, __CC_autocomplete_name, &CommandExecutor::_autocomplete)
    4141        .hide()
    4242        .argumentCompleter(0, autocompletion::groupsandcommands())
    4343        .argumentCompleter(1, autocompletion::subcommands());
    4444
    45     _SetConsoleCommand("unhide", &CommandExecutor::unhide)
     45    SetConsoleCommand("unhide", &CommandExecutor::unhide)
    4646        .argumentCompleter(0, autocompletion::hiddencommand());
    4747
     
    8787        evaluation.initialize(command);
    8888
    89         evaluation.hintCommand_ = _ConsoleCommand::getCommand(__CC_CommandExecutor_name, __CC_autocomplete_name);
     89        evaluation.hintCommand_ = ConsoleCommand::getCommand(__CC_CommandExecutor_name, __CC_autocomplete_name);
    9090
    9191        if (evaluation.getNumberOfArguments() >= 1)
    9292        {
    93             evaluation.execCommand_ = _ConsoleCommand::getCommandLC(evaluation.getToken(0));
     93            evaluation.execCommand_ = ConsoleCommand::getCommandLC(evaluation.getToken(0));
    9494            if (evaluation.execCommand_)
    9595                evaluation.execArgumentsOffset_ = 1;
    9696            else if (evaluation.getNumberOfArguments() >= 2)
    9797            {
    98                 evaluation.execCommand_ = _ConsoleCommand::getCommandLC(evaluation.getToken(0), evaluation.getToken(1));
     98                evaluation.execCommand_ = ConsoleCommand::getCommandLC(evaluation.getToken(0), evaluation.getToken(1));
    9999                if (evaluation.execCommand_)
    100100                    evaluation.execArgumentsOffset_ = 2;
  • code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.cc

    r7228 r7236  
    3636namespace orxonox
    3737{
    38     _ConsoleCommand::_ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized)
     38    ConsoleCommand::ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized)
    3939    {
    4040        this->bActive_ = true;
     
    5757            this->executor_ = executor;
    5858
    59         _ConsoleCommand::registerCommand(group, name, this);
    60     }
    61 
    62     _ConsoleCommand::~_ConsoleCommand()
    63     {
    64         _ConsoleCommand::unregisterCommand(this);
    65     }
    66 
    67     _ConsoleCommand& _ConsoleCommand::addShortcut()
    68     {
    69         _ConsoleCommand::registerCommand("", this->baseName_, this);
    70         return *this;
    71     }
    72 
    73     _ConsoleCommand& _ConsoleCommand::addShortcut(const std::string&  name)
    74     {
    75         _ConsoleCommand::registerCommand("", name, this);
    76         return *this;
    77     }
    78 
    79     _ConsoleCommand& _ConsoleCommand::addGroup(const std::string& group)
    80     {
    81         _ConsoleCommand::registerCommand(group, this->baseName_, this);
    82         return *this;
    83     }
    84 
    85     _ConsoleCommand& _ConsoleCommand::addGroup(const std::string& group, const std::string&  name)
    86     {
    87         _ConsoleCommand::registerCommand(group, name, this);
    88         return *this;
    89     }
    90 
    91     bool _ConsoleCommand::isActive() const
     59        ConsoleCommand::registerCommand(group, name, this);
     60    }
     61
     62    ConsoleCommand::~ConsoleCommand()
     63    {
     64        ConsoleCommand::unregisterCommand(this);
     65    }
     66
     67    ConsoleCommand& ConsoleCommand::addShortcut()
     68    {
     69        ConsoleCommand::registerCommand("", this->baseName_, this);
     70        return *this;
     71    }
     72
     73    ConsoleCommand& ConsoleCommand::addShortcut(const std::string&  name)
     74    {
     75        ConsoleCommand::registerCommand("", name, this);
     76        return *this;
     77    }
     78
     79    ConsoleCommand& ConsoleCommand::addGroup(const std::string& group)
     80    {
     81        ConsoleCommand::registerCommand(group, this->baseName_, this);
     82        return *this;
     83    }
     84
     85    ConsoleCommand& ConsoleCommand::addGroup(const std::string& group, const std::string&  name)
     86    {
     87        ConsoleCommand::registerCommand(group, name, this);
     88        return *this;
     89    }
     90
     91    bool ConsoleCommand::isActive() const
    9292    {
    9393        return (this->bActive_ && this->executor_ && this->executor_->getFunctor() && (this->executor_->getFunctor()->getType() == Functor::Type::Static || this->executor_->getFunctor()->getRawObjectPointer()));
    9494    }
    9595
    96     bool _ConsoleCommand::hasAccess() const
     96    bool ConsoleCommand::hasAccess() const
    9797    {
    9898        switch (this->accessLevel_)
     
    110110    }
    111111
    112     bool _ConsoleCommand::headersMatch(const FunctorPtr& functor)
     112    bool ConsoleCommand::headersMatch(const FunctorPtr& functor)
    113113    {
    114114        unsigned int minparams = std::min(this->baseExecutor_->getParamCount(), functor->getParamCount());
     
    130130    }
    131131
    132     bool _ConsoleCommand::headersMatch(const ExecutorPtr& executor)
     132    bool ConsoleCommand::headersMatch(const ExecutorPtr& executor)
    133133    {
    134134        unsigned int minparams = std::min(this->baseExecutor_->getParamCount(), executor->getParamCount());
     
    148148    }
    149149
    150     bool _ConsoleCommand::setFunction(const ExecutorPtr& executor, bool bForce)
     150    bool ConsoleCommand::setFunction(const ExecutorPtr& executor, bool bForce)
    151151    {
    152152        if (!executor || !executor->getFunctor() || bForce || this->headersMatch(executor))
     
    162162    }
    163163
    164     bool _ConsoleCommand::setFunction(const FunctorPtr& functor, bool bForce)
     164    bool ConsoleCommand::setFunction(const FunctorPtr& functor, bool bForce)
    165165    {
    166166        if (!functor || bForce || this->headersMatch(functor))
     
    180180    }
    181181
    182     void _ConsoleCommand::pushFunction(const ExecutorPtr& executor, bool bForce)
     182    void ConsoleCommand::pushFunction(const ExecutorPtr& executor, bool bForce)
    183183    {
    184184        Command command;
     
    191191    }
    192192
    193     void _ConsoleCommand::pushFunction(const FunctorPtr& functor, bool bForce)
     193    void ConsoleCommand::pushFunction(const FunctorPtr& functor, bool bForce)
    194194    {
    195195        Command command;
     
    202202    }
    203203
    204     void _ConsoleCommand::pushFunction()
     204    void ConsoleCommand::pushFunction()
    205205    {
    206206        if (this->executor_)
     
    210210    }
    211211
    212     void _ConsoleCommand::popFunction()
     212    void ConsoleCommand::popFunction()
    213213    {
    214214        Command command;
     
    224224    }
    225225
    226     void _ConsoleCommand::resetFunction()
     226    void ConsoleCommand::resetFunction()
    227227    {
    228228        if (this->executor_)
     
    230230    }
    231231
    232     const ExecutorPtr& _ConsoleCommand::getExecutor() const
     232    const ExecutorPtr& ConsoleCommand::getExecutor() const
    233233    {
    234234        return this->executor_;
    235235    }
    236236
    237     bool _ConsoleCommand::setObject(void* object)
     237    bool ConsoleCommand::setObject(void* object)
    238238    {
    239239        if (this->executor_)
     
    253253    }
    254254
    255     void _ConsoleCommand::pushObject(void* object)
     255    void ConsoleCommand::pushObject(void* object)
    256256    {
    257257        void* oldobject = this->getObject();
     
    260260    }
    261261
    262     void _ConsoleCommand::popObject()
     262    void ConsoleCommand::popObject()
    263263    {
    264264        void* newobject = 0;
     
    271271    }
    272272
    273     void* _ConsoleCommand::getObject() const
     273    void* ConsoleCommand::getObject() const
    274274    {
    275275        if (this->executor_ && this->executor_->getFunctor())
     
    279279    }
    280280
    281     _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1)
     281    ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1)
    282282    {
    283283        if (this->executor_)
     
    289289    }
    290290
    291     _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2)
     291    ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2)
    292292    {
    293293        if (this->executor_)
     
    299299    }
    300300
    301     _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)
     301    ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)
    302302    {
    303303        if (this->executor_)
     
    309309    }
    310310
    311     _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)
     311    ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)
    312312    {
    313313        if (this->executor_)
     
    319319    }
    320320
    321     _ConsoleCommand& _ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)
     321    ConsoleCommand& ConsoleCommand::defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)
    322322    {
    323323        if (this->executor_)
     
    329329    }
    330330
    331     _ConsoleCommand& _ConsoleCommand::defaultValue(unsigned int index, const MultiType& param)
     331    ConsoleCommand& ConsoleCommand::defaultValue(unsigned int index, const MultiType& param)
    332332    {
    333333        if (this->executor_)
     
    339339    }
    340340
    341     _ConsoleCommand& _ConsoleCommand::argumentCompleter(unsigned int param, ArgumentCompleter* completer)
     341    ConsoleCommand& ConsoleCommand::argumentCompleter(unsigned int param, ArgumentCompleter* completer)
    342342    {
    343343        if (param < 5)
     
    349349    }
    350350
    351     ArgumentCompleter* _ConsoleCommand::getArgumentCompleter(unsigned int param) const
     351    ArgumentCompleter* ConsoleCommand::getArgumentCompleter(unsigned int param) const
    352352    {
    353353        if (param < 5)
     
    357357    }
    358358
    359     _ConsoleCommand& _ConsoleCommand::description(const std::string& description)
     359    ConsoleCommand& ConsoleCommand::description(const std::string& description)
    360360    {
    361361        this->description_ = std::string("ConsoleCommandDescription::" + this->baseName_ + "::function");
     
    364364    }
    365365
    366     const std::string& _ConsoleCommand::getDescription() const
     366    const std::string& ConsoleCommand::getDescription() const
    367367    {
    368368        return GetLocalisation_noerror(this->description_);
    369369    }
    370370
    371     _ConsoleCommand& _ConsoleCommand::descriptionParam(unsigned int param, const std::string& description)
     371    ConsoleCommand& ConsoleCommand::descriptionParam(unsigned int param, const std::string& description)
    372372    {
    373373        if (param < MAX_FUNCTOR_ARGUMENTS)
     
    379379    }
    380380
    381     const std::string& _ConsoleCommand::getDescriptionParam(unsigned int param) const
     381    const std::string& ConsoleCommand::getDescriptionParam(unsigned int param) const
    382382    {
    383383        if (param < MAX_FUNCTOR_ARGUMENTS)
     
    387387    }
    388388
    389     _ConsoleCommand& _ConsoleCommand::descriptionReturnvalue(const std::string& description)
     389    ConsoleCommand& ConsoleCommand::descriptionReturnvalue(const std::string& description)
    390390    {
    391391        this->descriptionReturnvalue_ = std::string("ConsoleCommandDescription::" + this->baseName_ + "::returnvalue");
     
    394394    }
    395395
    396     const std::string& _ConsoleCommand::getDescriptionReturnvalue(int param) const
     396    const std::string& ConsoleCommand::getDescriptionReturnvalue(int param) const
    397397    {
    398398        return GetLocalisation_noerror(this->descriptionReturnvalue_);
    399399    }
    400400
    401     /* static */ _ConsoleCommand* _ConsoleCommand::getCommand(const std::string& group, const std::string& name, bool bPrintError)
    402     {
    403         std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommandMap().find(group);
    404         if (it_group != _ConsoleCommand::getCommandMap().end())
    405         {
    406             std::map<std::string, _ConsoleCommand*>::const_iterator it_name = it_group->second.find(name);
     401    /* static */ ConsoleCommand* ConsoleCommand::getCommand(const std::string& group, const std::string& name, bool bPrintError)
     402    {
     403        std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommandMap().find(group);
     404        if (it_group != ConsoleCommand::getCommandMap().end())
     405        {
     406            std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.find(name);
    407407            if (it_name != it_group->second.end())
    408408            {
     
    420420    }
    421421
    422     /* static */ _ConsoleCommand* _ConsoleCommand::getCommandLC(const std::string& group, const std::string& name, bool bPrintError)
     422    /* static */ ConsoleCommand* ConsoleCommand::getCommandLC(const std::string& group, const std::string& name, bool bPrintError)
    423423    {
    424424        std::string groupLC = getLowercase(group);
    425425        std::string nameLC = getLowercase(name);
    426426
    427         std::map<std::string, std::map<std::string, _ConsoleCommand*> >::const_iterator it_group = _ConsoleCommand::getCommandMapLC().find(groupLC);
    428         if (it_group != _ConsoleCommand::getCommandMapLC().end())
    429         {
    430             std::map<std::string, _ConsoleCommand*>::const_iterator it_name = it_group->second.find(nameLC);
     427        std::map<std::string, std::map<std::string, ConsoleCommand*> >::const_iterator it_group = ConsoleCommand::getCommandMapLC().find(groupLC);
     428        if (it_group != ConsoleCommand::getCommandMapLC().end())
     429        {
     430            std::map<std::string, ConsoleCommand*>::const_iterator it_name = it_group->second.find(nameLC);
    431431            if (it_name != it_group->second.end())
    432432            {
     
    444444    }
    445445
    446     /* static */ std::map<std::string, std::map<std::string, _ConsoleCommand*> >& _ConsoleCommand::getCommandMap()
    447     {
    448         static std::map<std::string, std::map<std::string, _ConsoleCommand*> > commandMap;
     446    /* static */ std::map<std::string, std::map<std::string, ConsoleCommand*> >& ConsoleCommand::getCommandMap()
     447    {
     448        static std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMap;
    449449        return commandMap;
    450450    }
    451451
    452     /* static */ std::map<std::string, std::map<std::string, _ConsoleCommand*> >& _ConsoleCommand::getCommandMapLC()
    453     {
    454         static std::map<std::string, std::map<std::string, _ConsoleCommand*> > commandMapLC;
     452    /* static */ std::map<std::string, std::map<std::string, ConsoleCommand*> >& ConsoleCommand::getCommandMapLC()
     453    {
     454        static std::map<std::string, std::map<std::string, ConsoleCommand*> > commandMapLC;
    455455        return commandMapLC;
    456456    }
    457457
    458     /* static */ void _ConsoleCommand::registerCommand(const std::string& group, const std::string& name, _ConsoleCommand* command)
     458    /* static */ void ConsoleCommand::registerCommand(const std::string& group, const std::string& name, ConsoleCommand* command)
    459459    {
    460460        if (name == "")
    461461            return;
    462462
    463         if (_ConsoleCommand::getCommand(group, name) != 0)
     463        if (ConsoleCommand::getCommand(group, name) != 0)
    464464        {
    465465            if (group == "")
     
    470470        else
    471471        {
    472             _ConsoleCommand::getCommandMap()[group][name] = command;
    473             _ConsoleCommand::getCommandMapLC()[getLowercase(group)][getLowercase(name)] = command;
    474         }
    475     }
    476 
    477     /* static */ void _ConsoleCommand::unregisterCommand(_ConsoleCommand* command)
    478     {
    479         for (std::map<std::string, std::map<std::string, _ConsoleCommand*> >::iterator it_group = _ConsoleCommand::getCommandMap().begin(); it_group != _ConsoleCommand::getCommandMap().end(); )
    480         {
    481             for (std::map<std::string, _ConsoleCommand*>::iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); )
     472            ConsoleCommand::getCommandMap()[group][name] = command;
     473            ConsoleCommand::getCommandMapLC()[getLowercase(group)][getLowercase(name)] = command;
     474        }
     475    }
     476
     477    /* static */ void ConsoleCommand::unregisterCommand(ConsoleCommand* command)
     478    {
     479        for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::iterator it_group = ConsoleCommand::getCommandMap().begin(); it_group != ConsoleCommand::getCommandMap().end(); )
     480        {
     481            for (std::map<std::string, ConsoleCommand*>::iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); )
    482482            {
    483483                if (it_name->second == command)
     
    488488
    489489            if (it_group->second.empty())
    490                 _ConsoleCommand::getCommandMap().erase(it_group++);
     490                ConsoleCommand::getCommandMap().erase(it_group++);
    491491            else
    492492                ++it_group;
    493493        }
    494494
    495         for (std::map<std::string, std::map<std::string, _ConsoleCommand*> >::iterator it_group = _ConsoleCommand::getCommandMapLC().begin(); it_group != _ConsoleCommand::getCommandMapLC().end(); )
    496         {
    497             for (std::map<std::string, _ConsoleCommand*>::iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); )
     495        for (std::map<std::string, std::map<std::string, ConsoleCommand*> >::iterator it_group = ConsoleCommand::getCommandMapLC().begin(); it_group != ConsoleCommand::getCommandMapLC().end(); )
     496        {
     497            for (std::map<std::string, ConsoleCommand*>::iterator it_name = it_group->second.begin(); it_name != it_group->second.end(); )
    498498            {
    499499                if (it_name->second == command)
     
    504504
    505505            if (it_group->second.empty())
    506                 _ConsoleCommand::getCommandMapLC().erase(it_group++);
     506                ConsoleCommand::getCommandMapLC().erase(it_group++);
    507507            else
    508508                ++it_group;
     
    510510    }
    511511
    512     /* static */ void _ConsoleCommand::destroyAll()
    513     {
    514         while (!_ConsoleCommand::getCommandMap().empty() && !_ConsoleCommand::getCommandMap().begin()->second.empty())
    515             delete _ConsoleCommand::getCommandMap().begin()->second.begin()->second;
     512    /* static */ void ConsoleCommand::destroyAll()
     513    {
     514        while (!ConsoleCommand::getCommandMap().empty() && !ConsoleCommand::getCommandMap().begin()->second.empty())
     515            delete ConsoleCommand::getCommandMap().begin()->second.begin()->second;
    516516    }
    517517}
  • code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.h

    r7228 r7236  
    4141
    4242
    43 #define _SetConsoleCommand(...) \
    44     BOOST_PP_EXPAND(BOOST_PP_CAT(_SetConsoleCommand, ORXONOX_VA_NARGS(__VA_ARGS__))(__VA_ARGS__))
    45 #define _SetConsoleCommand2(name, functionpointer) \
    46     _SetConsoleCommandGeneric("", name, orxonox::createFunctor(functionpointer))
    47 #define _SetConsoleCommand3(group, name, functionpointer) \
    48     _SetConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer))
    49 #define _SetConsoleCommand4(group, name, functionpointer, object) \
    50     _SetConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer, object))
    51 
    52 #define _SetConsoleCommandGeneric(group, name, functor) \
    53     static orxonox::_ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __LINE__) = (*orxonox::_createConsoleCommand(group, name, orxonox::createExecutor(functor)))
    54 
    55 
    56 #define _DeclareConsoleCommand(...) \
    57     BOOST_PP_CAT(_DeclareConsoleCommand, ORXONOX_VA_NARGS(__VA_ARGS__))(__VA_ARGS__)
    58 #define _DeclareConsoleCommand2(name, functionpointer) \
    59     _DeclareConsoleCommandGeneric("", name, orxonox::createFunctor(functionpointer))
    60 #define _DeclareConsoleCommand3(group, name, functionpointer) \
    61     _DeclareConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer))
    62 #define _DeclareConsoleCommand4(group, name, functionpointer, object) \
    63     _DeclareConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer, object))
    64 
    65 #define _DeclareConsoleCommandGeneric(group, name, functor) \
    66     static orxonox::_ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __LINE__) = (*orxonox::_createConsoleCommand(group, name, orxonox::createExecutor(functor), false))
     43#define SetConsoleCommand(...) \
     44    BOOST_PP_EXPAND(BOOST_PP_CAT(SetConsoleCommand, ORXONOX_VA_NARGS(__VA_ARGS__))(__VA_ARGS__))
     45#define SetConsoleCommand2(name, functionpointer) \
     46    SetConsoleCommandGeneric("", name, orxonox::createFunctor(functionpointer))
     47#define SetConsoleCommand3(group, name, functionpointer) \
     48    SetConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer))
     49#define SetConsoleCommand4(group, name, functionpointer, object) \
     50    SetConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer, object))
     51
     52#define SetConsoleCommandGeneric(group, name, functor) \
     53    static orxonox::ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __LINE__) = (*orxonox::createConsoleCommand(group, name, orxonox::createExecutor(functor)))
     54
     55
     56#define DeclareConsoleCommand(...) \
     57    BOOST_PP_CAT(DeclareConsoleCommand, ORXONOX_VA_NARGS(__VA_ARGS__))(__VA_ARGS__)
     58#define DeclareConsoleCommand2(name, functionpointer) \
     59    DeclareConsoleCommandGeneric("", name, orxonox::createFunctor(functionpointer))
     60#define DeclareConsoleCommand3(group, name, functionpointer) \
     61    DeclareConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer))
     62#define DeclareConsoleCommand4(group, name, functionpointer, object) \
     63    DeclareConsoleCommandGeneric(group, name, orxonox::createFunctor(functionpointer, object))
     64
     65#define DeclareConsoleCommandGeneric(group, name, functor) \
     66    static orxonox::ConsoleCommand& BOOST_PP_CAT(__consolecommand_, __LINE__) = (*orxonox::createConsoleCommand(group, name, orxonox::createExecutor(functor), false))
    6767
    6868
     
    9090    }
    9191
    92     class _CoreExport _ConsoleCommand
     92    class _CoreExport ConsoleCommand
    9393    {
    94         friend struct _ConsoleCommandManipulator;
     94        friend struct ConsoleCommandManipulator;
    9595
    9696        struct Command
     
    101101
    102102        public:
    103             struct _ConsoleCommandManipulator
     103            struct ConsoleCommandManipulator
    104104            {
    105105                public:
    106                     _ConsoleCommandManipulator(const _ConsoleCommand* command) : command_(const_cast<_ConsoleCommand*>(command)) {}
     106                    ConsoleCommandManipulator(const ConsoleCommand* command) : command_(const_cast<ConsoleCommand*>(command)) {}
    107107
    108108                    template <class F>
    109                     inline _ConsoleCommandManipulator& setFunction(F function, bool bForce = false)
     109                    inline ConsoleCommandManipulator& setFunction(F function, bool bForce = false)
    110110                        {
    111111                            if (this->command_)
     
    122122                        }
    123123                    template <class F, class O>
    124                     inline _ConsoleCommandManipulator& setFunction(F function, O* object, bool bForce = false)
     124                    inline ConsoleCommandManipulator& setFunction(F function, O* object, bool bForce = false)
    125125                        {
    126126                            if (this->command_)
     
    137137                            return *this;
    138138                        }
    139                     inline _ConsoleCommandManipulator& setFunction(const FunctorPtr& functor, bool bForce = false)
     139                    inline ConsoleCommandManipulator& setFunction(const FunctorPtr& functor, bool bForce = false)
    140140                        { if (this->command_) { this->command_->setFunction(functor, bForce); } return *this; }
    141                     inline _ConsoleCommandManipulator& setFunction(const ExecutorPtr& executor, bool bForce = false)
     141                    inline ConsoleCommandManipulator& setFunction(const ExecutorPtr& executor, bool bForce = false)
    142142                        { if (this->command_) { this->command_->setFunction(executor, bForce); } return *this; }
    143143
    144144                    template <class F>
    145                     inline _ConsoleCommandManipulator& pushFunction(F function, bool bForce = false)
     145                    inline ConsoleCommandManipulator& pushFunction(F function, bool bForce = false)
    146146                        { if (this->command_) { this->command_->pushFunction(createFunctor(function), bForce); } return *this; }
    147147                    template <class F, class O>
    148                     inline _ConsoleCommandManipulator& pushFunction(F function, O* object, bool bForce = false)
     148                    inline ConsoleCommandManipulator& pushFunction(F function, O* object, bool bForce = false)
    149149                        { if (this->command_) { this->command_->pushFunction(createFunctor(function, object), bForce); } return *this; }
    150                     inline _ConsoleCommandManipulator& pushFunction(const FunctorPtr& functor, bool bForce = false)
     150                    inline ConsoleCommandManipulator& pushFunction(const FunctorPtr& functor, bool bForce = false)
    151151                        { if (this->command_) { this->command_->pushFunction(functor, bForce); } return *this; }
    152                     inline _ConsoleCommandManipulator& pushFunction(const ExecutorPtr& executor, bool bForce = false)
     152                    inline ConsoleCommandManipulator& pushFunction(const ExecutorPtr& executor, bool bForce = false)
    153153                        { if (this->command_) { this->command_->pushFunction(executor, bForce); } return *this; }
    154154
    155                     inline _ConsoleCommandManipulator& popFunction()
     155                    inline ConsoleCommandManipulator& popFunction()
    156156                        { if (this->command_) { this->command_->popFunction(); } return *this; }
    157157
    158                     inline _ConsoleCommandManipulator& resetFunction()
     158                    inline ConsoleCommandManipulator& resetFunction()
    159159                        { if (this->command_) { this->command_->resetFunction(); } return *this; }
    160160
    161                     inline _ConsoleCommandManipulator& setObject(void* object)
     161                    inline ConsoleCommandManipulator& setObject(void* object)
    162162                        { if (this->command_) { this->command_->setObject(object); } return *this; }
    163                     inline _ConsoleCommandManipulator& pushObject(void* object)
     163                    inline ConsoleCommandManipulator& pushObject(void* object)
    164164                        { if (this->command_) { this->command_->pushObject(object); } return *this; }
    165                     inline _ConsoleCommandManipulator& popObject()
     165                    inline ConsoleCommandManipulator& popObject()
    166166                        { if (this->command_) { this->command_->popObject(); } return *this; }
    167167
    168                     inline _ConsoleCommandManipulator& setActive(bool bActive)
     168                    inline ConsoleCommandManipulator& setActive(bool bActive)
    169169                        { if (this->command_) { this->command_->setActive(bActive); } return *this; }
    170                     inline _ConsoleCommandManipulator& activate()
     170                    inline ConsoleCommandManipulator& activate()
    171171                        { return this->setActive(true); }
    172                     inline _ConsoleCommandManipulator& deactivate()
     172                    inline ConsoleCommandManipulator& deactivate()
    173173                        { return this->setActive(false); }
    174174
    175                     inline _ConsoleCommandManipulator& setHidden(bool bHidden)
     175                    inline ConsoleCommandManipulator& setHidden(bool bHidden)
    176176                        { if (this->command_) { this->command_->setHidden(bHidden); } return *this; }
    177                     inline _ConsoleCommandManipulator& hide()
     177                    inline ConsoleCommandManipulator& hide()
    178178                        { return this->setHidden(true); }
    179                     inline _ConsoleCommandManipulator& show()
     179                    inline ConsoleCommandManipulator& show()
    180180                        { return this->setHidden(false); }
    181181
    182                     inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1)
     182                    inline ConsoleCommandManipulator& defaultValues(const MultiType& param1)
    183183                        { if (this->command_) { this->command_->defaultValues(param1); } return *this; }
    184                     inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2)
     184                    inline ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2)
    185185                        { if (this->command_) { this->command_->defaultValues(param1, param2); } return *this; }
    186                     inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)
     186                    inline ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3)
    187187                        { if (this->command_) { this->command_->defaultValues(param1, param2, param3); } return *this; }
    188                     inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)
     188                    inline ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4)
    189189                        { if (this->command_) { this->command_->defaultValues(param1, param2, param3, param4); } return *this; }
    190                     inline _ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)
     190                    inline ConsoleCommandManipulator& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5)
    191191                        { if (this->command_) { this->command_->defaultValues(param1, param2, param3, param4, param5); } return *this; }
    192                     inline _ConsoleCommandManipulator& defaultValue(unsigned int index, const MultiType& param)
     192                    inline ConsoleCommandManipulator& defaultValue(unsigned int index, const MultiType& param)
    193193                        { if (this->command_) { this->command_->defaultValue(index, param); } return *this; }
    194194
    195                     inline _ConsoleCommandManipulator& accessLevel(AccessLevel::Enum level)
     195                    inline ConsoleCommandManipulator& accessLevel(AccessLevel::Enum level)
    196196                        { if (this->command_) { this->command_->accessLevel(level); } return *this; }
    197197
    198                     inline _ConsoleCommandManipulator& argumentCompleter(unsigned int param, ArgumentCompleter* completer)
     198                    inline ConsoleCommandManipulator& argumentCompleter(unsigned int param, ArgumentCompleter* completer)
    199199                        { if (this->command_) { this->command_->argumentCompleter(param, completer); } return *this; }
    200200
    201                     inline _ConsoleCommandManipulator& setAsInputCommand()
     201                    inline ConsoleCommandManipulator& setAsInputCommand()
    202202                        { if (this->command_) { this->command_->setAsInputCommand(); } return *this; }
    203                     inline _ConsoleCommandManipulator& keybindMode(KeybindMode::Value mode)
     203                    inline ConsoleCommandManipulator& keybindMode(KeybindMode::Value mode)
    204204                        { if (this->command_) { this->command_->keybindMode(mode); } return *this; }
    205                     inline _ConsoleCommandManipulator& inputConfiguredParam(int index)
     205                    inline ConsoleCommandManipulator& inputConfiguredParam(int index)
    206206                        { if (this->command_) { this->command_->inputConfiguredParam(index); } return *this; }
    207207
    208208                private:
    209                     _ConsoleCommand* command_;
     209                    ConsoleCommand* command_;
    210210            };
    211211
    212212        public:
    213             _ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true);
    214             ~_ConsoleCommand();
    215 
    216             _ConsoleCommand& addShortcut();
    217             _ConsoleCommand& addShortcut(const std::string&  name);
    218             _ConsoleCommand& addGroup(const std::string& group);
    219             _ConsoleCommand& addGroup(const std::string& group, const std::string&  name);
     213            ConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true);
     214            ~ConsoleCommand();
     215
     216            ConsoleCommand& addShortcut();
     217            ConsoleCommand& addShortcut(const std::string&  name);
     218            ConsoleCommand& addGroup(const std::string& group);
     219            ConsoleCommand& addGroup(const std::string& group, const std::string&  name);
    220220
    221221            inline const std::string& getName() const
     
    226226                { return this->baseExecutor_; }
    227227
    228             inline _ConsoleCommand& setActive(bool bActive)
     228            inline ConsoleCommand& setActive(bool bActive)
    229229                { this->bActive_ = bActive; return *this; }
    230             inline _ConsoleCommand& activate()
     230            inline ConsoleCommand& activate()
    231231                { return this->setActive(true); }
    232             inline _ConsoleCommand& deactivate()
     232            inline ConsoleCommand& deactivate()
    233233                { return this->setActive(false); }
    234234
    235             inline _ConsoleCommand& setHidden(bool bHidden)
     235            inline ConsoleCommand& setHidden(bool bHidden)
    236236                { this->bHidden_ = bHidden; return *this; }
    237             inline _ConsoleCommand& hide()
     237            inline ConsoleCommand& hide()
    238238                { return this->setHidden(true); }
    239             inline _ConsoleCommand& show()
     239            inline ConsoleCommand& show()
    240240                { return this->setHidden(false); }
    241241
     
    245245                { return this->bHidden_; }
    246246
    247             _ConsoleCommand& description(const std::string& description);
     247            ConsoleCommand& description(const std::string& description);
    248248            const std::string& getDescription() const;
    249249
    250             _ConsoleCommand& descriptionParam(unsigned int param, const std::string& description);
     250            ConsoleCommand& descriptionParam(unsigned int param, const std::string& description);
    251251            const std::string& getDescriptionParam(unsigned int param) const;
    252252
    253             _ConsoleCommand& descriptionReturnvalue(const std::string& description);
     253            ConsoleCommand& descriptionReturnvalue(const std::string& description);
    254254            const std::string& getDescriptionReturnvalue(int param) const;
    255255
    256             _ConsoleCommand& defaultValues(const MultiType& param1);
    257             _ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2);
    258             _ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3);
    259             _ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4);
    260             _ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5);
    261             _ConsoleCommand& defaultValue(unsigned int index, const MultiType& param);
    262 
    263             inline _ConsoleCommand& accessLevel(AccessLevel::Enum level)
     256            ConsoleCommand& defaultValues(const MultiType& param1);
     257            ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2);
     258            ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3);
     259            ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4);
     260            ConsoleCommand& defaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5);
     261            ConsoleCommand& defaultValue(unsigned int index, const MultiType& param);
     262
     263            inline ConsoleCommand& accessLevel(AccessLevel::Enum level)
    264264                { this->accessLevel_ = level; return *this; }
    265265            inline AccessLevel::Enum getAccessLevel() const
    266266                { return this->accessLevel_; }
    267267
    268             _ConsoleCommand& argumentCompleter(unsigned int param, ArgumentCompleter* completer);
     268            ConsoleCommand& argumentCompleter(unsigned int param, ArgumentCompleter* completer);
    269269            ArgumentCompleter* getArgumentCompleter(unsigned int param) const;
    270270
    271             inline _ConsoleCommand& setAsInputCommand()
     271            inline ConsoleCommand& setAsInputCommand()
    272272            {
    273273                this->keybindMode(KeybindMode::OnHold);
     
    277277            }
    278278
    279             inline _ConsoleCommand& keybindMode(KeybindMode::Value mode)
     279            inline ConsoleCommand& keybindMode(KeybindMode::Value mode)
    280280                { this->keybindMode_ = mode; return *this; }
    281281            inline KeybindMode::Value getKeybindMode() const
    282282                { return this->keybindMode_; }
    283283
    284             inline _ConsoleCommand& inputConfiguredParam(int index)
     284            inline ConsoleCommand& inputConfiguredParam(int index)
    285285                { this->inputConfiguredParam_ = index; return *this; }
    286286            inline int getInputConfiguredParam_() const
    287287                { return this->inputConfiguredParam_; }
    288288
    289             inline _ConsoleCommandManipulator getManipulator() const
     289            inline ConsoleCommandManipulator getManipulator() const
    290290                { return this; }
    291291
     
    327327
    328328        public:
    329             static inline const std::map<std::string, std::map<std::string, _ConsoleCommand*> >& getCommands()
    330                 { return _ConsoleCommand::getCommandMap(); }
    331             static inline const std::map<std::string, std::map<std::string, _ConsoleCommand*> >& getCommandsLC()
    332                 { return _ConsoleCommand::getCommandMapLC(); }
    333 
    334             static inline _ConsoleCommand* getCommand(const std::string& name, bool bPrintError = false)
    335                 { return _ConsoleCommand::getCommand("", name, bPrintError); }
    336             static inline _ConsoleCommand* getCommandLC(const std::string& name, bool bPrintError = false)
    337                 { return _ConsoleCommand::getCommandLC("", name, bPrintError); }
    338 
    339             static _ConsoleCommand* getCommand(const std::string& group, const std::string& name, bool bPrintError = false);
    340             static _ConsoleCommand* getCommandLC(const std::string& group, const std::string& name, bool bPrintError = false);
     329            static inline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommands()
     330                { return ConsoleCommand::getCommandMap(); }
     331            static inline const std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandsLC()
     332                { return ConsoleCommand::getCommandMapLC(); }
     333
     334            static inline ConsoleCommand* getCommand(const std::string& name, bool bPrintError = false)
     335                { return ConsoleCommand::getCommand("", name, bPrintError); }
     336            static inline ConsoleCommand* getCommandLC(const std::string& name, bool bPrintError = false)
     337                { return ConsoleCommand::getCommandLC("", name, bPrintError); }
     338
     339            static ConsoleCommand* getCommand(const std::string& group, const std::string& name, bool bPrintError = false);
     340            static ConsoleCommand* getCommandLC(const std::string& group, const std::string& name, bool bPrintError = false);
    341341
    342342            static void destroyAll();
    343343
    344344        private:
    345             static std::map<std::string, std::map<std::string, _ConsoleCommand*> >& getCommandMap();
    346             static std::map<std::string, std::map<std::string, _ConsoleCommand*> >& getCommandMapLC();
    347 
    348             static void registerCommand(const std::string& group, const std::string& name, _ConsoleCommand* command);
    349             static void unregisterCommand(_ConsoleCommand* command);
     345            static std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandMap();
     346            static std::map<std::string, std::map<std::string, ConsoleCommand*> >& getCommandMapLC();
     347
     348            static void registerCommand(const std::string& group, const std::string& name, ConsoleCommand* command);
     349            static void unregisterCommand(ConsoleCommand* command);
    350350    };
    351351
    352     inline _ConsoleCommand* _createConsoleCommand(const std::string& name, const ExecutorPtr& executor, bool bInitialized = true)
    353         { return new _ConsoleCommand("", name, executor, bInitialized); }
    354     inline _ConsoleCommand* _createConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true)
    355         { return new _ConsoleCommand(group, name, executor, bInitialized); }
    356 
    357     inline _ConsoleCommand::_ConsoleCommandManipulator _ModifyConsoleCommand(const std::string& name)
    358         { return _ConsoleCommand::getCommand(name, true); }
    359     inline _ConsoleCommand::_ConsoleCommandManipulator _ModifyConsoleCommand(const std::string& group, const std::string& name)
    360         { return _ConsoleCommand::getCommand(group, name, true); }
     352    inline ConsoleCommand* createConsoleCommand(const std::string& name, const ExecutorPtr& executor, bool bInitialized = true)
     353        { return new ConsoleCommand("", name, executor, bInitialized); }
     354    inline ConsoleCommand* createConsoleCommand(const std::string& group, const std::string& name, const ExecutorPtr& executor, bool bInitialized = true)
     355        { return new ConsoleCommand(group, name, executor, bInitialized); }
     356
     357    inline ConsoleCommand::ConsoleCommandManipulator ModifyConsoleCommand(const std::string& name)
     358        { return ConsoleCommand::getCommand(name, true); }
     359    inline ConsoleCommand::ConsoleCommandManipulator ModifyConsoleCommand(const std::string& group, const std::string& name)
     360        { return ConsoleCommand::getCommand(group, name, true); }
    361361}
    362362
  • code/branches/consolecommands3/src/libraries/core/command/ConsoleCommandCompilation.cc

    r7219 r7236  
    4141namespace orxonox
    4242{
    43     _SetConsoleCommand("source", source).argumentCompleter(0, autocompletion::files());
    44     _SetConsoleCommand("echo", echo);
    45     _SetConsoleCommand("puts", puts);
     43    SetConsoleCommand("source", source).argumentCompleter(0, autocompletion::files());
     44    SetConsoleCommand("echo", echo);
     45    SetConsoleCommand("puts", puts);
    4646
    47     _SetConsoleCommand("read", read).argumentCompleter(0, autocompletion::files());
    48     _SetConsoleCommand("append", append).argumentCompleter(0, autocompletion::files());
    49     _SetConsoleCommand("write", write).argumentCompleter(0, autocompletion::files());
     47    SetConsoleCommand("read", read).argumentCompleter(0, autocompletion::files());
     48    SetConsoleCommand("append", append).argumentCompleter(0, autocompletion::files());
     49    SetConsoleCommand("write", write).argumentCompleter(0, autocompletion::files());
    5050
    51     _SetConsoleCommand("calculate", calculate);
     51    SetConsoleCommand("calculate", calculate);
    5252
    5353    void source(const std::string& filename)
  • code/branches/consolecommands3/src/libraries/core/command/IRC.cc

    r7219 r7236  
    4242    static const unsigned int IRC_TCL_THREADID  = 1421421421;
    4343
    44     _SetConsoleCommand("IRC", "say",  &IRC::say);
    45     _SetConsoleCommand("IRC", "msg",  &IRC::msg);
    46     _SetConsoleCommand("IRC", "nick", &IRC::nick);
     44    SetConsoleCommand("IRC", "say",  &IRC::say);
     45    SetConsoleCommand("IRC", "msg",  &IRC::msg);
     46    SetConsoleCommand("IRC", "nick", &IRC::nick);
    4747
    4848    IRC::IRC()
  • code/branches/consolecommands3/src/libraries/core/command/Shell.cc

    r7229 r7236  
    4040namespace orxonox
    4141{
    42     _SetConsoleCommand("log",     OutputHandler::log    );
    43     _SetConsoleCommand("error",   OutputHandler::error  );
    44     _SetConsoleCommand("warning", OutputHandler::warning);
    45     _SetConsoleCommand("info",    OutputHandler::info   );
    46     _SetConsoleCommand("debug",   OutputHandler::debug  );
     42    SetConsoleCommand("log",     OutputHandler::log    );
     43    SetConsoleCommand("error",   OutputHandler::error  );
     44    SetConsoleCommand("warning", OutputHandler::warning);
     45    SetConsoleCommand("info",    OutputHandler::info   );
     46    SetConsoleCommand("debug",   OutputHandler::debug  );
    4747
    4848    unsigned int Shell::cacheSize_s;
  • code/branches/consolecommands3/src/libraries/core/command/TclBind.cc

    r7228 r7236  
    4444namespace orxonox
    4545{
    46     _SetConsoleCommand("tcl", &TclBind::tcl);
    47     _SetConsoleCommand("bgerror", &TclBind::bgerror);
     46    SetConsoleCommand("tcl", &TclBind::tcl);
     47    SetConsoleCommand("bgerror", &TclBind::bgerror);
    4848
    4949    TclBind* TclBind::singletonPtr_s = 0;
  • code/branches/consolecommands3/src/libraries/core/command/TclThreadManager.cc

    r7228 r7236  
    5050    const float TCLTHREADMANAGER_MAX_CPU_USAGE = 0.50f;
    5151
    52     _SetConsoleCommand("tclexecute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads());
    53     _SetConsoleCommand("tclquery",   &TclThreadManager::query  ).argumentCompleter(0, autocompletion::tclthreads());
    54     _SetConsoleCommand("TclThreadManager", "create",  &TclThreadManager::create);
    55     _SetConsoleCommand("TclThreadManager", "destroy", &TclThreadManager::destroy).argumentCompleter(0, autocompletion::tclthreads());
    56     _SetConsoleCommand("TclThreadManager", "execute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads());
    57     _SetConsoleCommand("TclThreadManager", "query",   &TclThreadManager::query  ).argumentCompleter(0, autocompletion::tclthreads());
    58     _SetConsoleCommand("TclThreadManager", "source",  &TclThreadManager::source ).argumentCompleter(0, autocompletion::tclthreads());
     52    SetConsoleCommand("tclexecute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads());
     53    SetConsoleCommand("tclquery",   &TclThreadManager::query  ).argumentCompleter(0, autocompletion::tclthreads());
     54    SetConsoleCommand("TclThreadManager", "create",  &TclThreadManager::create);
     55    SetConsoleCommand("TclThreadManager", "destroy", &TclThreadManager::destroy).argumentCompleter(0, autocompletion::tclthreads());
     56    SetConsoleCommand("TclThreadManager", "execute", &TclThreadManager::execute).argumentCompleter(0, autocompletion::tclthreads());
     57    SetConsoleCommand("TclThreadManager", "query",   &TclThreadManager::query  ).argumentCompleter(0, autocompletion::tclthreads());
     58    SetConsoleCommand("TclThreadManager", "source",  &TclThreadManager::source ).argumentCompleter(0, autocompletion::tclthreads());
    5959
    6060    /**
  • code/branches/consolecommands3/src/libraries/core/input/InputManager.cc

    r7219 r7236  
    6666    static const std::string __CC_reload_name = "reload";
    6767
    68     _SetConsoleCommand(__CC_InputManager_name, __CC_calibrate_name, &InputManager::calibrate).addShortcut();
    69     _SetConsoleCommand(__CC_InputManager_name, __CC_reload_name,    &InputManager::reload   );
     68    SetConsoleCommand(__CC_InputManager_name, __CC_calibrate_name, &InputManager::calibrate).addShortcut();
     69    SetConsoleCommand(__CC_InputManager_name, __CC_reload_name,    &InputManager::reload   );
    7070
    7171    // Abuse of this source file for the InputHandler
     
    125125        this->updateActiveStates();
    126126
    127         _ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(this);
    128         _ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(this);
     127        ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(this);
     128        ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(this);
    129129
    130130        CCOUT(4) << "Construction complete." << std::endl;
     
    294294
    295295        // Reset console commands
    296         _ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(0);
    297         _ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(0);
     296        ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(0);
     297        ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(0);
    298298
    299299        CCOUT(3) << "Destruction complete." << std::endl;
  • code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.cc

    r7219 r7236  
    4848    static const std::string __CC_tunbind_name = "tunbind";
    4949
    50     _SetConsoleCommand(__CC_keybind_name,  &KeyBinderManager::keybind).defaultValues("");
    51     _SetConsoleCommand(__CC_tkeybind_name, &KeyBinderManager::tkeybind).defaultValues("");
    52     _SetConsoleCommand(__CC_unbind_name,   &KeyBinderManager::unbind).defaultValues("");
    53     _SetConsoleCommand(__CC_tunbind_name,  &KeyBinderManager::tunbind).defaultValues("");
     50    SetConsoleCommand(__CC_keybind_name,  &KeyBinderManager::keybind).defaultValues("");
     51    SetConsoleCommand(__CC_tkeybind_name, &KeyBinderManager::tkeybind).defaultValues("");
     52    SetConsoleCommand(__CC_unbind_name,   &KeyBinderManager::unbind).defaultValues("");
     53    SetConsoleCommand(__CC_tunbind_name,  &KeyBinderManager::tunbind).defaultValues("");
    5454
    5555    KeyBinderManager::KeyBinderManager()
     
    6262
    6363        // keybind console commands
    64         _ModifyConsoleCommand(__CC_keybind_name ).setObject(this);
    65         _ModifyConsoleCommand(__CC_tkeybind_name).setObject(this);
    66         _ModifyConsoleCommand(__CC_unbind_name  ).setObject(this);
    67         _ModifyConsoleCommand(__CC_tunbind_name ).setObject(this);
     64        ModifyConsoleCommand(__CC_keybind_name ).setObject(this);
     65        ModifyConsoleCommand(__CC_tkeybind_name).setObject(this);
     66        ModifyConsoleCommand(__CC_unbind_name  ).setObject(this);
     67        ModifyConsoleCommand(__CC_tunbind_name ).setObject(this);
    6868
    6969        // Load default key binder
     
    7878
    7979        // Reset console commands
    80         _ModifyConsoleCommand(__CC_keybind_name ).setObject(0);
    81         _ModifyConsoleCommand(__CC_tkeybind_name).setObject(0);
    82         _ModifyConsoleCommand(__CC_unbind_name  ).setObject(0);
    83         _ModifyConsoleCommand(__CC_tunbind_name ).setObject(0);
     80        ModifyConsoleCommand(__CC_keybind_name ).setObject(0);
     81        ModifyConsoleCommand(__CC_tkeybind_name).setObject(0);
     82        ModifyConsoleCommand(__CC_unbind_name  ).setObject(0);
     83        ModifyConsoleCommand(__CC_tunbind_name ).setObject(0);
    8484    }
    8585
  • code/branches/consolecommands3/src/libraries/core/input/KeyDetector.cc

    r7219 r7236  
    4141
    4242    static const std::string __CC_KeyDetector_callback_name = "KeyDetectorKeyPressed";
    43     _DeclareConsoleCommand(__CC_KeyDetector_callback_name, &prototype::void__string);
     43    DeclareConsoleCommand(__CC_KeyDetector_callback_name, &prototype::void__string);
    4444
    4545    KeyDetector::KeyDetector()
     
    4848        RegisterObject(KeyDetector);
    4949
    50         _ModifyConsoleCommand(__CC_KeyDetector_callback_name).setFunction(&KeyDetector::callback, this);
     50        ModifyConsoleCommand(__CC_KeyDetector_callback_name).setFunction(&KeyDetector::callback, this);
    5151
    5252        this->assignCommands();
     
    6262        inputState_->setHandler(NULL);
    6363        InputManager::getInstance().destroyState("detector");
    64         _ModifyConsoleCommand(__CC_KeyDetector_callback_name).resetFunction();
     64        ModifyConsoleCommand(__CC_KeyDetector_callback_name).resetFunction();
    6565    }
    6666
  • code/branches/consolecommands3/src/libraries/core/input/Mouse.cc

    r7220 r7236  
    4646    static const std::string __CC_ungrab_name = "ungrab";
    4747
    48     _SetConsoleCommand(__CC_Mouse_name, __CC_grab_name,   &Mouse::grab);
    49     _SetConsoleCommand(__CC_Mouse_name, __CC_ungrab_name, &Mouse::ungrab);
     48    SetConsoleCommand(__CC_Mouse_name, __CC_grab_name,   &Mouse::grab);
     49    SetConsoleCommand(__CC_Mouse_name, __CC_ungrab_name, &Mouse::ungrab);
    5050#endif
    5151
     
    5757
    5858#ifdef ORXONOX_PLATFORM_LINUX
    59         _ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(this);
    60         _ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(this);
     59        ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(this);
     60        ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(this);
    6161#endif
    6262    }
     
    6565    {
    6666#ifdef ORXONOX_PLATFORM_LINUX
    67         _ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(0);
    68         _ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(0);
     67        ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(0);
     68        ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(0);
    6969#endif
    7070    }
  • code/branches/consolecommands3/src/libraries/network/Host.cc

    r7219 r7236  
    4040  static const std::string __CC_printRTT_name = "printRTT";
    4141
    42   _SetConsoleCommand("chat", &Host::Chat);
    43   _SetConsoleCommand(__CC_printRTT_name, &Host::printRTT);
     42  SetConsoleCommand("chat", &Host::Chat);
     43  SetConsoleCommand(__CC_printRTT_name, &Host::printRTT);
    4444
    4545  // Host*               Host::instance_=0;
     
    5555  //   assert(instance_==0);
    5656    instances_s.push_back(this);
    57     _ModifyConsoleCommand(__CC_printRTT_name).setObject(this);
     57    ModifyConsoleCommand(__CC_printRTT_name).setObject(this);
    5858    this->bIsActive_ = false;
    5959  }
     
    6767    assert( std::find( instances_s.begin(), instances_s.end(), this )!=instances_s.end() );
    6868    instances_s.erase(std::find( instances_s.begin(), instances_s.end(), this ));
    69     _ModifyConsoleCommand(__CC_printRTT_name).setObject(0);
     69    ModifyConsoleCommand(__CC_printRTT_name).setObject(0);
    7070  }
    7171
  • code/branches/consolecommands3/src/libraries/tools/Timer.cc

    r7233 r7236  
    3939namespace orxonox
    4040{
    41     _SetConsoleCommand("delay", &delay).argumentCompleter(1, autocompletion::command());
    42     _SetConsoleCommand("killdelays", &killdelays);
     41    SetConsoleCommand("delay", &delay).argumentCompleter(1, autocompletion::command());
     42    SetConsoleCommand("killdelays", &killdelays);
    4343
    4444    static std::set<Timer*> delaytimerset;
Note: See TracChangeset for help on using the changeset viewer.