42 pathName = thePathName;
48 G4int n_treeEntry = tree.size();
49 for( i=0; i < n_treeEntry; i++ )
66 G4String remainingPath = commandPath;
67 remainingPath.
remove(0,pathName.length());
68 if( remainingPath.
isNull() )
70 guidance = newCommand;
74 if( i ==
G4int(std::string::npos) )
77 G4int n_commandEntry = command.size();
78 for(
G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
80 if( remainingPath == command[i_thCommand]->GetCommandName() )
83 command.push_back( newCommand );
90 nextPath.
append(remainingPath(0,i+1));
91 G4int n_treeEntry = tree.size();
92 for(
G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
96 tree[i_thTree]->AddNewCommand( newCommand );
101 tree.push_back( newTree );
110 G4String remainingPath = commandPath;
111 remainingPath.
remove(0,pathName.length());
112 if( remainingPath.
isNull() )
119 if( i ==
G4int(std::string::npos) )
122 G4int n_commandEntry = command.size();
123 for(
G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
125 if( remainingPath == command[i_thCommand]->GetCommandName() )
127 command.erase(command.begin()+i_thCommand);
136 nextPath.
append(remainingPath(0,i+1));
137 G4int n_treeEntry = tree.size();
138 for(
G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
142 tree[i_thTree]->RemoveCommand( aCommand );
143 G4int n_commandRemain = tree[i_thTree]->GetCommandEntry();
145 if(n_commandRemain == 0 && n_treeRemain == 0)
148 tree.erase(tree.begin()+i_thTree);
163 G4String remainingPath = commandPath;
164 if( remainingPath.
index( pathName ) == std::string::npos )
166 remainingPath.
remove(0,pathName.length());
168 if( i ==
G4int(std::string::npos) )
171 G4int n_commandEntry = command.size();
172 for(
G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
174 if( remainingPath == command[i_thCommand]->GetCommandName() )
175 {
return command[i_thCommand]; }
182 nextPath.
append(remainingPath(0,i+1));
183 G4int n_treeEntry = tree.size();
184 for(
G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
187 {
return tree[i_thTree]->FindPath( commandPath ); }
201 G4String remainingPath = commandPath;
202 if( remainingPath.
index( pathName ) == std::string::npos )
204 remainingPath.
remove(0,pathName.length());
206 if( i !=
G4int(std::string::npos) )
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++ )
214 if (tree[i_thTree]->
GetPathName() == commandPath) {
215 return tree[i_thTree];
217 else if( nextPath == tree[i_thTree]->
GetPathName() ) {
218 return tree[i_thTree]->FindCommandTree( commandPath );
230 G4String remainingPath = aCommandPath;
236 if(jpre !=
G4int(G4String::npos)) pName.
remove(jpre+1);
243 if( pName.
index( pName ) == std::string::npos )
return empty;
245 std::vector<G4String> paths;
255 for(
G4int idir=1; idir<=Ndir; idir++) {
258 if( fpdir.
index(remainingPath, 0) == 0) {
260 matchingPath = fpdir;
262 matchingPath = GetFirstMatchedString(fpdir,matchingPath);
265 paths.push_back(fpdir);
269 if (paths.size()>=2) {
271 for(
unsigned int i_thCommand = 0; i_thCommand < paths.size(); i_thCommand++ ) {
277 std::vector<G4String> commands;
279 for(
G4int icmd=1; icmd<=Ncmd; icmd++){
283 if( fpcmd.
index(remainingPath, 0) ==0) {
285 matchingPath= fpcmd +
" ";
288 matchingPath= GetFirstMatchedString(matchingPath, strtmp);
291 commands.push_back(fpcmd+
" ");
295 if (commands.size()>=2) {
297 for(
unsigned int i_thCommand = 0; i_thCommand < commands.size(); i_thCommand++ ) {
311 int nlen1= str1.length();
312 int nlen2= str2.length();
314 int nmin = nlen1<nlen2 ? nlen1 : nlen2;
317 for(
size_t i=0;
G4int(i)<nmin; i++){
318 if(str1[i]==str2[i]) {
319 strMatched+= str1[i];
330 G4cout <<
"Command directory path : " << pathName <<
G4endl;
331 if( guidance != NULL ) guidance->
List();
333 G4int n_treeEntry = tree.size();
334 for(
G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
336 G4cout <<
" " << tree[i_thTree]->GetPathName()
337 <<
" " << tree[i_thTree]->GetTitle() <<
G4endl;
340 G4int n_commandEntry = command.size();
341 for(
G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
343 G4cout <<
" " << command[i_thCommand]->GetCommandName()
344 <<
" * " << command[i_thCommand]->GetTitle() <<
G4endl;
350 G4cout <<
"Command directory path : " << pathName <<
G4endl;
351 if( guidance != NULL ) guidance->
List();
354 G4int n_treeEntry = tree.size();
355 for(
G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
358 G4cout <<
" " << i <<
") " << tree[i_thTree]->GetPathName()
359 <<
" " << tree[i_thTree]->GetTitle() <<
G4endl;
362 G4int n_commandEntry = command.size();
363 for(
G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
366 G4cout <<
" " << i <<
") " << command[i_thCommand]->GetCommandName()
367 <<
" * " << command[i_thCommand]->GetTitle() <<
G4endl;
374 G4int n_commandEntry = command.size();
375 for(
G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
377 command[i_thCommand]->List();
379 G4int n_treeEntry = tree.size();
380 for(
G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
382 tree[i_thTree]->List();
386G4String G4UIcommandTree::CreateFileName(
const char* pName)
390 while((idxs=fn.
index(
"/"))!=
G4int(std::string::npos))
396G4String G4UIcommandTree::ModStr(
const char* strS)
410 sx +=
"&";
break;
420 G4String ofileName = CreateFileName(pathName);
421 std::ofstream oF(ofileName, std::ios::out);
423 oF <<
"<html><head><title>Commands in " << ModStr(pathName) <<
"</title></head>" <<
G4endl;
424 oF <<
"<body bgcolor=\"#ffffff\"><h2>" << ModStr(pathName) <<
"</h2><p>" <<
G4endl;
426 if( guidance != NULL )
432 oF <<
"<p><hr><p>" <<
G4endl;
434 oF <<
"<h2>Sub-directories : </h2><dl>" <<
G4endl;
435 for(
G4int i_thTree = 0; i_thTree <
G4int(tree.size()); i_thTree++ )
437 oF <<
"<p><br><p><dt><a href=\"" << CreateFileName(tree[i_thTree]->
GetPathName())
440 tree[i_thTree]->CreateHTML();
443 oF <<
"</dl><p><hr><p>" <<
G4endl;
445 oF <<
"<h2>Commands : </h2><dl>" <<
G4endl;
446 for(
G4int i_thCommand = 0; i_thCommand <
G4int(command.size()); i_thCommand++ )
456 oF <<
"<p><dd>" <<
G4endl;
461 std::vector<G4ApplicationState>* availabelStateList = cmd->
GetStateList();
462 if(availabelStateList->size()==6)
463 { oF <<
"<p><dd>Available at all Geant4 states." <<
G4endl; }
466 oF <<
"<p><dd>Available Geant4 state(s) : ";
467 for(
G4int ias=0;ias<
G4int(availabelStateList->size());ias++)
472 oF <<
"<p><dd>Parameters<table border=1>" <<
G4endl;
481 oF <<
"Omittable : ";
483 { oF <<
"current value is used as the default value." <<
G4endl; }
493 oF <<
"</table>" <<
G4endl;
498 oF <<
"</dl></body></html>" <<
G4endl;
G4DLLIMPORT std::ostream G4cout
static G4StateManager * GetStateManager()
G4String GetStateString(G4ApplicationState aState) const
G4String & remove(str_size)
G4String & append(const G4String &)
str_size index(const char *, G4int pos=0) const
G4int GetCommandEntry() const
G4int operator!=(const G4UIcommandTree &right) const
G4UIcommand * GetCommand(G4int i)
G4int GetTreeEntry() const
const G4String GetPathName() const
G4UIcommandTree * GetTree(G4int i)
void RemoveCommand(G4UIcommand *aCommand)
G4int operator==(const G4UIcommandTree &right) const
G4UIcommandTree * FindCommandTree(const char *commandPath)
void ListCurrentWithNum() const
const G4String GetTitle() const
G4String CompleteCommandPath(const G4String &commandPath)
G4UIcommand * FindPath(const char *commandPath) const
void AddNewCommand(G4UIcommand *newCommand)
const G4String & GetGuidanceLine(G4int i) const
G4UIparameter * GetParameter(G4int i) const
G4int GetGuidanceEntries() const
const G4String & GetCommandPath() const
G4int GetParameterEntries() const
std::vector< G4ApplicationState > * GetStateList()
const G4String & GetCommandName() const
const G4String & GetRange() const
G4String GetParameterRange() const
G4String GetDefaultValue() const
G4bool IsOmittable() const
G4String GetParameterCandidates() const
G4bool GetCurrentAsDefault() const
char GetParameterType() const
G4String GetParameterName() const