Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2008, 8:30:33 PM (17 years ago)
Author:
landauf
Message:

I start to like it

File:
1 edited

Legend:

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

    r1416 r1430  
    3434    {
    3535        this->accessLevel_ = AccessLevel::None;
    36         this->autocompletionFunction_[0] = &autocompletion::fallback;
    37         this->autocompletionFunction_[1] = &autocompletion::fallback;
    38         this->autocompletionFunction_[2] = &autocompletion::fallback;
    39         this->autocompletionFunction_[3] = &autocompletion::fallback;
    40         this->autocompletionFunction_[4] = &autocompletion::fallback;
     36        this->argumentCompleter_[0] = 0;
     37        this->argumentCompleter_[1] = 0;
     38        this->argumentCompleter_[2] = 0;
     39        this->argumentCompleter_[3] = 0;
     40        this->argumentCompleter_[4] = 0;
    4141    }
    4242
    43     ConsoleCommand& ConsoleCommand::setArgumentCompletionList(unsigned int param, std::list<std::pair<std::string, std::string> > (*function) (void))
     43    ConsoleCommand& ConsoleCommand::setArgumentCompletionList(unsigned int param, ArgumentCompleter* completer)
    4444    {
    4545        if (param < 5)
    46             this->autocompletionFunction_[param] = function;
     46            this->argumentCompleter_[param] = completer;
    4747        else
    4848        {
     
    5252    }
    5353
    54     const std::list<std::pair<std::string, std::string> >& ConsoleCommand::getArgumentCompletionList(unsigned int param)
     54    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)
    5555    {
    56         if (param < 5)
    57             this->argumentList_ = (*this->autocompletionFunction_[param])();
     56        if (param < 5 && this->argumentCompleter_[param])
     57            this->argumentList_ = (*this->argumentCompleter_[param])(param1, param2, param3, param4, param5);
    5858        else
    59             this->argumentList_ = autocompletion::fallback();
    60 
    61         return this->argumentList_;
    62     }
    63 
    64     std::list<std::pair<std::string, std::string> >::const_iterator ConsoleCommand::getArgumentCompletionListBegin(unsigned int param)
    65     {
    66         if (param < 5)
    67             this->argumentList_ = (*this->autocompletionFunction_[param])();
    68         else
    69             this->argumentList_ = autocompletion::fallback();
    70 
    71         return this->argumentList_.begin();
    72     }
    73 
    74     std::list<std::pair<std::string, std::string> >::const_iterator ConsoleCommand::getArgumentCompletionListEnd(unsigned int param)
    75     {
    76         if (param < 5)
    77             this->argumentList_ = (*this->autocompletionFunction_[param])();
    78         else
    79             this->argumentList_ = autocompletion::fallback();
    80 
    81         return this->argumentList_.end();
     59            this->argumentList_.clear();
    8260    }
    8361}
Note: See TracChangeset for help on using the changeset viewer.