Changeset 1351 for code/branches/console/src/core/CommandEvaluation.h
- Timestamp:
- May 22, 2008, 1:18:18 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/CommandEvaluation.h
r1341 r1351 44 44 CS_Uninitialized, 45 45 CS_Empty, 46 CS_FunctionClass_Or_Shortcut _Or_Keyword,46 CS_FunctionClass_Or_Shortcut, 47 47 CS_Shortcut_Params, 48 48 CS_Shortcut_Finished, … … 50 50 CS_Function_Params, 51 51 CS_Function_Finished, 52 CS_ConfigValueClass,53 CS_ConfigValue,54 CS_ConfigValueType,55 CS_ConfigValueFinished,56 CS_KeybindKey,57 CS_KeybindCommand,58 CS_KeybindFinished,59 52 CS_Error 60 53 }; 61 54 62 enum KeybindMode {}; // temporary63 64 55 class _CoreExport CommandEvaluation 65 56 { 66 friend class CommandExecutor;67 68 57 public: 69 58 CommandEvaluation(); 70 59 71 KeybindMode getKeybindMode(); 60 void initialize(const std::string& command); 61 62 void execute() const; 63 std::string complete() const; 64 std::string hint() const; 65 void evaluateParams(); 66 72 67 bool isValid() const; 68 69 inline Identifier* getIdentifier() const 70 { return this->functionclass_; } 71 inline void setIdentifier(Identifier* identifier) 72 { this->functionclass_ = identifier; } 73 inline ConsoleCommand* getFunction() const 74 { return this->function_; } 75 inline void setFunction(ConsoleCommand* command) 76 { this->function_ = command; } 77 78 inline const std::string& getOriginalCommand() const 79 { return this->originalCommand_; } 80 inline const std::string& getCommand() const 81 { return this->command_; } 82 inline void setCommand(const std::string& command) 83 { this->command_ = command; } 84 inline const CommandState& getState() const 85 { return this->state_; } 86 inline void setState(CommandState state) 87 { this->state_ = state; } 88 inline SubString& getOriginalTokens() 89 { return this->originalCommandTokens_; } 90 inline SubString& getTokens() 91 { return this->commandTokens_; } 92 inline void setTokens(const std::string& command) 93 { this->commandTokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0'); } 94 inline const std::string& getError() const 95 { return this->errorMessage_; } 96 inline void setError(const std::string& error) 97 { this->errorMessage_ = error; } 98 inline bool isNewCommand() const 99 { return this->bNewCommand_; } 100 inline void setNewCommand(bool bNewCommand) 101 { this->bNewCommand_ = bNewCommand; } 102 103 inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleFunctionClasses() 104 { return this->listOfPossibleFunctionClasses_; } 105 inline std::list<std::pair<const std::string*, const std::string*> >& getListOfPossibleFunctions() 106 { return this->listOfPossibleFunctions_; } 73 107 74 108 inline void setAdditionalParameter(const std::string& param) … … 80 114 MultiTypeMath getEvaluatedParameter(unsigned int index) const; 81 115 82 void evaluateParams();83 84 116 bool hasReturnvalue() const; 85 117 MultiTypeMath getReturnvalue() const; 86 118 87 119 private: 88 std::string processedCommand_; 89 SubString tokens_; 120 unsigned int getStartindex() const; 121 static std::string getCommonBegin(const std::list<std::pair<const std::string*, const std::string*> >& list); 122 static std::string dump(const std::list<std::pair<const std::string*, const std::string*> >& list); 123 static std::string dump(const ConsoleCommand* command); 124 125 126 bool bNewCommand_; 127 128 std::string originalCommand_; 129 std::string command_; 130 SubString originalCommandTokens_; 131 SubString commandTokens_; 90 132 std::string additionalParameter_; 91 133 92 134 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleFunctionClasses_; 93 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleShortcuts_;94 135 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleFunctions_; 95 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleConfigValueClasses_;96 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleConfigValues_;97 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleKeys_;98 136 99 137 Identifier* functionclass_; 100 Identifier* configvalueclass_;101 ConsoleCommand* shortcut_;102 138 ConsoleCommand* function_; 103 ConfigValueContainer* configvalue_;104 ConfigValueContainer* key_;105 139 106 140 std::string errorMessage_; … … 109 143 bool bEvaluatedParams_; 110 144 MultiTypeMath param_[5]; 111 ConsoleCommand* evaluatedExecutor_;112 145 }; 113 146 }
Note: See TracChangeset
for help on using the changeset viewer.