Changeset 1031 for trunk/source/intercoms/src
- Timestamp:
- May 6, 2009, 5:55:16 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/intercoms/src/G4UIcommandTree.cc
r1027 r1031 199 199 G4UIcommandTree * G4UIcommandTree::FindCommandTree(const char* commandPath) 200 200 { 201 printf("G4UIcommandTree::FindCommandTree %s\n",commandPath);202 201 G4String remainingPath = commandPath; 203 202 if( remainingPath.index( pathName ) == std::string::npos ) … … 228 227 G4String G4UIcommandTree::CompleteCommandPath(const G4String aCommandPath) 229 228 { 230 #ifdef G4DEBUG231 printf("G4UIcommandTree::FindMatchingPath %s\n",aCommandPath.c_str());232 #endif233 229 G4String pathName = aCommandPath; 234 230 G4String remainingPath = aCommandPath; … … 246 242 if( pathName.index( pathName ) == std::string::npos ) return empty; 247 243 248 #ifdef G4DEBUG249 printf("G4UIcommandTree::FindMatchingPath remainingPath:%s\n",remainingPath.c_str());250 #endif251 252 244 std::vector<G4String> paths; 253 245 … … 262 254 for(G4int idir=1; idir<=Ndir; idir++) { 263 255 G4String fpdir= aTree-> GetTree(idir)-> GetPathName(); 264 #ifdef G4DEBUG265 printf("G4UIcommandTree::FindMatchingPath command %d/%d %s\n",idir,Ndir,fpdir.c_str());266 #endif267 256 // matching test 268 257 if( fpdir.index(remainingPath, 0) == 0) { 269 258 if(nMatch==0) { 270 #ifdef G4DEBUG271 printf("G4UIcommandTree::FindMatchingPath directory match0 :%d\n",nMatch);272 #endif273 259 stream = fpdir; 274 260 } else { 275 #ifdef G4DEBUG276 printf("G4UIcommandTree::FindMatchingPath directory match+ :%d\n",nMatch);277 #endif278 261 stream = GetFirstMatchedString(fpdir,stream); 279 #ifdef G4DEBUG280 printf("G4UIcommandTree::FindMatchingPath directory match++++ :%s\n",stream.c_str());281 #endif282 262 } 283 263 nMatch++; … … 302 282 if( fpcmd.index(remainingPath, 0) ==0) { 303 283 if(nMatch==0) { 304 #ifdef G4DEBUG305 printf("G4UIcommandTree::FindMatchingPath command match0 :%d\n",nMatch);306 #endif307 284 stream= fpcmd + " "; 308 285 } else { 309 #ifdef G4DEBUG310 printf("G4UIcommandTree::FindMatchingPath command match0 :%d\n",nMatch);311 #endif312 286 strtmp= fpcmd + " "; 313 287 stream= GetFirstMatchedString(stream, strtmp); … … 325 299 } 326 300 327 328 329 330 // if( remainingPath == std::string::npos ) {331 // #ifdef G4DEBUG332 // printf("G4UIcommandTree::FindMatchingPath npos \n");333 // #endif334 // // Look for number of matching commands :335 // G4int n_commandEntry = aTree->GetCommandEntry();336 // for( G4int i_thCommand = 1; i_thCommand <= n_commandEntry; i_thCommand++ ) {337 // G4UIcommand* cmd = aTree->GetCommand(i_thCommand);338 // G4String ss = cmd->GetCommandName();339 // ss.resize(remainingPath.length());340 // if( remainingPath == ss ) commands.push_back(cmd);341 // #ifdef G4DEBUG342 // printf("look for command check %s %s \n",ss.c_str(),remainingPath.c_str());343 // #endif344 // }345 // n_commandEntry = commands.size();346 // #ifdef G4DEBUG347 // printf("%d found\n",n_commandEntry);348 // #endif349 // if(n_commandEntry==1) {350 // return (pathName + commands[0]->GetCommandName());351 // } else if (n_commandEntry>=2) {352 // G4cout << "Matching commands :" << G4endl;353 // for( G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ ) {354 // G4UIcommand* cmd = commands[i_thCommand];355 // G4cout << cmd->GetCommandName() << G4endl;356 // }357 // return empty;358 // }359 // // Look for sub tree :360 // std::vector<G4UIcommandTree*> trees;361 // G4String nextPath = pathName;362 // nextPath.append(remainingPath);363 // G4int n_treeEntry = aTree->GetTreeEntry();364 // for( G4int i_thTree = 1; i_thTree <= n_treeEntry; i_thTree++ ) {365 // G4UIcommandTree* tree = aTree->GetTree(i_thTree);366 // G4String ss = tree->GetPathName();367 // ss.resize(nextPath.length());368 // if( nextPath == ss ) trees.push_back(tree);369 // }370 // n_treeEntry = trees.size();371 // if(n_treeEntry==1) {372 // return trees[0]->GetPathName();373 // } else if (n_treeEntry>=2) {374 // G4cout << "Matching directories :" << G4endl;375 // for( G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ ) {376 // G4UIcommandTree* tree = trees[i_thTree];377 // G4cout << tree->GetPathName() << G4endl;378 // }379 // return empty;380 // } else {381 // return empty; // No match.382 // }383 // } else {384 // // Find path385 // G4String nextPath = pathName;386 // nextPath.append(remainingPath(0,i+1));387 // G4int n_treeEntry = aTree->GetTreeEntry();388 // for( G4int i_thTree = 1; i_thTree <= n_treeEntry; i_thTree++ ) {389 // G4UIcommandTree* tree = aTree->GetTree(i_thTree);390 // if( nextPath == tree->GetPathName() ) {391 // return tree->CompleteCommandPath(pathName );392 // }393 // }394 // }395 // n_commandEntry = commands.size();396 301 return stream; 397 302 } … … 419 324 return strMatched; 420 325 } 421 422 423 424 326 425 327 void G4UIcommandTree::ListCurrent()
Note: See TracChangeset
for help on using the changeset viewer.