Changeset 7340 in orxonox.OLD for trunk/src/lib/shell
- Timestamp:
- Apr 19, 2006, 2:39:05 AM (19 years ago)
- Location:
- trunk/src/lib/shell
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell.cc
r7330 r7340 148 148 149 149 /** 150 * deactiveates the Shell.150 * @brief deactiveates the Shell. 151 151 */ 152 152 void Shell::deactivate() … … 175 175 176 176 /** 177 * sets the File to load the fonts from177 * @brief sets the File to load the fonts from 178 178 * @param fontFile the file to load the font from 179 179 * … … 192 192 193 193 /** 194 * sets the size of the text and spacing194 * @brief sets the size of the text and spacing 195 195 * @param textSize the size of the Text in Pixels 196 196 * @param lineSpacing the size of the Spacing between two lines in pixels -
trunk/src/lib/shell/shell_command.cc
r7331 r7340 44 44 this->executor->setName(commandName); 45 45 46 // this->classID = classID;46 // this->classID = classID; 47 47 this->shellClass = ShellCommandClass::getCommandClass(className); //ClassList::IDToString(classID); 48 48 if (this->shellClass != NULL) … … 83 83 { 84 84 /// FIXME 85 /* if (ShellCommandClass::commandClassList == NULL)86 ShellCommandClass::initCommandClassList();87 88 const ShellCommandClass* checkClass = ShellCommandClass::isRegistered(className);89 90 if (checkClass != NULL)91 {92 std::list<ShellCommand*>::iterator elem;93 for (elem = checkClass->commandList.begin(); elem != checkClass->commandList.end(); elem++)94 {95 if (!strcmp(commandName, (*elem)->getName()))96 {97 delete (*elem);98 checkClass->commandList.remove(*elem);99 break;100 }101 }102 103 if (checkClass->commandList->size() == 0)104 {105 ShellCommandClass::commandClassList->remove(checkClass);106 delete checkClass;107 }108 }*/85 /* if (ShellCommandClass::commandClassList == NULL) 86 ShellCommandClass::initCommandClassList(); 87 88 const ShellCommandClass* checkClass = ShellCommandClass::isRegistered(className); 89 90 if (checkClass != NULL) 91 { 92 std::list<ShellCommand*>::iterator elem; 93 for (elem = checkClass->commandList.begin(); elem != checkClass->commandList.end(); elem++) 94 { 95 if (!strcmp(commandName, (*elem)->getName())) 96 { 97 delete (*elem); 98 checkClass->commandList.remove(*elem); 99 break; 100 } 101 } 102 103 if (checkClass->commandList->size() == 0) 104 { 105 ShellCommandClass::commandClassList->remove(checkClass); 106 delete checkClass; 107 } 108 }*/ 109 109 } 110 110 … … 138 138 } 139 139 } 140 return false;140 return false; 141 141 } 142 142 else … … 161 161 BaseObject* objectPointer = NULL; //< a pointer to th Object to Execute the command on 162 162 bool emptyComplete = false; //< if the completion input is empty string. e.g "" 163 unsigned int fktPos = 1; //< the position of the function (needed for finding it) 164 // long completeType = SHELLC_NONE; //< the Type we'd like to complete. 165 SubString inputSplits(executionString, " \t\n,"); 166 167 if (inputSplits.size() == 0) 168 return false; 163 // long completeType = SHELLC_NONE; //< the Type we'd like to complete. 164 SubString inputSplits(executionString, SubString::WhiteSpacesWithComma); 165 166 167 // if we do not have any input return 168 if (inputSplits.empty()) 169 return false; 170 171 // if we only have one input (!MUST BE AN ALIAS) 169 172 if (inputSplits.size() >= 1) 170 173 { … … 181 184 if (objectList != NULL) 182 185 { 183 if (inputSplits.size() > 1) 184 { 185 186 (*(*alias)->getCommand()->executor)(objectList->front(), inputSplits.getSubSet(1).join()); /// TODO CHECK IF OK 187 } 188 else 189 (*(*alias)->getCommand()->executor)(objectList->front(), ""); 190 return true; 186 (*(*alias)->getCommand()->executor)(objectList->front(), inputSplits.getSubSet(1).join()); /// TODO CHECK IF OK 187 return true; 191 188 } 192 } 193 } 194 } 189 /// TODO CHECK FOR STATIC functions. 190 } 191 } 192 } 193 195 194 // looking for a Matching Class 196 195 if (likely(ShellCommandClass::commandClassList != NULL)) … … 199 198 for (commandClassIT = ShellCommandClass::commandClassList->begin(); commandClassIT != ShellCommandClass::commandClassList->end(); commandClassIT++) 200 199 { 201 if ((*commandClassIT)->getName() && inputSplits .getString(0)== (*commandClassIT)->getName())200 if ((*commandClassIT)->getName() && inputSplits[0] == (*commandClassIT)->getName()) 202 201 { 203 202 //elemCL->getName(); … … 210 209 } 211 210 211 // Second Agument. (either Object, or Function) 212 212 if (commandClass != NULL && inputSplits.size() >= 2) 213 213 { 214 int fktPos = 1; // The position of the Function (either at pos 1, or 2) 215 // If we have an ObjectList. 214 216 if (objectList != NULL) 215 217 { … … 218 220 for (object = objectList->begin(); object != objectList->end(); object++) 219 221 { 220 if ((*object)->getName() != NULL && inputSplits .getString(1) == (*object)->getName())222 if ((*object)->getName() != NULL && inputSplits[1] == (*object)->getName()) 221 223 { 222 224 objectPointer = (*object); … … 224 226 break; 225 227 } 226 227 228 //228 } 229 230 // if we did not find an Object with matching name, take the first. 229 231 if (objectPointer == NULL) 230 232 objectPointer = objectList->front(); 231 233 } 234 232 235 // match a function. 233 236 if (commandClass != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.size() >= 3))) … … 236 239 for (cmdIT = commandClass->commandList.begin(); cmdIT != commandClass->commandList.end(); cmdIT++) 237 240 { 238 if (inputSplits .getString(fktPos)== (*cmdIT)->getName())241 if (inputSplits[fktPos] == (*cmdIT)->getName()) 239 242 { 240 243 if (objectPointer == NULL && (*cmdIT)->executor->getType() & Executor_Objective) 241 244 return false; 242 if (inputSplits.size() > fktPos+1)243 (*(*cmdIT)->executor)(objectPointer, inputSplits.getSubSet(2).join()); /// TODO CHECK IF OK244 245 else 245 (*(*cmdIT)->executor)(objectPointer, ""); 246 return true; 246 { 247 (*(*cmdIT)->executor)(objectPointer, inputSplits.getSubSet(fktPos+1).join()); /// TODO CHECK IF OK 248 return true; 249 } 247 250 } 248 251 } … … 250 253 } 251 254 } 255 return false; 252 256 } 253 257 … … 260 264 if (this == NULL) 261 265 return NULL; 262 else263 {264 this->description = description;265 return this;266 }266 else 267 { 268 this->description = description; 269 return this; 270 } 267 271 } 268 272 … … 302 306 */ 303 307 ShellCommand* ShellCommand::defaultValues(const MultiType& value0, const MultiType& value1, 304 305 308 const MultiType& value2, const MultiType& value3, 309 const MultiType& value4) 306 310 { 307 311 if (this == NULL || this->executor == NULL)
Note: See TracChangeset
for help on using the changeset viewer.