Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 26, 2010, 2:06:16 AM (15 years ago)
Author:
landauf
Message:

adapted CommandExecutor and CommandEvaluation to make it compile again, but it doesn't run yet. ready for refactoring.

File:
1 edited

Legend:

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

    r7203 r7221  
    6767    }
    6868
    69     bool CommandEvaluation::isValid() const
    70     {
    71         return (this->function_);
    72     }
    73 
    7469    bool CommandEvaluation::execute() const
    7570    {
     
    8479            *success = false;
    8580
    86         if (!this->isValid())
     81        if (!this->function_ || !this->function_->isActive())
    8782            return MT_Type::Null;
    8883
     
    9287                *success = true;
    9388            COUT(6) << "CE_execute (evaluation): " << this->function_->getName() << ' ' << this->param_[0] << ' ' << this->param_[1] << ' ' << this->param_[2] << ' ' << this->param_[3] << ' ' << this->param_[4] << std::endl;
    94             return (*this->function_)(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]);
     89            return (*this->function_->getExecutor())(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]);
    9590        }
    9691
     
    10196            unsigned int startindex = this->getStartindex();
    10297            if (this->commandTokens_.size() > startindex)
    103                 return this->function_->parse(removeSlashes(this->commandTokens_.subSet(startindex).join() + this->getAdditionalParameter()), success);
     98                return this->function_->getExecutor()->parse(removeSlashes(this->commandTokens_.subSet(startindex).join() + this->getAdditionalParameter()), success);
    10499            else
    105                 return this->function_->parse(removeSlashes(this->additionalParameter_), success);
     100                return this->function_->getExecutor()->parse(removeSlashes(this->additionalParameter_), success);
    106101        }
    107102
     
    122117                    if (this->function_)
    123118                    {
    124                         if (this->function_->getParamCount() == 0)
     119                        if (this->function_->getExecutor()->getParamCount() == 0)
    125120                            return (this->command_ = this->function_->getName());
    126121                        else
     
    133128                    if (this->function_)
    134129                    {
    135                         if (this->function_->getParamCount() == 0)
     130                        if (this->function_->getExecutor()->getParamCount() == 0)
    136131                            return (this->command_ = this->functionclass_->getName() + ' ' + this->function_->getName());
    137132                        else
     
    153148                    {
    154149                        this->argument_ = this->possibleArgument_;
    155                         if (this->function_->getParamCount() > (maxIndex + 1 - this->getStartindex()))
     150                        if (this->function_->getExecutor()->getParamCount() > (maxIndex + 1 - this->getStartindex()))
    156151                            whitespace = " ";
    157152                    }
     
    213208            this->param_[i] = MT_Type::Null;
    214209
    215         if (!this->isValid())
     210        if (!this->function_)
    216211            return;
    217212
     
    220215        if (this->commandTokens_.size() <= startindex)
    221216        {
    222             if (this->function_->evaluate(this->getAdditionalParameter(), this->param_, " "))
     217            if (this->function_->getBaseExecutor()->evaluate(this->getAdditionalParameter(), this->param_, " "))
    223218                this->bEvaluatedParams_ = true;
    224219        }
    225220        else if (this->commandTokens_.size() > startindex)
    226221        {
    227             if (this->function_->evaluate(this->commandTokens_.subSet(startindex).join() + this->getAdditionalParameter(), this->param_, " "))
     222            if (this->function_->getBaseExecutor()->evaluate(this->commandTokens_.subSet(startindex).join() + this->getAdditionalParameter(), this->param_, " "))
    228223                this->bEvaluatedParams_ = true;
    229224        }
     
    280275    }
    281276
    282     std::string CommandEvaluation::dump(const ConsoleCommand* command)
     277    std::string CommandEvaluation::dump(const _ConsoleCommand* command)
    283278    {
    284279        std::string output = command->getName();
    285         if (command->getParamCount() > 0)
     280        if (command->getExecutor()->getParamCount() > 0)
    286281            output += ": ";
    287282
    288         for (unsigned int i = 0; i < command->getParamCount(); i++)
     283        for (unsigned int i = 0; i < command->getExecutor()->getParamCount(); i++)
    289284        {
    290285            if (i != 0)
    291286                output += ' ';
    292287
    293             if (command->defaultValueSet(i))
     288            if (command->getExecutor()->defaultValueSet(i))
    294289                output += '[';
    295290            else
    296291                output += '{';
    297292
    298             output += command->getTypenameParam(i);
    299 
    300             if (command->defaultValueSet(i))
    301                 output += '=' + command->getDefaultValue(i).getString() + ']';
     293            output += command->getExecutor()->getTypenameParam(i);
     294
     295            if (command->getExecutor()->defaultValueSet(i))
     296                output += '=' + command->getExecutor()->getDefaultValue(i).getString() + ']';
    302297            else
    303298                output += '}';
Note: See TracChangeset for help on using the changeset viewer.