- Timestamp:
- Aug 27, 2010, 2:41:03 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/command/CommandEvaluation.h
r7221 r7228 33 33 34 34 #include <string> 35 #include <list>36 35 37 36 #include "ArgumentCompletionListElement.h" … … 41 40 namespace orxonox 42 41 { 43 namespace CommandState44 {45 enum Value46 {47 Uninitialized,48 Empty,49 ShortcutOrIdentifier,50 Function,51 ParamPreparation,52 Params,53 Finished,54 Error55 };56 }57 58 42 class _CoreExport CommandEvaluation 59 43 { … … 63 47 CommandEvaluation(); 64 48 49 int execute() const; 50 MultiType query(int* error = 0) const; 51 52 std::string complete() const; 53 std::string hint() const; 54 55 inline bool isValid() const 56 { return (this->execCommand_ != 0); } 57 58 inline _ConsoleCommand* getConsoleCommand() const 59 { return this->execCommand_; } 60 61 // void setEvaluatedParameter(unsigned int index, MultiType param); 62 // MultiType getEvaluatedParameter(unsigned int index) const; 63 64 private: 65 65 void initialize(const std::string& command); 66 66 67 bool execute() const; 68 MultiType query(bool* success = 0) const; 67 unsigned int getNumberOfArguments() const; 68 const std::string& getLastArgument() const; 69 const std::string& getToken(unsigned int i) const; 69 70 70 const std::string& complete(); 71 std::string hint() const; 72 void evaluateParams(); 71 void retrievePossibleArguments() const; 73 72 74 bool isValid() const 75 { return this->function_; } 73 static void strip(ArgumentCompletionList& list, const std::string& fragment); 76 74 77 inline _ConsoleCommand* getConsoleCommand() const78 { return this->function_; }79 inline const std::string& getOriginalCommand() const80 { return this->originalCommand_; }81 inline const std::string& getCommand() const82 { return this->command_; }83 84 inline void setAdditionalParameter(const std::string& param)85 { this->additionalParameter_ = param; this->bEvaluatedParams_ = false; }86 inline std::string getAdditionalParameter() const87 { return (!this->additionalParameter_.empty()) ? (' ' + this->additionalParameter_) : ""; }88 89 void setEvaluatedParameter(unsigned int index, MultiType param);90 MultiType getEvaluatedParameter(unsigned int index) const;91 92 private:93 unsigned int getStartindex() const;94 static std::string dump(const std::list<std::pair<const std::string*, const std::string*> >& list);95 75 static std::string dump(const ArgumentCompletionList& list); 96 76 static std::string dump(const _ConsoleCommand* command); 97 77 78 static std::string getCommonBegin(const ArgumentCompletionList& list); 98 79 99 bool bNewCommand_; 100 bool bCommandChanged_; 101 102 std::string originalCommand_; 103 std::string command_; 104 SubString commandTokens_; 105 std::string additionalParameter_; 106 107 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleIdentifiers_; 108 std::list<std::pair<const std::string*, const std::string*> > listOfPossibleFunctions_; 109 ArgumentCompletionList listOfPossibleArguments_; 110 111 Identifier* functionclass_; 112 _ConsoleCommand* function_; 113 std::string possibleArgument_; 114 std::string argument_; 115 116 std::string errorMessage_; 117 CommandState::Value state_; 118 119 bool bEvaluatedParams_; 120 MultiType param_[5]; 80 _ConsoleCommand* execCommand_; 81 _ConsoleCommand* hintCommand_; 82 SubString tokens_; 83 std::string string_; 84 unsigned int execArgumentsOffset_; 85 unsigned int hintArgumentsOffset_; 86 mutable bool bPossibleArgumentsRetrieved_; 87 mutable ArgumentCompletionList possibleArguments_; 121 88 }; 122 89 }
Note: See TracChangeset
for help on using the changeset viewer.