Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages | Examples

ArArgumentParser.h

00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 #ifndef ARARGUMENTPARSER_H
00027 #define ARARGUMENTPARSER_H
00028 
00029 #include "ariaTypedefs.h"
00030 #include "ArArgumentBuilder.h"
00031 
00033 
00051 class ArArgumentParser
00052 {
00053 public:
00055   AREXPORT ArArgumentParser(int *argc, char **argv);
00057   AREXPORT ArArgumentParser(ArArgumentBuilder *builder);
00059   AREXPORT ~ArArgumentParser();
00061   AREXPORT bool checkArgument(const char *argument);
00063   AREXPORT char *checkParameterArgument(char *argument, 
00064                     bool returnFirst = false);
00066   AREXPORT bool checkParameterArgumentString(char *argument, 
00067                          const char **dest, 
00068                          bool *wasReallySet = NULL,
00069                          bool returnFirst = false);
00071   AREXPORT bool checkParameterArgumentInteger(char *argument, int *dest,
00072                           bool *wasReallySet = NULL, 
00073                           bool returnFirst = false);
00075   AREXPORT bool checkParameterArgumentBool(char *argument, bool *dest,
00076                        bool *wasReallySet = NULL,
00077                        bool returnFirst = false);
00079   AREXPORT bool checkParameterArgumentFloat(char *argument, float *dest, 
00080                 bool *wasReallySet = NULL, bool returnFirst = false);
00082   AREXPORT void addDefaultArgument(const char *argument, int position = -1);
00084   AREXPORT void loadDefaultArguments(int positon = 1);
00086   AREXPORT bool checkHelpAndWarnUnparsed(unsigned int numArgsOkay = 0);
00088   AREXPORT size_t getArgc(void) const;
00090   AREXPORT char** getArgv(void) const;
00092   AREXPORT const char* getArg(size_t whichArg) const;
00094   AREXPORT void log(void) const;
00096   AREXPORT void removeArg(size_t which);
00098   AREXPORT static void addDefaultArgumentFile(const char *file);
00100   AREXPORT static void addDefaultArgumentEnv(const char *env);
00102   AREXPORT static void logDefaultArgumentLocations(void);
00103 #ifndef SWIG
00104 
00107   AREXPORT bool checkArgumentVar(char *argument, ...);
00111   AREXPORT char *checkParameterArgumentVar(char *argument, ...);
00115   AREXPORT bool checkParameterArgumentStringVar(bool *wasReallySet, 
00116                         const char **dest, 
00117                         char *argument, ...);
00121   AREXPORT bool checkParameterArgumentBoolVar(bool *wasReallySet, bool *dest,
00122                           char *argument, ...);
00126   AREXPORT bool checkParameterArgumentIntegerVar(bool *wasReallySet, int *dest,
00127                          char *argument, ...);
00128 #endif
00129 protected:
00130   static std::list<std::string> ourDefaultArgumentLocs;
00131   static std::list<bool> ourDefaultArgumentLocIsFile;
00132   bool myOwnBuilder;
00133   ArArgumentBuilder *myBuilder;
00134   bool myUsingBuilder;
00135   char **myArgv;
00136   int *myArgc;
00137   char myEmptyArg[1];
00138 };
00139 
00140 
00141 #endif // ARARGUMENTPARSER_H

Generated on Tue Feb 20 10:51:38 2007 for Aria by  doxygen 1.4.0