Visual Servoing Platform
version 3.3.0 under development (2020-02-17)
|
#include <visp3/io/vpParseArgv.h>
Public Types | |
enum | vpArgvType { ARGV_CONSTANT, ARGV_CONSTANT_INT, ARGV_CONSTANT_BOOL, ARGV_INT, ARGV_LONG, ARGV_STRING, ARGV_REST, ARGV_FLOAT, ARGV_DOUBLE, ARGV_FUNC, ARGV_GENFUNC, ARGV_HELP, ARGV_END } |
enum | vpArgvFlags { ARGV_NO_DEFAULTS = 0x1, ARGV_NO_LEFTOVERS = 0x2, ARGV_NO_ABBREV = 0x4, ARGV_DONT_SKIP_FIRST_ARG = 0x8, ARGV_NO_PRINT = 0x10 } |
Static Public Member Functions | |
static bool | parse (int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags) |
static int | parse (int argc, const char **argv, const char *validOpts, const char **param) |
Static Public Attributes | |
static vpArgvInfo | defaultTable [2] |
Command line argument parsing.
The code below shows a first way to parse command line arguments using vpParseArgv class. It allows to specify an option name with more than one character.
The code below shows an other way to parse command line arguments using vpParseArgv class. Here command line options are only one character long.
Definition at line 147 of file vpParseArgv.h.
Flag bits.
Definition at line 172 of file vpParseArgv.h.
Legal values for the type field of a vpArgvInfo.
Enumerator | |
---|---|
ARGV_CONSTANT | Stand alone argument. Same as vpParseArgv::ARGV_CONSTANT_INT. |
ARGV_CONSTANT_INT | Stand alone argument associated to an int var that is set to 1. |
ARGV_CONSTANT_BOOL | Stand alone argument associated to a bool var that is set to true. |
ARGV_INT | Argument is associated to an int. |
ARGV_LONG | Argument is associated to a long. |
ARGV_STRING | Argument is associated to a char * string. |
ARGV_REST | |
ARGV_FLOAT | Argument is associated to a float. |
ARGV_DOUBLE | Argument is associated to a double. |
ARGV_FUNC | |
ARGV_GENFUNC | |
ARGV_HELP | Argument is for help displaying. |
ARGV_END | End of the argument list. |
Definition at line 153 of file vpParseArgv.h.
|
static |
Process an argv array according to a table of expectedvcommand-line options.
The return value is a boolean value with true indicating an error. If an error occurs then an error message is printed on stderr. Under normal conditions, both *argcPtr and *argv are modified to return the arguments that couldn't be processed here (they didn't match the option table, or followed an vpParseArgv::ARGV_REST argument).
argcPtr | Pointer to the count of command line arguments. |
argv | Array of command line argument strings. |
argTable | Array of command-specific argument descriptions. |
flags | This parameter is to set with vpParseArgv::vpArgvFlags values or combinations of these values using the OR operator (vpParseArgv::ARGV_NO_LEFTOVERS | vpParseArgv::ARGV_NO_DEFAULTS). If the vpParseArgv::ARGV_NO_DEFAULTS bit is set, then don't generate information for default options. |
Definition at line 69 of file vpParseArgv.cpp.
References ARGV_CONSTANT, ARGV_CONSTANT_BOOL, ARGV_CONSTANT_INT, ARGV_DONT_SKIP_FIRST_ARG, ARGV_DOUBLE, ARGV_END, ARGV_FLOAT, ARGV_FUNC, ARGV_GENFUNC, ARGV_HELP, ARGV_INT, ARGV_LONG, ARGV_NO_ABBREV, ARGV_NO_DEFAULTS, ARGV_NO_LEFTOVERS, ARGV_REST, ARGV_STRING, and defaultTable.
|
static |
Get next command line option and parameter.
argc | Count of command line arguments. |
argv | Array of command line argument strings. |
validOpts | String of valid case-sensitive option characters, a ':' following a given character means that option can take a parameter. |
param | Pointer to a pointer to a string for output. |
Definition at line 498 of file vpParseArgv.cpp.
|
static |
Definition at line 195 of file vpParseArgv.h.
Referenced by parse().