Changeset 1031 for trunk


Ignore:
Timestamp:
May 6, 2009, 5:55:16 PM (15 years ago)
Author:
garnier
Message:

en test before cvs

Location:
trunk/source/intercoms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/intercoms/include/G4UIcommandTree.hh

    r1027 r1031  
    5757      G4UIcommand * FindPath(const char* commandPath);
    5858      G4UIcommandTree * FindCommandTree(const char* commandPath);
    59   G4String CompleteCommandPath(const G4String commandPath);
     59      G4String CompleteCommandPath(const G4String commandPath);
    6060      // Complete most available caracters in common into command path in the command line
    6161      // given
     
    6969      G4String CreateFileName(const char* pName);
    7070      G4String ModStr(const char* strS);
    71   G4String GetFirstMatchedString(const G4String&,const G4String&) const;
     71      G4String GetFirstMatchedString(const G4String&,const G4String&) const;
    7272
    7373      std::vector<G4UIcommand*> command;
  • trunk/source/intercoms/src/G4UIcommandTree.cc

    r1027 r1031  
    199199G4UIcommandTree * G4UIcommandTree::FindCommandTree(const char* commandPath)
    200200{
    201   printf("G4UIcommandTree::FindCommandTree %s\n",commandPath);
    202201  G4String remainingPath = commandPath;
    203202  if( remainingPath.index( pathName ) == std::string::npos )
     
    228227G4String G4UIcommandTree::CompleteCommandPath(const G4String aCommandPath)
    229228{
    230 #ifdef G4DEBUG
    231   printf("G4UIcommandTree::FindMatchingPath %s\n",aCommandPath.c_str());
    232 #endif
    233229  G4String pathName = aCommandPath;
    234230  G4String remainingPath = aCommandPath;
     
    246242  if( pathName.index( pathName ) == std::string::npos ) return empty;
    247243
    248 #ifdef G4DEBUG
    249   printf("G4UIcommandTree::FindMatchingPath remainingPath:%s\n",remainingPath.c_str());
    250 #endif
    251 
    252244  std::vector<G4String> paths;
    253245
     
    262254  for(G4int idir=1; idir<=Ndir; idir++) {
    263255    G4String fpdir= aTree-> GetTree(idir)-> GetPathName();
    264 #ifdef G4DEBUG
    265     printf("G4UIcommandTree::FindMatchingPath command %d/%d %s\n",idir,Ndir,fpdir.c_str());
    266 #endif
    267256    // matching test
    268257    if( fpdir.index(remainingPath, 0) == 0) {
    269258      if(nMatch==0) {
    270 #ifdef G4DEBUG
    271         printf("G4UIcommandTree::FindMatchingPath directory match0 :%d\n",nMatch);
    272 #endif
    273259        stream = fpdir;
    274260      } else {
    275 #ifdef G4DEBUG
    276         printf("G4UIcommandTree::FindMatchingPath directory match+ :%d\n",nMatch);
    277 #endif
    278261        stream = GetFirstMatchedString(fpdir,stream);
    279 #ifdef G4DEBUG
    280         printf("G4UIcommandTree::FindMatchingPath directory match++++ :%s\n",stream.c_str());
    281 #endif
    282262      }
    283263      nMatch++;
     
    302282    if( fpcmd.index(remainingPath, 0) ==0) {
    303283      if(nMatch==0) {
    304 #ifdef G4DEBUG
    305         printf("G4UIcommandTree::FindMatchingPath command match0 :%d\n",nMatch);
    306 #endif
    307284        stream= fpcmd + " ";
    308285      } else {
    309 #ifdef G4DEBUG
    310         printf("G4UIcommandTree::FindMatchingPath command match0 :%d\n",nMatch);
    311 #endif
    312286        strtmp= fpcmd + " ";
    313287        stream= GetFirstMatchedString(stream, strtmp);
     
    325299  }
    326300
    327 
    328 
    329 
    330 //   if( remainingPath == std::string::npos ) {
    331 // #ifdef G4DEBUG
    332 //     printf("G4UIcommandTree::FindMatchingPath npos \n");
    333 // #endif
    334 //     // 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 G4DEBUG
    342 //       printf("look for command check %s %s \n",ss.c_str(),remainingPath.c_str());
    343 // #endif
    344 //     }
    345 //     n_commandEntry = commands.size();
    346 // #ifdef G4DEBUG
    347 //       printf("%d found\n",n_commandEntry);
    348 // #endif
    349 //     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 path
    385 //     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();
    396301  return stream;
    397302}
     
    419324  return strMatched;
    420325}
    421 
    422 
    423 
    424326
    425327void G4UIcommandTree::ListCurrent()
Note: See TracChangeset for help on using the changeset viewer.