G4UIcsh Class Reference

#include <G4UIcsh.hh>

Inheritance diagram for G4UIcsh:

G4VUIshell

Public Member Functions

 G4UIcsh (const G4String &prompt="%s> ")
 ~G4UIcsh ()
virtual G4String GetCommandLineString (const char *msg=0)

Detailed Description

Definition at line 40 of file G4UIcsh.hh.


Constructor & Destructor Documentation

G4UIcsh::G4UIcsh ( const G4String prompt = "%s> "  ) 

Definition at line 33 of file G4UIcsh.cc.

00034  : G4VUIshell(prompt)
00036 {
00037 }

G4UIcsh::~G4UIcsh (  ) 

Definition at line 40 of file G4UIcsh.cc.

00042 {
00043 }


Member Function Documentation

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 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:36 2013 for Geant4 by  doxygen 1.4.7