Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.