Changeset 842 for trunk/source/intercoms/src/G4UIcommandTree.cc
- Timestamp:
- Jun 11, 2008, 4:16:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/intercoms/src/G4UIcommandTree.cc
r821 r842 25 25 // 26 26 // 27 // $Id: G4UIcommandTree.cc,v 1.1 3 2006/06/29 19:08:58 gunter Exp $28 // GEANT4 tag $Name: geant4-09-01-patch-02$27 // $Id: G4UIcommandTree.cc,v 1.14 2008/01/30 11:20:03 lgarnier Exp $ 28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 … … 156 156 } 157 157 158 // L. Garnier 01.28.08 This function has not a good name. In fact, it try 159 // to match a command name, not a path. It should be rename as FindCommandName 160 158 161 G4UIcommand * G4UIcommandTree::FindPath(const char* commandPath) 159 162 { … … 183 186 if( nextPath == tree[i_thTree]->GetPathName() ) 184 187 { return tree[i_thTree]->FindPath( commandPath ); } 188 } 189 } 190 return NULL; 191 } 192 193 194 /** 195 * Try to match a command or a path with the one given. 196 * @commandPath : command or path to match 197 * @return the commandTree found or NULL if not 198 */ 199 G4UIcommandTree * G4UIcommandTree::FindCommandTree(const char* commandPath) 200 { 201 G4String remainingPath = commandPath; 202 if( remainingPath.index( pathName ) == std::string::npos ) 203 { return NULL; } 204 remainingPath.remove(0,pathName.length()); 205 G4int i = remainingPath.first('/'); 206 if( i != G4int(std::string::npos) ) 207 { 208 // Find path 209 G4String nextPath = pathName; 210 nextPath.append(remainingPath(0,i+1)); 211 G4int n_treeEntry = tree.size(); 212 for( G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ ) 213 { 214 if (tree[i_thTree]->GetPathName() == commandPath) { 215 return tree[i_thTree]; 216 } 217 else if( nextPath == tree[i_thTree]->GetPathName() ) { 218 return tree[i_thTree]->FindCommandTree( commandPath ); 219 } 185 220 } 186 221 }
Note: See TracChangeset
for help on using the changeset viewer.