Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 25, 2010, 7:07:08 PM (14 years ago)
Author:
landauf
Message:

removed old console command implementation (doesn't compile)

File:
1 edited

Legend:

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

    r7215 r7216  
    2828
    2929#include "ConsoleCommand.h"
    30 #include <cassert>
    3130
    3231#include "util/Convert.h"
    3332#include "core/Language.h"
    34 
    35 namespace orxonox
    36 {
    37     ConsoleCommand::ConsoleCommand(const FunctorPtr& functor, const std::string& name) : Executor(functor, name)
    38     {
    39         this->accessLevel_ = AccessLevel::None;
    40         this->argumentCompleter_[0] = 0;
    41         this->argumentCompleter_[1] = 0;
    42         this->argumentCompleter_[2] = 0;
    43         this->argumentCompleter_[3] = 0;
    44         this->argumentCompleter_[4] = 0;
    45 
    46         this->keybindMode_ = KeybindMode::OnPress;
    47         this->inputConfiguredParam_ = -1;
    48     }
    49 
    50     ConsoleCommand& ConsoleCommand::argumentCompleter(unsigned int param, ArgumentCompleter* completer)
    51     {
    52         if (param < 5)
    53             this->argumentCompleter_[param] = completer;
    54         else
    55         {
    56             COUT(2) << "Warning: Couldn't add autocompletion-function for param " << param << ": index out of bound." << std::endl;
    57         }
    58         return (*this);
    59     }
    60 
    61     ArgumentCompleter* ConsoleCommand::getArgumentCompleter(unsigned int param) const
    62     {
    63         if (param < 5)
    64             return this->argumentCompleter_[param];
    65         else
    66             return 0;
    67     }
    68 
    69     void ConsoleCommand::createArgumentCompletionList(unsigned int param, const std::string& param1, const std::string& param2, const std::string& param3, const std::string& param4, const std::string& param5)
    70     {
    71         if (param < 5 && this->argumentCompleter_[param])
    72             this->argumentList_ = (*this->argumentCompleter_[param])(param1, param2, param3, param4, param5);
    73         else
    74             this->argumentList_.clear();
    75     }
    76 
    77     ConsoleCommand& ConsoleCommand::description(const std::string& description)
    78     {
    79         this->description_ = std::string("ConsoleCommandDescription::" + this->name_ + "::function");
    80         AddLanguageEntry(this->description_, description);
    81         return (*this);
    82     }
    83 
    84     const std::string& ConsoleCommand::getDescription() const
    85     {
    86         return GetLocalisation_noerror(this->description_);
    87     }
    88 
    89     ConsoleCommand& ConsoleCommand::descriptionParam(unsigned int param, const std::string& description)
    90     {
    91         if (param < MAX_FUNCTOR_ARGUMENTS)
    92         {
    93             this->descriptionParam_[param] = std::string("ConsoleCommandDescription::" + this->name_ + "::param" + multi_cast<std::string>(param));
    94             AddLanguageEntry(this->descriptionParam_[param], description);
    95         }
    96         return (*this);
    97     }
    98 
    99     const std::string& ConsoleCommand::getDescriptionParam(unsigned int param) const
    100     {
    101         if (param < MAX_FUNCTOR_ARGUMENTS)
    102             return GetLocalisation_noerror(this->descriptionParam_[param]);
    103 
    104         return this->descriptionParam_[0];
    105     }
    106 
    107     ConsoleCommand& ConsoleCommand::descriptionReturnvalue(const std::string& description)
    108     {
    109         this->descriptionReturnvalue_ = std::string("ConsoleCommandDescription::" + this->name_ + "::returnvalue");
    110         AddLanguageEntry(this->descriptionReturnvalue_, description);
    111         return (*this);
    112     }
    113 
    114     const std::string& ConsoleCommand::getDescriptionReturnvalue(int param) const
    115     {
    116         return GetLocalisation_noerror(this->descriptionReturnvalue_);
    117     }
    118 }
    119 
    12033#include "core/BaseObject.h" // remove this
    12134
     
    537450        }
    538451    }
     452
     453    /* static */ void _ConsoleCommand::destroyAll()
     454    {
     455        while (!_ConsoleCommand::getCommandMap().empty() && !_ConsoleCommand::getCommandMap().begin().empty())
     456            _ConsoleCommand::getCommandMap().begin().erase(_ConsoleCommand::getCommandMap().begin().begin());
     457    }
    539458}
Note: See TracChangeset for help on using the changeset viewer.