Changeset 948 for code/branches/core2
- Timestamp:
- Mar 28, 2008, 11:06:22 PM (17 years ago)
- Location:
- code/branches/core2/src/orxonox/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/CommandExecutor.cc
r947 r948 109 109 CommandExecutor::parse(command); 110 110 111 CommandExecutor::tokens_s.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0'); 112 111 113 switch (CommandExecutor::state_s) 112 114 { … … 166 168 CommandExecutor::parse(command); 167 169 170 CommandExecutor::tokens_s.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0'); 171 172 std::list<const std::string*> temp; 173 if (CommandExecutor::state_s == CS_Empty) 174 { 175 temp.insert(temp.end(), CommandExecutor::listOfPossibleShortcuts_s.begin(), CommandExecutor::listOfPossibleShortcuts_s.end()); 176 temp.insert(temp.end(), CommandExecutor::listOfPossibleFunctionClasses_s.begin(), CommandExecutor::listOfPossibleFunctionClasses_s.end()); 177 } 178 168 179 switch (CommandExecutor::state_s) 169 180 { 170 181 case CS_Empty: 182 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(temp)); 171 183 break; 172 184 case CS_FunctionClass_Or_Shortcut_Or_Keyword: 173 185 break; 174 186 case CS_Shortcut_Params: 187 if (command[command.size() - 1] != ' ') 188 return (command + " "); 175 189 break; 176 190 case CS_Shortcut_Finished: 177 191 break; 178 192 case CS_Function: 193 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::listOfPossibleFunctions_s)); 179 194 break; 180 195 case CS_Function_Params: 196 if (command[command.size() - 1] != ' ') 197 return (command + " "); 181 198 break; 182 199 case CS_Function_Finished: 183 200 break; 184 201 case CS_ConfigValueClass: 202 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::listOfPossibleConfigValueClasses_s)); 185 203 break; 186 204 case CS_ConfigValue: 205 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::listOfPossibleConfigValues_s)); 187 206 break; 188 207 case CS_ConfigValueType: 208 if (command[command.size() - 1] != ' ') 209 return (command + " "); 189 210 break; 190 211 case CS_ConfigValueFinished: 191 212 break; 192 213 case CS_KeybindKey: 214 return (CommandExecutor::tokens_s.subSet(0, CommandExecutor::tokens_s.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::listOfPossibleKeys_s)); 193 215 break; 194 216 case CS_KeybindCommand: 217 if (command[command.size() - 1] != ' ') 218 return (command + " "); 195 219 break; 196 220 case CS_KeybindFinished: … … 207 231 if (CommandExecutor::lastProcessedCommand_s != command) 208 232 CommandExecutor::parse(command); 233 234 CommandExecutor::tokens_s.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0'); 209 235 210 236 switch (CommandExecutor::state_s) … … 849 875 return container->getTypename(); 850 876 } 877 878 std::string CommandExecutor::getCommonBegin(const std::list<const std::string*>& list) 879 { 880 if (list.size() == 0) 881 { 882 return ""; 883 } 884 else if (list.size() == 1) 885 { 886 return ((**list.begin()) + " "); 887 } 888 else 889 { 890 std::string output = ""; 891 for (unsigned int i = 0; true; i++) 892 { 893 char temp = 0; 894 for (std::list<const std::string*>::const_iterator it = list.begin(); it != list.end(); ++it) 895 { 896 if ((**it).size() > i) 897 { 898 if (it == list.begin()) 899 { 900 temp = (**it)[i]; 901 } 902 else 903 { 904 if (temp != (**it)[i]) 905 return output; 906 } 907 } 908 else 909 { 910 return output; 911 } 912 } 913 output += temp; 914 } 915 return output; 916 } 917 } 851 918 } -
code/branches/core2/src/orxonox/core/CommandExecutor.h
r947 r948 107 107 static std::string dump(const ConfigValueContainer* container); 108 108 109 static std::string getCommonBegin(const std::list<const std::string*>& list); 110 109 111 static Identifier* getIdentifierOfPossibleFunctionClass(const std::string& name); 110 112 static ExecutorStatic* getExecutorOfPossibleShortcut(const std::string& name); -
code/branches/core2/src/orxonox/core/DebugLevel.cc
r947 r948 95 95 96 96 // Return a constant value while we're creating the object 97 return 5;97 return 2; 98 98 } 99 99 }
Note: See TracChangeset
for help on using the changeset viewer.