|
ytParseArgs * | ytParseArgs_new () |
| Creates a new ytParseArgs instance.
|
|
void | ytParseArgs_delete (ytParseArgs *this) |
| Deletes the ytParseArgs instance.
|
|
void | ytParseArgs_addString (ytParseArgs *this, const char *key, char **arg) |
| Adds a key that takes a string (char * ) value.
|
|
void | ytParseArgs_addStringOpt (ytParseArgs *this, const char *key, char **arg) |
| Adds a key that takes a string (char * ) value. The value can be omitted.
|
|
void | ytParseArgs_addInt (ytParseArgs *this, const char *key, int *arg) |
| Adds a key that takes an int value.
|
|
void | ytParseArgs_addDouble (ytParseArgs *this, const char *key, double *arg) |
| Adds a key that takes a double value.
|
|
void | ytParseArgs_addOn (ytParseArgs *this, const char *key, int *arg) |
| Adds a key that sets an int value of 1 if it exists.
|
|
void | ytParseArgs_addOff (ytParseArgs *this, const char *key, int *arg) |
| Adds a key that sets an int value of 0 if it exists.
|
|
void | ytParseArgs_addOnOff (ytParseArgs *this, const char *key, int *arg) |
| Adds a key that sets an int value of 0 or 1.
|
|
void | ytParseArgs_addIntArray (ytParseArgs *this, const char *key, ytIntArray **arg) |
| Adds a key that sets an integer array to a ytIntArray instance.
|
|
void | ytParseArgs_addStrArray (ytParseArgs *this, const char *key, ytStrArray **arg) |
| Adds a key that sets a string array to a ytStrArray instance.
|
|
void | ytParseArgs_addStrArrayAdd (ytParseArgs *this, const char *key, ytStrArray **arg) |
| Adds a key that adds a string to a ytStrArray instance.
|
|
void | ytParseArgs_addDoubleArray (ytParseArgs *this, const char *key, ytDoubleArray **arg) |
| Adds a key that sets a double array to a ytDoubleArray instance.
|
|
void | ytParseArgs_addKeyValues (ytParseArgs *this, const char *key, ytKeyValues **arg) |
| Adds a key that accepts key=value style values as ytKeyValues.
|
|
void | ytParseArgs_addKeyValuesArray (ytParseArgs *this, const char *key, ytArray **arg) |
| Adds a key that accepts key=value style values as a ytKeyValues instance and adds them to the ytArray instance.
|
|
void | ytParseArgs_addFunc (ytParseArgs *this, const char *key, void(*f)()) |
| Adds a key that calls the specified function.
|
|
void | ytParseArgs_addFunc3 (ytParseArgs *this, const char *key, void(*f)(const char *, const char *, void *), void *arg) |
| Adds a key that calls the specified function with its argument.
|
|
void | ytParseArgs_addNone (ytParseArgs *this, const char *key) |
| Adds a key to ignore.
|
|
int | ytParseArgs_set (ytParseArgs *parser, int argc, char **argv) |
| Parses command line arguments.
|
|
int | ytParseArgs_setKV (ytParseArgs *parser, const ytKeyValues *kv, int opt) |
| Sets values in the variables from the ytKeyValues instance.
|
|
ytKeyValues * | ytParseArgs_genKV (int argc, char **argv, const char *defKey) |
| Generates ytKeyValues instance from command line arguments.
|
|
void | ytParseArgs_verbose (ytParseArgs *this, int e) |
| Sets the verbose level.
|
|
#define | ytParseArgs_DEFAULT_KEY |
| Default key for an argument without a key.
|
|
#define | ytParseArgs_OPT_ERROR |
| Specifies to stop if the action is not registered.
|
|
#define | ytParseArgs_OPT_WARNING |
| Specifies to put a warning message if the action is not registered.
|
|
#define | ytParseArgs_OPT_IGNORE |
| Specifies to ignore if the action is not registered.
|
|
#define | ytPA_int(this, key, arg) ytParseArgs_addInt(this, key, arg) |
| Short Macro.
|
|
#define | ytPA_double(this, key, arg) ytParseArgs_addDouble(this, key, arg) |
| Short Macro.
|
|
#define | ytPA_str(this, key, arg) ytParseArgs_addString(this, key, arg) |
| Short Macro.
|
|
Structure for parsing command line arguments.
Specify the array of this structure as the first argument of ytParseArgs_set(). The field ParseArgs::key of the last element of the array has to be NULL to represent the end of the array.
Example
int main(int argc, char * argv[]){
int v = 0;
char * s = "not set";
if(r > 0){
printf("Parsing Error: %s\n", argv[r]);
}
printf("v = %d\n", v);
printf("s = %s\n", s);
return 0;
}
Structure for parsing command line arguments.
int ytParseArgs_set(ytParseArgs *parser, int argc, char **argv)
Parses command line arguments.
Definition ytParseArgs.c:991
ytParseArgs * ytParseArgs_new()
Creates a new ytParseArgs instance.
Definition ytParseArgs.c:151
void ytParseArgs_delete(ytParseArgs *this)
Deletes the ytParseArgs instance.
Definition ytParseArgs.c:168
void ytParseArgs_addInt(ytParseArgs *this, const char *key, int *arg)
Adds a key that takes an int value.
Definition ytParseArgs.c:269
void ytParseArgs_addString(ytParseArgs *this, const char *key, char **arg)
Adds a key that takes a string (char *) value.
Definition ytParseArgs.c:251
ytLib Programming API Document
void ytParseArgs_addOnOff |
( |
ytParseArgs * |
this, |
|
|
const char * |
key, |
|
|
int * |
arg |
|
) |
| |
Adds a key that sets an int
value of 0 or 1.
If a value on
, 1
, true
, t
, or yes
is given, an integer 1 is set to the given variable.
If a value off
, 0
, false
, f
, or no
is given, an integer 0 is set to the given variable.
- Parameters
-
this | |
key | key of this argument. |
arg | pointer to the variable to be set by this argument. |