VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cmdHelpVisitor.h
Go to the documentation of this file.
1 
2 /******************************************************************************
3  *
4  * file: HelpVisitor.h
5  *
6  * Copyright (c) 2003, Michael E. Smoot .
7  * All rights reverved.
8  *
9  * See the file COPYING in the top directory of this distribution for
10  * more information.
11  *
12  * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
13  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18  * DEALINGS IN THE SOFTWARE.
19  *
20  *****************************************************************************/
21 
22 #ifndef DtCmdLine_HELP_VISITOR_H
23 #define DtCmdLine_HELP_VISITOR_H
24 
28 
29 #include "cmdLineInterface.h"
30 #include "cmdLineOutput.h"
31 #include "cmdVisitor.h"
32 
33 #include <vlutil/vlPrint.h>
35 #include <vlutil/vlKeyboard.h>
36 
37 #ifdef DtUSE_UTILITIES_NAMESPACE
38 namespace DtUSE_UTILITIES_NAMESPACE
39 {
40 #endif
41 
42 namespace DtCmdLine {
43 
48 
49  class HelpVisitor: public Visitor
50  {
51  protected:
52 
57 
62 
64 
65  public:
66 
73 #ifdef _WIN32
74  bool pressAnyKey = true)
75 #else
76  bool pressAnyKey = false)
77 #endif
78  : Visitor(), _cmd( cmd ), _out( out ), myPressAnyKey(pressAnyKey) { }
79 
80  virtual ~HelpVisitor() { }
85  void visit();
86 
87 
88 
89  };
90 
91  inline void HelpVisitor::visit()
92  {
93  (*_out)->usage(*_cmd);
94 
95  int oldNotifyLevel = DtNotifyLevel;
96  DtNotifyLevel = 3;
97 
98 
99  if (myPressAnyKey)
100  {
101  DtInfo << "Press any key to continue" << std::endl;
102 
103  while (DtPollBlockingInputChar() == '\0')
104  {
105  DtSleep(0.1);
106  }
107  }
108 
109  DtNotifyLevel = oldNotifyLevel;
110 
111  exit(0);
112  }
113 
114 }
115 
116 #ifdef DtUSE_UTILITIES_NAMESPACE
117 }
118 #endif
119 
120 #endif

Document ID: Generated on Wed Jan 7 13:31:29 EST 2015 from SVN revision 149162
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)