VR-Link API Documentation for HLA Evolved
cmdHelpVisitor.h
Go to the documentation of this file.
00001 
00002 /****************************************************************************** 
00003  * 
00004  *  file:  HelpVisitor.h
00005  * 
00006  *  Copyright (c) 2003, Michael E. Smoot .
00007  *  All rights reverved.
00008  * 
00009  *  See the file COPYING in the top directory of this distribution for
00010  *  more information.
00011  *  
00012  *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 
00013  *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
00014  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
00015  *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
00016  *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
00017  *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
00018  *  DEALINGS IN THE SOFTWARE.  
00019  *  
00020  *****************************************************************************/ 
00021 
00022 #ifndef DtCmdLine_HELP_VISITOR_H
00023 #define DtCmdLine_HELP_VISITOR_H
00024  
00028 
00029 #include "cmdLineInterface.h"
00030 #include "cmdLineOutput.h"
00031 #include "cmdVisitor.h"
00032 
00033 #include <vlutil/vlPrint.h>
00034 #include <vlutil/vlProcessControl.h>
00035 #include <vlutil/vlKeyboard.h>
00036 
00037 #ifdef DtUSE_UTILITIES_NAMESPACE
00038 namespace DtUSE_UTILITIES_NAMESPACE
00039 {
00040 #endif
00041 
00042 namespace DtCmdLine {
00043 
00048 
00049    class HelpVisitor: public Visitor
00050    {
00051    protected:
00052 
00056       CmdLineInterface* _cmd;
00057 
00061       CmdLineOutput** _out;
00062 
00063       bool myPressAnyKey;
00064 
00065    public:
00066 
00072       HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out,
00073 #ifdef _WIN32
00074          bool pressAnyKey = true) 
00075 #else
00076          bool pressAnyKey = false)
00077 #endif
00078          : Visitor(), _cmd( cmd ), _out( out ), myPressAnyKey(pressAnyKey) { }
00079 
00080       virtual ~HelpVisitor() { }
00085       void visit();
00086 
00087 
00088 
00089    };
00090 
00091    inline void HelpVisitor::visit()
00092    { 
00093       (*_out)->usage(*_cmd); 
00094 
00095       int oldNotifyLevel = DtNotifyLevel;
00096       DtNotifyLevel = 3;
00097 
00098 
00099       if (myPressAnyKey)
00100       {
00101          DtInfo << "Press any key to continue" << std::endl;
00102 
00103          while (DtPollBlockingInputChar() == '\0')
00104          {
00105             DtSleep(0.1);
00106          }
00107       }
00108 
00109       DtNotifyLevel = oldNotifyLevel;
00110 
00111       exit(0); 
00112    }
00113 
00114 }
00115 
00116 #ifdef DtUSE_UTILITIES_NAMESPACE
00117 }     
00118 #endif
00119 
00120 #endif

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)