Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2008, 12:27:13 AM (16 years ago)
Author:
landauf
Message:

autocompletion is almost done

File:
1 edited

Legend:

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

    r1430 r1434  
    3030#include "ConsoleCommand.h"
    3131#include "Debug.h"
     32#include "util/String.h"
    3233
    3334namespace orxonox
     
    8182        }
    8283
    83         if (!this->bCommandChanged_)
     84        if (!this->bCommandChanged_ || removeTrailingWhitespaces(this->command_) == removeTrailingWhitespaces(this->originalCommand_))
    8485        {
    8586            COUT(4) << "CE_execute: " << this->command_ << "\n";
     
    136137                        maxIndex -= 1;
    137138                    std::string whitespace = "";
    138                     if (this->function_->getParamCount() > (maxIndex + 1 - this->getStartindex()))
    139                         whitespace = " ";
    140139
    141140                    if (this->possibleArgument_ != "")
    142141                    {
    143                         maxIndex -= 1;
    144142                        this->argument_ = this->possibleArgument_;
     143                        if (this->function_->getParamCount() > (maxIndex + 1 - this->getStartindex()))
     144                            whitespace = " ";
    145145                    }
    146146
     
    163163        {
    164164            case CS_Uninitialized:
     165std::cout << "hint: CS_Uninitialized" << std::endl;
    165166                break;
    166167            case CS_Empty:
     168std::cout << "hint: CS_Empty" << std::endl;
    167169            case CS_ShortcutOrIdentifier:
     170std::cout << "hint: CS_ShortcutOrIdentifier" << std::endl;
    168171                if (this->listOfPossibleFunctions_.size() == 0)
    169172                    return CommandEvaluation::dump(this->listOfPossibleIdentifiers_);
     
    174177                break;
    175178            case CS_Function:
     179std::cout << "hint: CS_Function" << std::endl;
    176180                return CommandEvaluation::dump(this->listOfPossibleFunctions_);
    177181                break;
    178182            case CS_ParamPreparation:
     183std::cout << "hint: CS_ParamPreparation" << std::endl;
    179184            case CS_Params:
     185std::cout << "hint: CS_Params" << std::endl;
    180186                if (this->listOfPossibleArguments_.size() > 0)
    181187                    return CommandEvaluation::dump(this->listOfPossibleArguments_);
     
    183189                    return CommandEvaluation::dump(this->function_);
    184190            case CS_Finished:
     191std::cout << "hint: CS_Finished" << std::endl;
    185192                if (this->function_)
    186193                    return CommandEvaluation::dump(this->function_);
    187194                break;
    188195            case CS_Error:
     196std::cout << "hint: CS_Error" << std::endl;
    189197                return this->errorMessage_;
    190198                break;
     
    272280    }
    273281
     282    std::string CommandEvaluation::dump(const std::list<std::pair<std::string, std::string> >& list)
     283    {
     284        std::string output = "";
     285        for (std::list<std::pair<std::string, std::string> >::const_iterator it = list.begin(); it != list.end(); ++it)
     286        {
     287            if (it != list.begin())
     288                output += " ";
     289
     290            output += (*it).second;
     291        }
     292        return output;
     293    }
     294
    274295    std::string CommandEvaluation::dump(const ConsoleCommand* command)
    275296    {
Note: See TracChangeset for help on using the changeset viewer.