Changeset 7414 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Apr 28, 2006, 1:12:28 AM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_command.cc
r7413 r7414 136 136 /** 137 137 * @brief takes out an InputLine, searching for a Command. 138 * @see const ShellCommand* const ShellCommand::getCommandFromInput(const SubString& strings) 138 139 * @param inputLine: the Input to analyse. 140 * @param paramBegin: The begin of the Splitted SubStrings entry of the Parameters section. 139 141 * @returns: The ShellCommand if found. 140 142 */ 141 const ShellCommand* const ShellCommand::getCommandFromInput(const std::string& inputLine) 142 { 143 SubString strings(inputLine, SubString::WhiteSpaces); 143 const ShellCommand* const ShellCommand::getCommandFromInput(const std::string& inputLine, unsigned int& paramBegin) 144 { 145 ShellCommand::getCommandFromInput(SubString(inputLine, SubString::WhiteSpaces), paramBegin); 146 } 147 148 /** 149 * @brief takes out an InputLine, searching for a Command. 150 * @param strings: the Input to analyse. 151 * @param paramBegin: The begin of the Splitted SubStrings entry of the Parameters section. 152 * @returns: The ShellCommand if found. 153 */ 154 const ShellCommand* const ShellCommand::getCommandFromInput(const SubString& strings, unsigned int& paramBegin) 155 { 144 156 // no input, no Command. 145 157 if (strings.size() == 0) 146 return NULL; 158 { 159 paramBegin = 0; 160 return NULL; 161 } 147 162 148 163 // CHECK FOR ALIAS … … 162 177 const ShellCommand* retCmd; 163 178 if (strings.size() >= 1) 179 { 164 180 retCmd = ShellCommand::getCommand(strings[1], cmdClass); 181 paramBegin = 2; 182 } 165 183 if (retCmd == NULL && strings.size() >= 2) 184 { 166 185 retCmd = ShellCommand::getCommand(strings[2], cmdClass); 167 return retCmd; 168 169 } 186 paramBegin = 3; 187 } 188 if (retCmd != NULL) // check for the paramBegin. 189 return retCmd; 190 } 191 paramBegin = 0; 192 return NULL; 170 193 } 171 194 -
trunk/src/lib/shell/shell_command.h
r7413 r7414 76 76 static const ShellCommand* const getCommand(const std::string& commandName, const ShellCommandClass* cmdClass); 77 77 static bool exists(const std::string& commandName, const std::string& className); 78 static const ShellCommand* const getCommandFromInput(const std::string& inputLine); 78 static const ShellCommand* const getCommandFromInput(const std::string& inputLine, unsigned int& paramBegin); 79 static const ShellCommand* const getCommandFromInput(const SubString& strings, unsigned int& paramBegin); 79 80 80 81 const ShellCommandClass* const getCommandClass() const { return this->shellClass; }; -
trunk/src/lib/shell/shell_completion.cc
r7413 r7414 102 102 if (completeType == NullCompletion) 103 103 { 104 if ((command = ShellCommand::getCommandFromInput(input)) != NULL) 104 105 if ((command = ShellCommand::getCommandFromInput(inputSplits, parameterBegin)) != NULL) 105 106 completeType |= ParamCompletion; 106 107 } … … 116 117 if (completeType & ParamCompletion) 117 118 this->paramComplete(completeString, command); 118 119 120 119 121 120 this->generalComplete(input, completeString);
Note: See TracChangeset
for help on using the changeset viewer.