#include <G4UIcsh.hh>
Inheritance diagram for G4UIcsh:
Public Member Functions | |
G4UIcsh (const G4String &prompt="%s> ") | |
~G4UIcsh () | |
virtual G4String | GetCommandLineString (const char *msg=0) |
Definition at line 40 of file G4UIcsh.hh.
G4UIcsh::G4UIcsh | ( | const G4String & | prompt = "%s> " |
) |
G4UIcsh::~G4UIcsh | ( | ) |
G4String G4UIcsh::GetCommandLineString | ( | const char * | msg = 0 |
) | [virtual] |
Implements G4VUIshell.
Definition at line 47 of file G4UIcsh.cc.
References G4String::append(), FALSE, G4cin, G4cout, G4VUIshell::MakePrompt(), G4VUIshell::promptString, G4String::readLine(), G4String::remove(), and G4String::strip().
00049 { 00050 MakePrompt(msg); 00051 G4cout << promptString << std::flush; 00052 00053 G4String newCommand; 00054 newCommand.readLine(G4cin, FALSE); 00055 if (!G4cin.good()) { 00056 G4cin.clear(); 00057 newCommand= "exit"; 00058 return newCommand; 00059 } 00060 newCommand = newCommand.strip(1,'\r'); // fix for odd behavior on Windows 00061 00062 // multi-line 00063 while( (newCommand.length() > 0) && 00064 (newCommand[newCommand.length()-1] == '_') ) { 00065 G4String newLine; 00066 newCommand.remove(newCommand.length()-1); 00067 newLine.readLine(G4cin, FALSE); 00068 if (!G4cin.good()) { 00069 G4cin.clear(); 00070 newCommand= "exit"; 00071 return newCommand; 00072 } 00073 newCommand.append(newLine); 00074 } 00075 00076 return newCommand; 00077 }