Main MRPT website > C++ reference for MRPT 1.4.0
VersionVisitor.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 /******************************************************************************
11  *
12  * file: VersionVisitor.h
13  *
14  * Copyright (c) 2003, Michael E. Smoot .
15  * All rights reverved.
16  *
17  * See the file COPYING in the top directory of this distribution for
18  * more information.
19  *
20  * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  * DEALINGS IN THE SOFTWARE.
27  *
28  *****************************************************************************/
29 
30 
31 #ifndef TCLAP_VERSION_VISITOR_H
32 #define TCLAP_VERSION_VISITOR_H
33 
37 
38 namespace TCLAP {
39 
40 /**
41  * A Vistor that will call the version method of the given CmdLineOutput
42  * for the specified CmdLine object and then exit.
43  */
44 class VersionVisitor: public Visitor
45 {
46  protected:
47 
48  /**
49  * The CmdLine of interest.
50  */
51  CmdLineInterface* _cmd;
52 
53  /**
54  * The output object.
55  */
56  CmdLineOutput** _out;
57 
58  public:
59 
60  /**
61  * Constructor.
62  * \param cmd - The CmdLine the output is generated for.
63  * \param out - The type of output.
64  */
66  : Visitor(), _cmd( cmd ), _out( out ) { }
67 
68  /**
69  * Calls the version method of the output object using the
70  * specified CmdLine.
71  */
72  void visit() { (*_out)->version(*_cmd); throw ActionDoneException(); }
73 
74 };
75 
76 }
77 
78 #endif
TCLAP::VersionVisitor::VersionVisitor
VersionVisitor(CmdLineInterface *cmd, CmdLineOutput **out)
Constructor.
Definition: VersionVisitor.h:101
TCLAP::ActionDoneException
(Added by JLBC for MRPT): An exception that indicates to CmdLine::parse that help,...
Definition: ArgException.h:217
TCLAP::VersionVisitor::_out
CmdLineOutput ** _out
The output object.
Definition: VersionVisitor.h:92
TCLAP
Definition: Arg.h:44
TCLAP::CmdLineOutput
The interface that any output object must implement.
Definition: CmdLineOutput.h:67
TCLAP::CmdLineInterface
The base class that manages the command line definition and passes along the parsing to the appropria...
Definition: CmdLineInterface.h:70
TCLAP::Visitor
A base class that defines the interface for visitors.
Definition: Visitor.h:57
CmdLineInterface.h
CmdLineOutput.h
TCLAP::VersionVisitor::visit
void visit()
Calls the version method of the output object using the specified CmdLine.
Definition: VersionVisitor.h:108
Visitor.h
TCLAP::VersionVisitor::_cmd
CmdLineInterface * _cmd
The CmdLine of interest.
Definition: VersionVisitor.h:87



Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Sat Jan 18 22:37:07 UTC 2020