Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
source
interfaces
basic
include
G4VUIshell.hh
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
// $Id$
28
//
29
30
#ifndef G4VUIshell_h
31
#define G4VUIshell_h 1
32
33
#include "
globals.hh
"
34
35
// ====================================================================
36
// Description:
37
// This class is the abstract base class for various UI shells.
38
//
39
// GetCommadLineString() (virtual) returns a command string input from
40
// a commad line.
41
//
42
// Two pre-inplemented shell commands(still virtual) are also included,
43
// (somewhat differnt flavor from ones provided by G4VBasicShell)
44
// ShowCurrentDirectory() ... show current directory
45
// ListCommand() ... list commands
46
//
47
// [prompt string substitution] (default)
48
// %s ... current application status
49
// %/ ... current working directory
50
//
51
// ====================================================================
52
53
// terminal color index
54
enum
TermColorIndex
{
BLACK
=0,
RED
,
GREEN
,
YELLOW
,
55
BLUE
,
PURPLE
,
CYAN
,
WHITE
};
56
57
class
G4UIcommandTree
;
58
59
class
G4VUIshell
{
60
protected
:
61
G4String
promptSetting
;
// including %-directive
62
G4String
promptString
;
63
virtual
void
MakePrompt
(
const
char
* msg=0);
// make prompt string
64
G4int
nColumn
;
// column size of terminal (default=80)
65
66
// color code support (effective if your terminal supports color code.)
67
// default setting is off.
68
G4bool
lsColorFlag
;
// color flag for list command
69
TermColorIndex
directoryColor
;
70
TermColorIndex
commandColor
;
71
72
// for treating G4 command tree...
73
G4String
currentCommandDir
;
// current command directory (absolute path)
74
// get tree node
75
G4UIcommandTree
*
GetCommandTree
(
const
G4String
&
dir
)
const
;
76
// absolute path name (ignore command)
77
G4String
GetAbsCommandDirPath
(
const
G4String
& apath)
const
;
78
// tail of path ( xxx/xxx/zzz -> zzz, trancated //// -> /)
79
G4String
GetCommandPathTail
(
const
G4String
& apath)
const
;
80
81
public
:
82
G4VUIshell
(
const
G4String
& prompt=
"> "
);
83
virtual
~G4VUIshell
();
84
85
void
SetNColumn
(
G4int
ncol);
86
void
SetPrompt
(
const
G4String
& prompt);
87
void
SetCurrentDirectory
(
const
G4String
& ccd);
88
virtual
void
SetLsColor
(
TermColorIndex
,
TermColorIndex
);
89
90
// shell commands
91
virtual
void
ShowCurrentDirectory
()
const
;
92
virtual
void
ListCommand
(
const
G4String
& input,
93
const
G4String
& candidate=
""
)
const
;
94
// "candidate" is specified with full path.
95
96
// get command string from a command line
97
virtual
G4String
GetCommandLineString
(
const
char
* msg=0)= 0;
98
99
virtual
void
ResetTerminal
();
100
};
101
102
// ====================================================================
103
// inline functions
104
// ====================================================================
105
inline
void
G4VUIshell::SetNColumn
(
G4int
ncol)
106
{
107
nColumn
= ncol;
108
}
109
110
inline
void
G4VUIshell::SetPrompt
(
const
G4String
& prompt)
111
{
112
promptSetting
= prompt;
113
}
114
115
inline
void
G4VUIshell::SetCurrentDirectory
(
const
G4String
&
dir
)
116
{
117
currentCommandDir
=
dir
;
118
}
119
120
inline
void
G4VUIshell::SetLsColor
(
TermColorIndex
,
TermColorIndex
)
121
{
122
}
123
124
inline
void
G4VUIshell::ShowCurrentDirectory
()
const
125
{
126
G4cout
<<
currentCommandDir
<<
G4endl
;
127
}
128
129
#endif
Generated on Sat May 25 2013 14:33:19 for Geant4 by
1.8.4