Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 29, 2008, 3:04:06 PM (16 years ago)
Author:
landauf
Message:

added CommandEvaluation to store the results of a command evaluation in CommandExecutor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/orxonox/core/CommandExecutor.h

    r951 r952  
    4040namespace orxonox
    4141{
     42    enum CommandState
     43    {
     44        CS_Empty,
     45        CS_FunctionClass_Or_Shortcut_Or_Keyword,
     46        CS_Shortcut_Params,
     47        CS_Shortcut_Finished,
     48        CS_Function,
     49        CS_Function_Params,
     50        CS_Function_Finished,
     51        CS_ConfigValueClass,
     52        CS_ConfigValue,
     53        CS_ConfigValueType,
     54        CS_ConfigValueFinished,
     55        CS_KeybindKey,
     56        CS_KeybindCommand,
     57        CS_KeybindFinished,
     58        CS_Error
     59    };
     60
     61    class _CoreExport CommandEvaluation
     62    {
     63        public:
     64            std::string processedCommand_;
     65            SubString tokens_;
     66            std::list<const std::string*> listOfPossibleFunctionClasses_;
     67            std::list<const std::string*> listOfPossibleShortcuts_;
     68            std::list<const std::string*> listOfPossibleFunctions_;
     69            std::list<const std::string*> listOfPossibleConfigValueClasses_;
     70            std::list<const std::string*> listOfPossibleConfigValues_;
     71            std::list<const std::string*> listOfPossibleKeys_;
     72
     73            Identifier* functionclass_;
     74            Identifier* configvalueclass_;
     75            ExecutorStatic* shortcut_;
     76            ExecutorStatic* function_;
     77            ConfigValueContainer* configvalue_;
     78            ConfigValueContainer* key_;
     79
     80            std::string errorMessage_;
     81            CommandState state_;
     82    };
     83
    4284    class _CoreExport CommandExecutor
    4385    {
    44         enum CommandState
    45         {
    46             CS_Empty,
    47             CS_FunctionClass_Or_Shortcut_Or_Keyword,
    48             CS_Shortcut_Params,
    49             CS_Shortcut_Finished,
    50             CS_Function,
    51             CS_Function_Params,
    52             CS_Function_Finished,
    53             CS_ConfigValueClass,
    54             CS_ConfigValue,
    55             CS_ConfigValueType,
    56             CS_ConfigValueFinished,
    57             CS_KeybindKey,
    58             CS_KeybindCommand,
    59             CS_KeybindFinished,
    60             CS_Error
    61         };
    62 
    6386        public:
    6487            static bool execute(const std::string& command);
     88            static bool execute(const CommandEvaluation& evaluation);
     89
    6590            static std::string complete(const std::string& command);
     91            static std::string complete(const CommandEvaluation& evaluation);
     92
    6693            static std::string hint(const std::string& command);
     94            static std::string hint(const CommandEvaluation& evaluation);
     95
     96            static const CommandEvaluation& evaluate(const std::string& command);
    6797
    6898            static bool addConsoleCommandShortcut(ExecutorStatic* executor);
     
    90120
    91121            static CommandExecutor& getInstance();
     122            static CommandEvaluation& getEvaluation();
    92123
    93124            static void parse(const std::string& command, bool bInitialize = true);
     
    123154            static ConfigValueContainer* getContainerOfPossibleKey(const std::string& name);
    124155
    125             std::string lastProcessedCommand_;
    126             SubString tokens_;
    127             std::list<const std::string*> listOfPossibleFunctionClasses_;
    128             std::list<const std::string*> listOfPossibleShortcuts_;
    129             std::list<const std::string*> listOfPossibleFunctions_;
    130             std::list<const std::string*> listOfPossibleConfigValueClasses_;
    131             std::list<const std::string*> listOfPossibleConfigValues_;
    132             std::list<const std::string*> listOfPossibleKeys_;
    133 
    134             Identifier* functionclass_;
    135             Identifier* configvalueclass_;
    136             ExecutorStatic* shortcut_;
    137             ExecutorStatic* function_;
    138             ConfigValueContainer* configvalue_;
    139             ConfigValueContainer* key_;
    140 
    141             std::string errorMessage_;
    142             CommandState state_;
     156            CommandEvaluation evaluation_;
    143157
    144158            std::map<std::string, ExecutorStatic*> consoleCommandShortcuts_;
Note: See TracChangeset for help on using the changeset viewer.