BASIS  version 1.2.3 (revision 2104)
HelpVisitor.h
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 TCLAP_HELP_VISITOR_H
00023 #define TCLAP_HELP_VISITOR_H
00024 
00025 #include <sbia/tclap/CmdLineInterface.h>
00026 #include <sbia/tclap/CmdLineOutput.h>
00027 #include <sbia/tclap/Visitor.h>
00028 
00029 namespace TCLAP {
00030 
00031 /**
00032  * A Visitor object that calls the usage method of the given CmdLineOutput
00033  * object for the specified CmdLine object.
00034  */
00035 class HelpVisitor: public Visitor
00036 {
00037     private:
00038         /**
00039          * Prevent accidental copying.
00040          */
00041         HelpVisitor(const HelpVisitor& rhs);
00042         HelpVisitor& operator=(const HelpVisitor& rhs);
00043 
00044     protected:
00045 
00046         /**
00047          * The CmdLine the output will be generated for. 
00048          */
00049         CmdLineInterface* _cmd;
00050 
00051         /**
00052          * The output object. 
00053          */
00054         CmdLineOutput** _out;
00055 
00056     public:
00057 
00058         /**
00059          * Constructor.
00060          * \param cmd - The CmdLine the output will be generated for.
00061          * \param out - The type of output. 
00062          */
00063         HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out) 
00064                 : Visitor(), _cmd( cmd ), _out( out ) { }
00065 
00066         /**
00067          * Calls the usage method of the CmdLineOutput for the 
00068          * specified CmdLine.
00069          */
00070         void visit() { (*_out)->usage(*_cmd); throw ExitException(0); }
00071         
00072 };
00073 
00074 }
00075 
00076 #endif