Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UIcsh Class Reference

#include <G4UIcsh.hh>

+ Inheritance diagram for G4UIcsh:

Public Member Functions

 G4UIcsh (const G4String &prompt="%s> ")
 
 ~G4UIcsh ()
 
virtual G4String GetCommandLineString (const char *msg=0)
 
- Public Member Functions inherited from G4VUIshell
 G4VUIshell (const G4String &prompt="> ")
 
virtual ~G4VUIshell ()
 
void SetNColumn (G4int ncol)
 
void SetPrompt (const G4String &prompt)
 
void SetCurrentDirectory (const G4String &ccd)
 
virtual void SetLsColor (TermColorIndex, TermColorIndex)
 
virtual void ShowCurrentDirectory () const
 
virtual void ListCommand (const G4String &input, const G4String &candidate="") const
 
virtual G4String GetCommandLineString (const char *msg=0)=0
 
virtual void ResetTerminal ()
 

Additional Inherited Members

- Protected Member Functions inherited from G4VUIshell
virtual void MakePrompt (const char *msg=0)
 
G4UIcommandTreeGetCommandTree (const G4String &dir) const
 
G4String GetAbsCommandDirPath (const G4String &apath) const
 
G4String GetCommandPathTail (const G4String &apath) const
 
- Protected Attributes inherited from G4VUIshell
G4String promptSetting
 
G4String promptString
 
G4int nColumn
 
G4bool lsColorFlag
 
TermColorIndex directoryColor
 
TermColorIndex commandColor
 
G4String currentCommandDir
 

Detailed Description

Definition at line 39 of file G4UIcsh.hh.

Constructor & Destructor Documentation

◆ G4UIcsh()

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

Definition at line 32 of file G4UIcsh.cc.

33 : G4VUIshell(prompt)
34////////////////////////////////////////
35{
36}

◆ ~G4UIcsh()

G4UIcsh::~G4UIcsh ( )

Definition at line 39 of file G4UIcsh.cc.

41{
42}

Member Function Documentation

◆ GetCommandLineString()

G4String G4UIcsh::GetCommandLineString ( const char *  msg = 0)
virtual

Implements G4VUIshell.

Definition at line 46 of file G4UIcsh.cc.

48{
49 MakePrompt(msg);
50 G4cout << promptString << std::flush;
51
52 G4String newCommand;
53 G4StrUtil::readline(G4cin, newCommand, false);
54 if (!G4cin.good()) {
55 G4cin.clear();
56 newCommand= "exit";
57 return newCommand;
58 }
59 G4StrUtil::rstrip(newCommand, '\r'); // fix for odd behavior on Windows
60
61 // multi-line
62 while( (newCommand.length() > 0) &&
63 (newCommand[G4int(newCommand.length()-1)] == '_') ) {
64 G4String newLine;
65 newCommand.erase(newCommand.length()-1);
66 G4StrUtil::readline(G4cin, newLine, false);
67 if (!G4cin.good()) {
68 G4cin.clear();
69 newCommand= "exit";
70 return newCommand;
71 }
72 newCommand.append(newLine);
73 }
74
75 return newCommand;
76}
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cout
#define G4cin
Definition: G4ios.hh:56
virtual void MakePrompt(const char *msg=0)
Definition: G4VUIshell.cc:60
G4String promptString
Definition: G4VUIshell.hh:61
void rstrip(G4String &str, char ch=' ')
Remove trailing characters from string.
std::istream & readline(std::istream &is, G4String &str, G4bool skipWhite=true)
Read characters into a G4String from an input stream until end-of-line.

The documentation for this class was generated from the following files: