00001 00002 /****************************************************************************** 00003 * 00004 * file: CmdLineInterface.h 00005 * 00006 * Copyright (c) 2003, Michael E. Smoot . 00007 * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. 00008 * All rights reverved. 00009 * 00010 * See the file COPYING in the top directory of this distribution for 00011 * more information. 00012 * 00013 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 00014 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00015 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00016 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00017 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00018 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00019 * DEALINGS IN THE SOFTWARE. 00020 * 00021 *****************************************************************************/ 00022 00023 #ifndef TCLAP_COMMANDLINE_INTERFACE_H 00024 #define TCLAP_COMMANDLINE_INTERFACE_H 00025 00026 #include <string> 00027 #include <vector> 00028 #include <list> 00029 #include <iostream> 00030 #include <algorithm> 00031 00032 00033 namespace TCLAP { 00034 00035 class Arg; 00036 class CmdLineOutput; 00037 class XorHandler; 00038 00039 /** 00040 * The base class that manages the command line definition and passes 00041 * along the parsing to the appropriate Arg classes. 00042 */ 00043 class CmdLineInterface 00044 { 00045 public: 00046 00047 /** 00048 * Destructor 00049 */ 00050 virtual ~CmdLineInterface() {} 00051 00052 /** 00053 * Adds an argument to the list of arguments to be parsed. 00054 * \param a - Argument to be added. 00055 */ 00056 virtual void add( Arg& a )=0; 00057 00058 /** 00059 * An alternative add. Functionally identical. 00060 * \param a - Argument to be added. 00061 */ 00062 virtual void add( Arg* a )=0; 00063 00064 /** 00065 * Add two Args that will be xor'd. 00066 * If this method is used, add does 00067 * not need to be called. 00068 * \param a - Argument to be added and xor'd. 00069 * \param b - Argument to be added and xor'd. 00070 */ 00071 virtual void xorAdd( Arg& a, Arg& b )=0; 00072 00073 /** 00074 * Add a list of Args that will be xor'd. If this method is used, 00075 * add does not need to be called. 00076 * \param xors - List of Args to be added and xor'd. 00077 */ 00078 virtual void xorAdd( std::vector<Arg*>& xors )=0; 00079 00080 /** 00081 * Parses the command line. 00082 * \param argc - Number of arguments. 00083 * \param argv - Array of arguments. 00084 * \return (Added by JLBC for MRPT): Return false if the program should exit (error in args, it was --help, etc...) 00085 */ 00086 virtual bool parse(int argc, char** argv)=0; 00087 00088 /** 00089 * Returns the CmdLineOutput object. 00090 */ 00091 virtual CmdLineOutput* getOutput()=0; 00092 00093 /** 00094 * \param co - CmdLineOutput object that we want to use instead. 00095 */ 00096 virtual void setOutput(CmdLineOutput* co)=0; 00097 00098 /** 00099 * Returns the version string. 00100 */ 00101 virtual std::string& getVersion()=0; 00102 00103 /** 00104 * Returns the program name string. 00105 */ 00106 virtual std::string& getProgramName()=0; 00107 00108 /** 00109 * Returns the argList. 00110 */ 00111 virtual std::list<Arg*>& getArgList()=0; 00112 00113 /** 00114 * Returns the XorHandler. 00115 */ 00116 virtual XorHandler& getXorHandler()=0; 00117 00118 /** 00119 * Returns the delimiter string. 00120 */ 00121 virtual char getDelimiter()=0; 00122 00123 /** 00124 * Returns the message string. 00125 */ 00126 virtual std::string& getMessage()=0; 00127 00128 /** 00129 * Indicates whether or not the help and version switches were created 00130 * automatically. 00131 */ 00132 virtual bool hasHelpAndVersion()=0; 00133 }; 00134 00135 } //namespace 00136 00137 00138 #endif
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011 |