Geant4 11.4.0
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 () override
G4String GetCommandLineString (const char *msg=nullptr) override
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 void ResetTerminal ()

Additional Inherited Members

Protected Member Functions inherited from G4VUIshell
virtual void MakePrompt (const char *msg=nullptr)
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.

32 : G4VUIshell(prompt)
33////////////////////////////////////////
34{}
G4VUIshell(const G4String &prompt="> ")
Definition G4VUIshell.cc:44

◆ ~G4UIcsh()

G4UIcsh::~G4UIcsh ( )
overridedefault

Member Function Documentation

◆ GetCommandLineString()

G4String G4UIcsh::GetCommandLineString ( const char * msg = nullptr)
overridevirtual

Implements G4VUIshell.

Definition at line 41 of file G4UIcsh.cc.

43{
44 MakePrompt(msg);
45 G4cout << promptString << std::flush;
46
47 G4String newCommand;
48 G4StrUtil::readline(G4cin, newCommand, false);
49 if (! G4cin.good()) {
50 G4cin.clear();
51 newCommand = "exit";
52 return newCommand;
53 }
54 G4StrUtil::rstrip(newCommand, '\r'); // fix for odd behavior on Windows
55
56 // multi-line
57 while ((newCommand.length() > 0) && (newCommand[G4int(newCommand.length() - 1)] == '_')) {
58 G4String newLine;
59 newCommand.erase(newCommand.length() - 1);
60 G4StrUtil::readline(G4cin, newLine, false);
61 if (! G4cin.good()) {
62 G4cin.clear();
63 newCommand = "exit";
64 return newCommand;
65 }
66 newCommand.append(newLine);
67 }
68
69 return newCommand;
70}
int G4int
Definition G4Types.hh:85
G4GLOB_DLL std::ostream G4cout
#define G4cin
Definition G4ios.hh:66
virtual void MakePrompt(const char *msg=nullptr)
Definition G4VUIshell.cc:60
G4String promptString
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: