#include <G4VBasicShell.hh>
Definition at line 52 of file G4VBasicShell.hh.
◆ G4VBasicShell()
G4VBasicShell::G4VBasicShell |
( |
| ) |
|
◆ ~G4VBasicShell()
G4VBasicShell::~G4VBasicShell |
( |
| ) |
|
|
virtual |
◆ ApplyShellCommand()
void G4VBasicShell::ApplyShellCommand |
( |
const G4String & |
a_string, |
|
|
G4bool & |
exitSession, |
|
|
G4bool & |
exitPause |
|
) |
| |
|
protected |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition at line 227 of file G4VBasicShell.cc.
239 if( command(0) ==
'#' ) {
243 }
else if( command ==
"ls" || command(0,3) ==
"ls " ) {
247 }
else if( command ==
"pwd" ) {
249 G4cout <<
"Current Working Directory : " 252 }
else if( command ==
"cd" || command(0,3) ==
"cd ") {
256 }
else if( command ==
"help" || command(0,5) ==
"help ") {
260 }
else if( command(0) ==
'?' ) {
264 }
else if( command ==
"hist" || command ==
"history") {
267 for(
G4int i=0;i<nh;i++) {
271 }
else if( command(0) ==
'!' ) {
273 G4String ss = command(1,command.length()-1);
276 std::istringstream is(tt);
284 G4cerr <<
"history " << vl <<
" is not found." <<
G4endl;
287 }
else if( command ==
"exit" ) {
289 if( exitPause ==
false) {
291 G4cout <<
"Please abort it using \"/run/abort\" command first" <<
G4endl;
292 G4cout <<
" and use \"continue\" command until the application" <<
G4endl;
298 }
else if( command ==
"cont" || command ==
"continue"){
void ChangeDirectoryCommand(const G4String &)
void TerminalHelp(const G4String &)
G4String strip(G4int strip_Type=trailing, char c=' ')
void ShowCurrent(const G4String &) const
static G4UImanager * GetUIpointer()
G4String GetCurrentWorkingDirectory() const
G4GLOB_DLL std::ostream G4cout
G4String ModifyToFullPathCommand(const char *aCommandLine) const
virtual void ExecuteCommand(const G4String &)
G4int GetNumberOfHistory() const
void ListDirectory(const G4String &) const
G4String GetPreviousCommand(G4int i) const
G4GLOB_DLL std::ostream G4cerr
◆ ChangeDirectory()
G4bool G4VBasicShell::ChangeDirectory |
( |
const char * |
newDir | ) |
|
|
protected |
Definition at line 75 of file G4VBasicShell.cc.
80 if( newDirectory( newDirectory.length() - 1 ) !=
'/' )
81 { newDirectory +=
"/"; }
G4String strip(G4int strip_Type=trailing, char c=' ')
G4String currentDirectory
G4String ModifyPath(const G4String &tempPath) const
G4UIcommandTree * FindDirectory(const char *dirName) const
◆ ChangeDirectoryCommand()
void G4VBasicShell::ChangeDirectoryCommand |
( |
const G4String & |
newCommand | ) |
|
|
protected |
Definition at line 321 of file G4VBasicShell.cc.
324 if( newCommand.length() <= 3 ) {
327 G4String aNewPrefix = newCommand.substr(3, newCommand.length()-3);
331 G4cout <<
"directory <" << prefix <<
"> not found." <<
G4endl;
G4String strip(G4int strip_Type=trailing, char c=' ')
G4GLOB_DLL std::ostream G4cout
G4bool ChangeDirectory(const char *newDir)
◆ Complete()
Definition at line 176 of file G4VBasicShell.cc.
178 G4String rawCommandLine = commandName;
180 size_t i = commandLine.
index(
" ");
181 if( i != std::string::npos )
return rawCommandLine;
183 G4String commandString = commandLine;
187 if(value==
"")
return rawCommandLine;
G4String strip(G4int strip_Type=trailing, char c=' ')
G4String FindMatchingPath(G4UIcommandTree *, const G4String &)
str_size index(const char *, G4int pos=0) const
static G4UImanager * GetUIpointer()
G4UIcommandTree * GetTree() const
G4String ModifyPath(const G4String &tempPath) const
◆ ExecuteCommand()
void G4VBasicShell::ExecuteCommand |
( |
const G4String & |
aCommand | ) |
|
|
protectedvirtual |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Reimplemented in G4UIGainServer, and G4UIterminal.
Definition at line 201 of file G4VBasicShell.cc.
206 if(aCommand.length()<2)
return;
210 switch(commandStatus) {
214 G4cerr <<
"command not found: " <<
"\"" << aCommand <<
"\"" <<
G4endl;
217 G4cerr <<
"illegal application state -- command refused:" <<
"\"" << aCommand <<
"\"" <<
G4endl;
223 G4cerr <<
"command refused (" << commandStatus <<
"):" <<
"\"" << aCommand <<
"\"" <<
G4endl;
static G4UImanager * GetUIpointer()
G4int ApplyCommand(const char *aCommand)
G4GLOB_DLL std::ostream G4cerr
◆ ExitHelp()
virtual void G4VBasicShell::ExitHelp |
( |
| ) |
const |
|
protectedpure virtual |
◆ FindCommand()
G4UIcommand * G4VBasicShell::FindCommand |
( |
const char * |
commandName | ) |
const |
|
protected |
Definition at line 110 of file G4VBasicShell.cc.
112 G4String rawCommandLine = commandName;
115 size_t i = commandLine.
index(
" ");
116 if( i != std::string::npos )
117 { commandString = commandLine(0,i); }
119 { commandString = commandLine; }
G4String strip(G4int strip_Type=trailing, char c=' ')
str_size index(const char *, G4int pos=0) const
static G4UImanager * GetUIpointer()
G4UIcommandTree * GetTree() const
G4UIcommand * FindPath(const char *commandPath) const
G4String ModifyPath(const G4String &tempPath) const
◆ FindDirectory()
G4UIcommandTree * G4VBasicShell::FindDirectory |
( |
const char * |
dirName | ) |
const |
|
protected |
Definition at line 88 of file G4VBasicShell.cc.
93 if( targetDir( targetDir.length()-1 ) !=
'/' )
96 if( targetDir ==
"/" )
99 while( idx < targetDir.length()-1 )
101 size_t i = targetDir.
index(
"/",idx);
102 comTree = comTree->
GetTree(targetDir.substr(0,i+1).c_str());
103 if( comTree == NULL )
G4String strip(G4int strip_Type=trailing, char c=' ')
str_size index(const char *, G4int pos=0) const
static G4UImanager * GetUIpointer()
G4UIcommandTree * GetTree(G4int i)
G4UIcommandTree * GetTree() const
G4String ModifyPath(const G4String &tempPath) const
◆ FindMatchingPath()
Definition at line 191 of file G4VBasicShell.cc.
194 return aTree-> CompleteCommandPath(aCommandPath);
◆ GetCurrentWorkingDirectory()
G4String G4VBasicShell::GetCurrentWorkingDirectory |
( |
| ) |
const |
|
protected |
◆ GetHelpChoice()
virtual G4bool G4VBasicShell::GetHelpChoice |
( |
G4int & |
| ) |
|
|
protectedpure virtual |
◆ ListDirectory()
void G4VBasicShell::ListDirectory |
( |
const G4String & |
newCommand | ) |
const |
|
protected |
Definition at line 335 of file G4VBasicShell.cc.
338 if( newCommand.length() <= 3 ) {
341 G4String newPrefix = newCommand.substr(3, newCommand.length()-3);
345 if( commandTree == NULL ) {
346 G4cout <<
"Directory <" << targetDir <<
"> is not found." <<
G4endl;
G4String strip(G4int strip_Type=trailing, char c=' ')
G4String GetCurrentWorkingDirectory() const
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * FindDirectory(const char *dirName) const
◆ ModifyPath()
Definition at line 125 of file G4VBasicShell.cc.
127 if( tempPath.length() == 0 )
return tempPath;
132 if( tempPath(0) ==
'/') newPath = tempPath;
137 size_t idx = newPath.find(
"/./");
138 if( idx == G4String::npos)
break;
139 newPath.erase(idx,2);
143 size_t idx = newPath.find(
"/../");
144 if( idx == G4String::npos)
break;
149 size_t idx2 = newPath.find_last_of(
'/', idx-1);
150 if(idx2 != G4String::npos) newPath.erase(idx2, idx-idx2+3);
154 if(newPath(newPath.size()-3,3) ==
"/..") {
155 if( newPath.size() == 3) {
158 size_t idx = newPath.find_last_of(
'/', newPath.size()-4);
159 if(idx != G4String::npos) newPath.erase(idx+1);
162 if(newPath(newPath.size()-2,2) ==
"/.") newPath.erase(newPath.size()-1,1);
166 size_t idx = newPath.find(
"//");
167 if( idx == G4String::npos)
break;
168 newPath.erase(idx,1);
G4String currentDirectory
◆ ModifyToFullPathCommand()
G4String G4VBasicShell::ModifyToFullPathCommand |
( |
const char * |
aCommandLine | ) |
const |
|
protected |
Definition at line 48 of file G4VBasicShell.cc.
50 G4String rawCommandLine = aCommandLine;
51 if(rawCommandLine.
isNull()||rawCommandLine(0)==
'\0')
return rawCommandLine;
55 size_t i = commandLine.
index(
" ");
56 if( i != std::string::npos )
58 commandString = commandLine(0,i);
59 parameterString =
" ";
60 parameterString += commandLine(i+1,commandLine.length()-(i+1));
63 { commandString = commandLine; }
67 return fullPathCommandLine;
G4String strip(G4int strip_Type=trailing, char c=' ')
str_size index(const char *, G4int pos=0) const
G4String ModifyPath(const G4String &tempPath) const
◆ PauseSessionStart()
virtual void G4VBasicShell::PauseSessionStart |
( |
const G4String & |
Prompt | ) |
|
|
pure virtual |
◆ SessionStart()
◆ ShowCurrent()
void G4VBasicShell::ShowCurrent |
( |
const G4String & |
newCommand | ) |
const |
|
protected |
Definition at line 309 of file G4VBasicShell.cc.
313 G4String comString = newCommand.substr(1,newCommand.length()-1);
317 G4cout <<
"Current value(s) of the parameter(s) : " << curV <<
G4endl;
static G4UImanager * GetUIpointer()
G4GLOB_DLL std::ostream G4cout
G4String ModifyToFullPathCommand(const char *aCommandLine) const
G4String GetCurrentValues(const char *aCommand)
◆ TerminalHelp()
void G4VBasicShell::TerminalHelp |
( |
const G4String & |
newCommand | ) |
|
|
protected |
Definition at line 351 of file G4VBasicShell.cc.
356 size_t i = newCommand.
index(
" ");
357 if( i != std::string::npos )
359 G4String newValue = newCommand.substr(i+1, newCommand.length()-(i+1));
363 if( theCommand != NULL )
370 G4cout <<
"Command <" << newValue <<
" is not found." <<
G4endl;
378 size_t prefixIndex = 1;
380 while( prefixIndex < prefix.length()-1 )
382 size_t ii = prefix.
index(
"/",prefixIndex);
395 G4cout << G4endl <<
"Not a number, once more" <<
G4endl;
398 if( iFloor < (
size_t)-j ) iFloor = 0;
410 if( j <= n_tree + floor[iFloor]->GetCommandEntry() )
417 floor[iFloor+1] = floor[iFloor]->
GetTree(j);
virtual G4bool GetHelpChoice(G4int &)=0
virtual void ExitHelp() const =0
G4String strip(G4int strip_Type=trailing, char c=' ')
G4UIcommand * GetCommand(G4int i)
str_size index(const char *, G4int pos=0) const
static G4UImanager * GetUIpointer()
G4String GetCurrentWorkingDirectory() const
G4GLOB_DLL std::ostream G4cout
G4String ModifyToFullPathCommand(const char *aCommandLine) const
G4UIcommandTree * GetTree(G4int i)
G4UIcommandTree * GetTree() const
G4UIcommand * FindPath(const char *commandPath) const
G4int GetTreeEntry() const
void ListCurrentWithNum() const
◆ currentDirectory
G4String G4VBasicShell::currentDirectory |
|
private |
The documentation for this class was generated from the following files: