Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4UIcsh Class Reference

#include <G4UIcsh.hh>

Inheritance diagram for G4UIcsh:
Collaboration 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 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 40 of file G4UIcsh.hh.

Constructor & Destructor Documentation

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

Definition at line 33 of file G4UIcsh.cc.

34  : G4VUIshell(prompt)
36 {
37 }
G4VUIshell(const G4String &prompt="> ")
Definition: G4VUIshell.cc:46
G4UIcsh::~G4UIcsh ( )

Definition at line 40 of file G4UIcsh.cc.

42 {
43 }

Member Function Documentation

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

Implements G4VUIshell.

Definition at line 47 of file G4UIcsh.cc.

49 {
50  MakePrompt(msg);
51  G4cout << promptString << std::flush;
52 
53  G4String newCommand;
54  newCommand.readLine(G4cin, FALSE);
55  if (!G4cin.good()) {
56  G4cin.clear();
57  newCommand= "exit";
58  return newCommand;
59  }
60  newCommand = newCommand.strip(1,'\r'); // fix for odd behavior on Windows
61 
62  // multi-line
63  while( (newCommand.length() > 0) &&
64  (newCommand[newCommand.length()-1] == '_') ) {
65  G4String newLine;
66  newCommand.remove(newCommand.length()-1);
67  newLine.readLine(G4cin, FALSE);
68  if (!G4cin.good()) {
69  G4cin.clear();
70  newCommand= "exit";
71  return newCommand;
72  }
73  newCommand.append(newLine);
74  }
75 
76  return newCommand;
77 }
virtual void MakePrompt(const char *msg=0)
Definition: G4VUIshell.cc:61
G4String promptString
Definition: G4VUIshell.hh:62
G4String & remove(str_size)
G4String strip(G4int strip_Type=trailing, char c=' ')
std::istream & readLine(std::istream &, G4bool skipWhite=true)
#define G4cin
Definition: G4ios.hh:60
G4GLOB_DLL std::ostream G4cout
#define FALSE
Definition: globals.hh:52
G4String & append(const G4String &)

Here is the call graph for this function:


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