source: trunk/source/interfaces/html/G4UItcsh_8hh-source.html@ 877

Last change on this file since 877 was 571, checked in by garnier, 18 years ago

r581@mac-90108: laurentgarnier | 2007-08-17 17:30:26 +0200
deplacement de frame

  • Property svn:mime-type set to text/html
File size: 14.4 KB
Line 
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>G4UItcsh.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&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
8<h1>G4UItcsh.hh</h1><a href="G4UItcsh_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">//</span>
900002 <span class="comment">// ********************************************************************</span>
1000003 <span class="comment">// * License and Disclaimer *</span>
1100004 <span class="comment">// * *</span>
1200005 <span class="comment">// * The Geant4 software is copyright of the Copyright Holders of *</span>
1300006 <span class="comment">// * the Geant4 Collaboration. It is provided under the terms and *</span>
1400007 <span class="comment">// * conditions of the Geant4 Software License, included in the file *</span>
1500008 <span class="comment">// * LICENSE and available at http://cern.ch/geant4/license . These *</span>
1600009 <span class="comment">// * include a list of copyright holders. *</span>
1700010 <span class="comment">// * *</span>
1800011 <span class="comment">// * Neither the authors of this software system, nor their employing *</span>
1900012 <span class="comment">// * institutes,nor the agencies providing financial support for this *</span>
2000013 <span class="comment">// * work make any representation or warranty, express or implied, *</span>
2100014 <span class="comment">// * regarding this software system or assume any liability for its *</span>
2200015 <span class="comment">// * use. Please see the license in the file LICENSE and URL above *</span>
2300016 <span class="comment">// * for the full disclaimer and the limitation of liability. *</span>
2400017 <span class="comment">// * *</span>
2500018 <span class="comment">// * This code implementation is the result of the scientific and *</span>
2600019 <span class="comment">// * technical work of the GEANT4 collaboration. *</span>
2700020 <span class="comment">// * By using, copying, modifying or distributing the software (or *</span>
2800021 <span class="comment">// * any work based on the software) you agree to acknowledge its *</span>
2900022 <span class="comment">// * use in resulting scientific publications, and indicate your *</span>
3000023 <span class="comment">// * acceptance of all terms of the Geant4 Software license. *</span>
3100024 <span class="comment">// ********************************************************************</span>
3200025 <span class="comment">//</span>
3300026 <span class="comment">//</span>
3400027 <span class="comment">// $Id: G4UItcsh.hh,v 1.7 2006/06/29 19:09:37 gunter Exp $</span>
3500028 <span class="comment">// GEANT4 tag $Name: geant4-08-01-patch-01 $</span>
3600029 <span class="comment">//</span>
3700030
3800031 <span class="preprocessor">#ifndef G4UItcsh_h</span>
3900032 <span class="preprocessor"></span><span class="preprocessor">#define G4UItcsh_h 1</span>
4000033 <span class="preprocessor"></span>
4100034 <span class="preprocessor">#ifndef WIN32</span>
4200035 <span class="preprocessor"></span>
4300036 <span class="preprocessor">#include &lt;termios.h&gt;</span>
4400037 <span class="preprocessor">#include &lt;vector&gt;</span>
4500038 <span class="preprocessor">#include "<a class="code" href="G4VUIshell_8hh.html">G4VUIshell.hh</a>"</span>
4600039 <span class="preprocessor">#include "G4UIcommand.hh"</span>
4700040 <span class="preprocessor">#include "G4UIcommandTree.hh"</span>
4800041
4900042 <span class="comment">//</span>
5000043 <span class="comment">// Description:</span>
5100044 <span class="comment">// This class gives tcsh-like shell.</span>
5200045 <span class="comment">// </span>
5300046 <span class="comment">// If your terminal supports color code, colored strings are available </span>
5400047 <span class="comment">// in ListCommand(). For activating color support, </span>
5500048 <span class="comment">// e.g.</span>
5600049 <span class="comment">// tcsh-&gt; SetLsColor(GREEN, CYAN); // (dir, command) color</span>
5700050 <span class="comment">// </span>
5800051 <span class="comment">// [key binding]</span>
5900052 <span class="comment">// ^A ... move cursor to the top</span>
6000053 <span class="comment">// ^B ... backward cursor ([LEFT])</span>
6100054 <span class="comment">// ^D ... delete/exit/show matched list</span>
6200055 <span class="comment">// ^E ... move cursor to the end</span>
6300056 <span class="comment">// ^F ... forward cursor ([RIGHT])</span>
6400057 <span class="comment">// ^K ... clear after the cursor</span>
6500058 <span class="comment">// ^L ... clear screen (not implemented)</span>
6600059 <span class="comment">// ^N ... next command ([DOWN])</span>
6700060 <span class="comment">// ^P ... previous command ([UP])</span>
6800061 <span class="comment">// TAB... command completion</span>
6900062 <span class="comment">// DEL... backspace</span>
7000063 <span class="comment">// BS ... backspace</span>
7100064 <span class="comment">//</span>
7200065 <span class="comment">// [prompt string substitution]</span>
7300066 <span class="comment">// %s ... current application status</span>
7400067 <span class="comment">// %/ ... current working directory</span>
7500068 <span class="comment">// %h ... history# (different from G4 history#)</span>
7600069 <span class="comment">//</span>
7700070
78<a name="l00071"></a><a class="code" href="classG4UItcsh.html">00071</a> <span class="keyword">class </span><a class="code" href="classG4UItcsh.html">G4UItcsh</a> : <span class="keyword">public</span> <a class="code" href="classG4VUIshell.html">G4VUIshell</a> {
7900072 <span class="keyword">protected</span>:
8000073 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b0">MakePrompt</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* msg=0);
8100074
82<a name="l00075"></a><a class="code" href="classG4UItcsh.html#p0">00075</a> G4String <a class="code" href="classG4UItcsh.html#p0">commandLine</a>; <span class="comment">// command line string;</span>
83<a name="l00076"></a><a class="code" href="classG4UItcsh.html#p1">00076</a> G4int <a class="code" href="classG4UItcsh.html#p1">cursorPosition</a>; <span class="comment">// cursor position </span>
84<a name="l00077"></a><a class="code" href="classG4UItcsh.html#p2">00077</a> G4String <a class="code" href="classG4UItcsh.html#p2">commandLineBuf</a>; <span class="comment">// temp. command line;</span>
8500078 G4bool <a class="code" href="classG4UItcsh.html#b1">IsCursorLast</a>() <span class="keyword">const</span>;
8600079 <span class="comment">// Is cursor position at the last of command line ?</span>
8700080
8800081 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b2">InitializeCommandLine</a>();
8900082 G4String <a class="code" href="classG4UItcsh.html#b3">ReadLine</a>();
9000083 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b4">InsertCharacter</a>(<span class="keywordtype">char</span> cc); <span class="comment">// insert character</span>
9100084 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b5">BackspaceCharacter</a>(); <span class="comment">// backspace character</span>
9200085 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b6">DeleteCharacter</a>(); <span class="comment">// delete character</span>
9300086 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b7">ClearLine</a>(); <span class="comment">// clear command line</span>
9400087 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b8">ClearAfterCursor</a>(); <span class="comment">// clear after the cursor</span>
9500088 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b9">ClearScreen</a>(); <span class="comment">// clear screen</span>
9600089
9700090 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b10">ForwardCursor</a>(); <span class="comment">// move cursor forward</span>
9800091 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b11">BackwardCursor</a>(); <span class="comment">// move cursor backward</span>
9900092 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b12">MoveCursorTop</a>(); <span class="comment">// move cursor to the top</span>
10000093 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b13">MoveCursorEnd</a>(); <span class="comment">// move cursor to the end</span>
10100094
10200095 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b14">NextCommand</a>(); <span class="comment">// next command</span>
10300096 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b15">PreviousCommand</a>(); <span class="comment">// previous command</span>
10400097
10500098 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b16">ListMatchedCommand</a>(); <span class="comment">// list matched commands</span>
10600099 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b17">CompleteCommand</a>(); <span class="comment">// complete command</span>
10700100
10800101 <span class="comment">// utilities...</span>
10900102 G4String <a class="code" href="classG4UItcsh.html#b18">GetFirstMatchedString</a>(<span class="keyword">const</span> G4String&amp; str1,
11000103 <span class="keyword">const</span> G4String&amp; str2) <span class="keyword">const</span>;
11100104
11200105 <span class="comment">// history functionality (history# is managed in itself)</span>
113<a name="l00106"></a><a class="code" href="classG4UItcsh.html#p3">00106</a> std::vector&lt;G4String&gt; <a class="code" href="classG4UItcsh.html#p3">commandHistory</a>;
114<a name="l00107"></a><a class="code" href="classG4UItcsh.html#p4">00107</a> G4int <a class="code" href="classG4UItcsh.html#p4">maxHistory</a>; <span class="comment">// max# of histories stored</span>
115<a name="l00108"></a><a class="code" href="classG4UItcsh.html#p5">00108</a> G4int <a class="code" href="classG4UItcsh.html#p5">currentHistoryNo</a>; <span class="comment">// global</span>
116<a name="l00109"></a><a class="code" href="classG4UItcsh.html#p6">00109</a> G4int <a class="code" href="classG4UItcsh.html#p6">relativeHistoryIndex</a>; <span class="comment">// local index relative to current history#</span>
11700110
11800111 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b19">StoreHistory</a>(G4String aCommand);
11900112 G4String <a class="code" href="classG4UItcsh.html#b20">RestoreHistory</a>(G4int index); <span class="comment">// index is global history#</span>
12000113
12100114
12200115 <span class="comment">// (re)set termios</span>
123<a name="l00116"></a><a class="code" href="classG4UItcsh.html#p7">00116</a> termios <a class="code" href="classG4UItcsh.html#p7">tios</a>; <span class="comment">// terminal mode (prestatus)</span>
124<a name="l00117"></a><a class="code" href="classG4UItcsh.html#p8">00117</a> G4String <a class="code" href="classG4UItcsh.html#p8">clearString</a>; <span class="comment">// "clear code (^L)"</span>
12500118 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b21">SetTermToInputMode</a>();
12600119 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#b22">RestoreTerm</a>();
12700120
12800121 <span class="keyword">public</span>:
12900122 <a class="code" href="classG4UItcsh.html#a0">G4UItcsh</a>(<span class="keyword">const</span> G4String&amp; prompt=<span class="stringliteral">"%s&gt; "</span>, G4int maxhist=100);
13000123 <a class="code" href="classG4UItcsh.html#a1">~G4UItcsh</a>();
13100124
13200125 <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#a2">SetLsColor</a>(TermColorIndex dirColor, TermColorIndex cmdColor);
13300126 <span class="keyword">virtual</span> G4String <a class="code" href="classG4UItcsh.html#a3">GetCommandLine</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* msg=0);
13400127 };
13500128
136<a name="l00129"></a><a class="code" href="classG4UItcsh.html#b1">00129</a> <span class="keyword">inline</span> G4bool <a class="code" href="classG4UItcsh.html#b1">G4UItcsh::IsCursorLast</a>()<span class="keyword"> const</span>
13700130 <span class="keyword"></span>{
13800131 <span class="keywordflow">if</span>(<a class="code" href="classG4UItcsh.html#p1">cursorPosition</a> == G4int(<a class="code" href="classG4UItcsh.html#p0">commandLine</a>.length()+1)) <span class="keywordflow">return</span> TRUE;
13900132 <span class="keywordflow">else</span> <span class="keywordflow">return</span> FALSE;
14000133 }
14100134
142<a name="l00135"></a><a class="code" href="classG4UItcsh.html#a2">00135</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classG4UItcsh.html#a2">G4UItcsh::SetLsColor</a>(TermColorIndex dirColor,
14300136 TermColorIndex cmdColor)
14400137 {
14500138 <a class="code" href="classG4VUIshell.html#p3">lsColorFlag</a>= TRUE;
14600139 <a class="code" href="classG4VUIshell.html#p4">directoryColor</a>= dirColor;
14700140 <a class="code" href="classG4VUIshell.html#p5">commandColor</a>= cmdColor;
14800141 }
14900142
15000143 <span class="preprocessor">#endif</span>
15100144 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
15200145 <span class="preprocessor"></span>
153</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jun 22 11:07:02 2007 by
154<a href="http://www.doxygen.org/index.html">
155<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
156</a>1.3.4 </small></address>
157</body>
158</html>
Note: See TracBrowser for help on using the repository browser.