Visual Servoing Platform  version 3.5.1 under development (2022-12-01)
vpParseArgv.h
1 /****************************************************************************
2  *
3  * Declarations for Tk-related things that are visible
4  * outside of the Tk module itself.
5  *
6  * Copyright 1989-1992 Regents of the University of California.
7  * Permission to use, copy, modify, and distribute this
8  * software and its documentation for any purpose and without
9  * fee is hereby granted, provided that the above copyright
10  * notice appear in all copies. The University of California
11  * makes no representations about the suitability of this
12  * software for any purpose. It is provided "as is" without
13  * express or implied warranty.
14  *
15  * This file has been modified to be used only for argv parsing without
16  * reference to tk, tcl or X11. Base on tk.h from tk2.3
17  *
18  * Description:
19  * Command line argument parsing.
20  *
21  * Authors:
22  * Fabien Spindler (modification of the original version)
23  *
24  *****************************************************************************/
25 
31 #ifndef vpParseArgv_h
32 #define vpParseArgv_h
33 
34 #include <visp3/core/vpConfig.h>
35 #include <visp3/core/vpException.h>
36 
147 class VISP_EXPORT vpParseArgv
148 {
149 public:
153  typedef enum {
166  ARGV_END
167  } vpArgvType;
168 
172  typedef enum {
173  ARGV_NO_DEFAULTS = 0x1,
174  ARGV_NO_LEFTOVERS = 0x2,
175  ARGV_NO_ABBREV = 0x4,
177  ARGV_DONT_SKIP_FIRST_ARG = 0x8,
178  ARGV_NO_PRINT = 0x10
179  } vpArgvFlags;
180 
181 #ifndef DOXYGEN_SHOULD_SKIP_THIS
186  typedef struct {
187  const char *key;
188  vpArgvType type;
189  const char *src;
190  const char *dst;
191  const char *help;
192  } vpArgvInfo;
193 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
194 
195 public:
196  static vpArgvInfo defaultTable[2];
197  static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags);
198  static int parse(int argc, const char **argv, const char *validOpts, const char **param);
199 
200 private:
201  static void printUsage(vpArgvInfo *argTable, int flags);
202 };
203 
204 #endif
Command line argument parsing.
Definition: vpParseArgv.h:148
@ ARGV_DOUBLE
Argument is associated to a double.
Definition: vpParseArgv.h:162
@ ARGV_LONG
Argument is associated to a long.
Definition: vpParseArgv.h:158
@ ARGV_STRING
Argument is associated to a char * string.
Definition: vpParseArgv.h:159
@ ARGV_FLOAT
Argument is associated to a float.
Definition: vpParseArgv.h:161
@ ARGV_CONSTANT
Stand alone argument. Same as vpParseArgv::ARGV_CONSTANT_INT.
Definition: vpParseArgv.h:154
@ ARGV_INT
Argument is associated to an int.
Definition: vpParseArgv.h:157
@ ARGV_CONSTANT_BOOL
Stand alone argument associated to a bool var that is set to true.
Definition: vpParseArgv.h:156
@ ARGV_CONSTANT_INT
Stand alone argument associated to an int var that is set to 1.
Definition: vpParseArgv.h:155
@ ARGV_HELP
Argument is for help displaying.
Definition: vpParseArgv.h:165