1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
---|
3 | <title>G4VUIshell.hh Source File</title> |
---|
4 | <link href="doxygen.css" rel="stylesheet" type="text/css"> |
---|
5 | </head><body> |
---|
6 | <!-- Generated by Doxygen 1.3.4 --> |
---|
7 | <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div> |
---|
8 | <h1>G4VUIshell.hh</h1><a href="G4VUIshell_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">//</span> |
---|
9 | 00002 <span class="comment">// ********************************************************************</span> |
---|
10 | 00003 <span class="comment">// * License and Disclaimer *</span> |
---|
11 | 00004 <span class="comment">// * *</span> |
---|
12 | 00005 <span class="comment">// * The Geant4 software is copyright of the Copyright Holders of *</span> |
---|
13 | 00006 <span class="comment">// * the Geant4 Collaboration. It is provided under the terms and *</span> |
---|
14 | 00007 <span class="comment">// * conditions of the Geant4 Software License, included in the file *</span> |
---|
15 | 00008 <span class="comment">// * LICENSE and available at http://cern.ch/geant4/license . These *</span> |
---|
16 | 00009 <span class="comment">// * include a list of copyright holders. *</span> |
---|
17 | 00010 <span class="comment">// * *</span> |
---|
18 | 00011 <span class="comment">// * Neither the authors of this software system, nor their employing *</span> |
---|
19 | 00012 <span class="comment">// * institutes,nor the agencies providing financial support for this *</span> |
---|
20 | 00013 <span class="comment">// * work make any representation or warranty, express or implied, *</span> |
---|
21 | 00014 <span class="comment">// * regarding this software system or assume any liability for its *</span> |
---|
22 | 00015 <span class="comment">// * use. Please see the license in the file LICENSE and URL above *</span> |
---|
23 | 00016 <span class="comment">// * for the full disclaimer and the limitation of liability. *</span> |
---|
24 | 00017 <span class="comment">// * *</span> |
---|
25 | 00018 <span class="comment">// * This code implementation is the result of the scientific and *</span> |
---|
26 | 00019 <span class="comment">// * technical work of the GEANT4 collaboration. *</span> |
---|
27 | 00020 <span class="comment">// * By using, copying, modifying or distributing the software (or *</span> |
---|
28 | 00021 <span class="comment">// * any work based on the software) you agree to acknowledge its *</span> |
---|
29 | 00022 <span class="comment">// * use in resulting scientific publications, and indicate your *</span> |
---|
30 | 00023 <span class="comment">// * acceptance of all terms of the Geant4 Software license. *</span> |
---|
31 | 00024 <span class="comment">// ********************************************************************</span> |
---|
32 | 00025 <span class="comment">//</span> |
---|
33 | 00026 <span class="comment">//</span> |
---|
34 | 00027 <span class="comment">// $Id: G4VUIshell.hh,v 1.6 2006/06/29 19:09:41 gunter Exp $</span> |
---|
35 | 00028 <span class="comment">// GEANT4 tag $Name: geant4-08-01-patch-01 $</span> |
---|
36 | 00029 <span class="comment">//</span> |
---|
37 | 00030 |
---|
38 | 00031 <span class="preprocessor">#ifndef G4VUIshell_h</span> |
---|
39 | 00032 <span class="preprocessor"></span><span class="preprocessor">#define G4VUIshell_h 1</span> |
---|
40 | 00033 <span class="preprocessor"></span> |
---|
41 | 00034 <span class="preprocessor">#include "globals.hh"</span> |
---|
42 | 00035 |
---|
43 | 00036 <span class="comment">//</span> |
---|
44 | 00037 <span class="comment">// Description: </span> |
---|
45 | 00038 <span class="comment">// This class is the abstract base class for various UI shells.</span> |
---|
46 | 00039 <span class="comment">//</span> |
---|
47 | 00040 <span class="comment">// GetCommadLine() (virtual) returns a command string input from</span> |
---|
48 | 00041 <span class="comment">// a commad line.</span> |
---|
49 | 00042 <span class="comment">//</span> |
---|
50 | 00043 <span class="comment">// Two pre-inplemented shell commands(still virtual) are also included, </span> |
---|
51 | 00044 <span class="comment">// (somewhat differnt flavor from ones provided by G4VBasicShell)</span> |
---|
52 | 00045 <span class="comment">// ShowCurrentDirectory() ... show current directory</span> |
---|
53 | 00046 <span class="comment">// ListCommand() ... list commands</span> |
---|
54 | 00047 <span class="comment">//</span> |
---|
55 | 00048 <span class="comment">// [prompt string substitution] (default)</span> |
---|
56 | 00049 <span class="comment">// %s ... current application status</span> |
---|
57 | 00050 <span class="comment">// %/ ... current working directory</span> |
---|
58 | 00051 <span class="comment">//</span> |
---|
59 | 00052 |
---|
60 | 00053 <span class="comment">// terminal color index</span> |
---|
61 | <a name="l00054"></a><a class="code" href="G4VUIshell_8hh.html#a8">00054</a> <span class="keyword">enum</span> <a class="code" href="G4VUIshell_8hh.html#a8">TermColorIndex</a>{ <a class="code" href="G4VUIshell_8hh.html#a8a0">BLACK</a>=0, <a class="code" href="G4VUIshell_8hh.html#a8a1">RED</a>, <a class="code" href="G4VUIshell_8hh.html#a8a2">GREEN</a>, <a class="code" href="G4VUIshell_8hh.html#a8a3">YELLOW</a>, |
---|
62 | 00055 <a class="code" href="G4VUIshell_8hh.html#a8a4">BLUE</a>, <a class="code" href="G4VUIshell_8hh.html#a8a5">PURPLE</a>, <a class="code" href="G4VUIshell_8hh.html#a8a6">CYAN</a>, <a class="code" href="G4VUIshell_8hh.html#a8a7">WHITE</a>}; |
---|
63 | 00056 |
---|
64 | 00057 <span class="keyword">class </span>G4UIcommandTree; |
---|
65 | 00058 |
---|
66 | <a name="l00059"></a><a class="code" href="classG4VUIshell.html">00059</a> <span class="keyword">class </span><a class="code" href="classG4VUIshell.html">G4VUIshell</a> { |
---|
67 | 00060 <span class="keyword">protected</span>: |
---|
68 | <a name="l00061"></a><a class="code" href="classG4VUIshell.html#p0">00061</a> G4String <a class="code" href="classG4VUIshell.html#p0">promptSetting</a>; <span class="comment">// including %-directive</span> |
---|
69 | <a name="l00062"></a><a class="code" href="classG4VUIshell.html#p1">00062</a> G4String <a class="code" href="classG4VUIshell.html#p1">promptString</a>; |
---|
70 | 00063 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#b0">MakePrompt</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* msg=0); <span class="comment">// make prompt string</span> |
---|
71 | <a name="l00064"></a><a class="code" href="classG4VUIshell.html#p2">00064</a> G4int <a class="code" href="classG4VUIshell.html#p2">nColumn</a>; <span class="comment">// column size of terminal (default=80)</span> |
---|
72 | 00065 |
---|
73 | 00066 <span class="comment">// color code support (effective if your terminal supports color code.)</span> |
---|
74 | 00067 <span class="comment">// default setting is off.</span> |
---|
75 | <a name="l00068"></a><a class="code" href="classG4VUIshell.html#p3">00068</a> G4bool <a class="code" href="classG4VUIshell.html#p3">lsColorFlag</a>; <span class="comment">// color flag for list command</span> |
---|
76 | <a name="l00069"></a><a class="code" href="classG4VUIshell.html#p4">00069</a> <a class="code" href="G4VUIshell_8hh.html#a8">TermColorIndex</a> <a class="code" href="classG4VUIshell.html#p4">directoryColor</a>; |
---|
77 | <a name="l00070"></a><a class="code" href="classG4VUIshell.html#p5">00070</a> <a class="code" href="G4VUIshell_8hh.html#a8">TermColorIndex</a> <a class="code" href="classG4VUIshell.html#p5">commandColor</a>; |
---|
78 | 00071 |
---|
79 | 00072 <span class="comment">// for treating G4 command tree...</span> |
---|
80 | <a name="l00073"></a><a class="code" href="classG4VUIshell.html#p6">00073</a> G4String <a class="code" href="classG4VUIshell.html#p6">currentCommandDir</a>; <span class="comment">// current command directory (absolute path)</span> |
---|
81 | 00074 <span class="comment">// get tree node</span> |
---|
82 | 00075 G4UIcommandTree* <a class="code" href="classG4VUIshell.html#b1">GetCommandTree</a>(<span class="keyword">const</span> G4String& dir) <span class="keyword">const</span>; |
---|
83 | 00076 <span class="comment">// absolute path name (ignore command)</span> |
---|
84 | 00077 G4String <a class="code" href="classG4VUIshell.html#b2">GetAbsCommandDirPath</a>(<span class="keyword">const</span> G4String& apath) <span class="keyword">const</span>; |
---|
85 | 00078 <span class="comment">// tail of path ( xxx/xxx/zzz -> zzz, trancated //// -> /)</span> |
---|
86 | 00079 G4String <a class="code" href="classG4VUIshell.html#b3">GetCommandPathTail</a>(<span class="keyword">const</span> G4String& apath) <span class="keyword">const</span>; |
---|
87 | 00080 |
---|
88 | 00081 <span class="keyword">public</span>: |
---|
89 | 00082 <a class="code" href="classG4VUIshell.html#a0">G4VUIshell</a>(<span class="keyword">const</span> G4String& prompt=<span class="stringliteral">"> "</span>); |
---|
90 | 00083 <span class="keyword">virtual</span> <a class="code" href="classG4VUIshell.html#a1">~G4VUIshell</a>(); |
---|
91 | 00084 |
---|
92 | 00085 <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#a2">SetNColumn</a>(G4int ncol); |
---|
93 | 00086 <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#a3">SetPrompt</a>(<span class="keyword">const</span> G4String& prompt); |
---|
94 | 00087 <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#a4">SetCurrentDirectory</a>(<span class="keyword">const</span> G4String& ccd); |
---|
95 | 00088 |
---|
96 | 00089 <span class="comment">// shell commands</span> |
---|
97 | 00090 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#a5">ShowCurrentDirectory</a>() <span class="keyword">const</span>; |
---|
98 | 00091 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#a6">ListCommand</a>(<span class="keyword">const</span> G4String& input, |
---|
99 | 00092 <span class="keyword">const</span> G4String& candidate=<span class="stringliteral">""</span>) <span class="keyword">const</span>; |
---|
100 | 00093 <span class="comment">// "candidate" is specified with full path.</span> |
---|
101 | 00094 |
---|
102 | 00095 <span class="comment">// get command string from a command line</span> |
---|
103 | 00096 <span class="keyword">virtual</span> G4String <a class="code" href="classG4VUIshell.html#a7">GetCommandLine</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* msg=0)= 0; |
---|
104 | 00097 }; |
---|
105 | 00098 |
---|
106 | 00099 |
---|
107 | 00100 <span class="comment">// inlines...</span> |
---|
108 | <a name="l00101"></a><a class="code" href="classG4VUIshell.html#a2">00101</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#a2">G4VUIshell::SetNColumn</a>(G4int ncol) |
---|
109 | 00102 { |
---|
110 | 00103 <a class="code" href="classG4VUIshell.html#p2">nColumn</a>= ncol; |
---|
111 | 00104 } |
---|
112 | 00105 |
---|
113 | <a name="l00106"></a><a class="code" href="classG4VUIshell.html#a3">00106</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#a3">G4VUIshell::SetPrompt</a>(<span class="keyword">const</span> G4String& prompt) |
---|
114 | 00107 { |
---|
115 | 00108 <a class="code" href="classG4VUIshell.html#p0">promptSetting</a>= prompt; |
---|
116 | 00109 } |
---|
117 | 00110 |
---|
118 | <a name="l00111"></a><a class="code" href="classG4VUIshell.html#a4">00111</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#a4">G4VUIshell::SetCurrentDirectory</a>(<span class="keyword">const</span> G4String& dir) |
---|
119 | 00112 { |
---|
120 | 00113 <a class="code" href="classG4VUIshell.html#p6">currentCommandDir</a>= dir; |
---|
121 | 00114 } |
---|
122 | 00115 |
---|
123 | <a name="l00116"></a><a class="code" href="classG4VUIshell.html#a5">00116</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classG4VUIshell.html#a5">G4VUIshell::ShowCurrentDirectory</a>()<span class="keyword"> const</span> |
---|
124 | 00117 <span class="keyword"></span>{ |
---|
125 | 00118 G4cout << <a class="code" href="classG4VUIshell.html#p6">currentCommandDir</a> << G4endl; |
---|
126 | 00119 } |
---|
127 | 00120 |
---|
128 | 00121 <span class="preprocessor">#endif</span> |
---|
129 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jun 22 11:07:02 2007 by |
---|
130 | <a href="http://www.doxygen.org/index.html"> |
---|
131 | <img src="doxygen.png" alt="doxygen" align="middle" border=0 > |
---|
132 | </a>1.3.4 </small></address> |
---|
133 | </body> |
---|
134 | </html> |
---|