Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 27, 2010, 2:41:03 PM (14 years ago)
Author:
landauf
Message:

re-implemented CommandExecutor and CommandEvaluation. parameter evaluation is currently not implemented, will come soon.

File:
1 edited

Legend:

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

    r7219 r7228  
    315315        this->updateListeners<&ShellListener::executed>();
    316316
    317         bool success;
    318         const std::string& result = CommandExecutor::query(this->inputBuffer_->get(), &success);
    319         if (!success)
    320         {
    321             this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\"." << std::endl;
     317        int error;
     318        const std::string& result = CommandExecutor::query(this->inputBuffer_->get(), &error);
     319        if (error)
     320        {
     321            switch (error)
     322            {
     323                case CommandExecutor::Error:       this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", command doesn't exist. (S)" << std::endl; break;
     324                case CommandExecutor::Incomplete:  this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", not enough arguments given. (S)" << std::endl; break;
     325                case CommandExecutor::Deactivated: this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", command is not active. (S)" << std::endl; break;
     326                case CommandExecutor::Denied:      this->outputBuffer_ << "Error: Can't execute \"" << this->inputBuffer_->get() << "\", access denied. (S)" << std::endl; break;
     327            }
    322328            this->outputChanged(Error);
    323329        }
     
    333339    void Shell::hintAndComplete()
    334340    {
    335         this->inputBuffer_->set(CommandExecutor::complete(this->inputBuffer_->get()));
    336         this->outputBuffer_ << CommandExecutor::hint(this->inputBuffer_->get()) << std::endl;
     341        this->inputBuffer_->set(CommandExecutor::evaluate(this->inputBuffer_->get()).complete());
     342        this->outputBuffer_ << CommandExecutor::evaluate(this->inputBuffer_->get()).hint() << std::endl;
    337343        this->outputChanged(Hint);
    338344
Note: See TracChangeset for help on using the changeset viewer.