le_args.h
Go to the documentation of this file.
19 * The arguments can be fetched by index using @c le_arg_GetArg(). The first argument has index 0,87 * to be set or call-back functions to be called when certain arguments are passed to the program.111 * - le_arg_AddPositionalCallback() - Registers a call-back function to be called by le_arg_Scan()129 * le_utf8_ParseInt() can be used by a positional callback to convert the string value it receives186 * framework's build tools (@c mksys, @c mkapp, or @c mkexe ), then you must call le_arg_SetArgs()195 //--------------------------------------------------------------------------------------------------207 //--------------------------------------------------------------------------------------------------213 //--------------------------------------------------------------------------------------------------220 //--------------------------------------------------------------------------------------------------227 //--------------------------------------------------------------------------------------------------234 //--------------------------------------------------------------------------------------------------238 * @return Pointer to the argument string (null-terminated), or NULL if the index is out of range.240 //--------------------------------------------------------------------------------------------------247 //--------------------------------------------------------------------------------------------------259 //--------------------------------------------------------------------------------------------------267 //--------------------------------------------------------------------------------------------------270 * (e.g., <c>-c 1234</c>) or a long name (e.g., <c>--count=1234</c>) form of the same option at the281 //--------------------------------------------------------------------------------------------------290 //--------------------------------------------------------------------------------------------------306 //--------------------------------------------------------------------------------------------------315 //--------------------------------------------------------------------------------------------------324 //--------------------------------------------------------------------------------------------------333 //--------------------------------------------------------------------------------------------------342 //--------------------------------------------------------------------------------------------------351 //--------------------------------------------------------------------------------------------------365 //--------------------------------------------------------------------------------------------------374 //--------------------------------------------------------------------------------------------------376 * Flag argument callback functions registered using le_arg_SetFlagCallback() must conform to this381 //--------------------------------------------------------------------------------------------------384 //--------------------------------------------------------------------------------------------------386 * Register a callback function to be called if a given flag option appears on the argument list.393 //--------------------------------------------------------------------------------------------------402 //--------------------------------------------------------------------------------------------------411 //--------------------------------------------------------------------------------------------------413 (417 //--------------------------------------------------------------------------------------------------427 //--------------------------------------------------------------------------------------------------436 //--------------------------------------------------------------------------------------------------445 //--------------------------------------------------------------------------------------------------447 (451 //--------------------------------------------------------------------------------------------------453 * Register a callback function to be called if a given string option appears on the argument list.460 //--------------------------------------------------------------------------------------------------469 //--------------------------------------------------------------------------------------------------472 * For example, in the following command-line, "foo" and "bar" are positional arguments (while "-l"483 * the last positional callback will be called once for each positional argument from M through N,486 //--------------------------------------------------------------------------------------------------493 //--------------------------------------------------------------------------------------------------497 * If more positional arguments are encountered than the number of positional callbacks when this498 * is allowed, le_arg_Scan() will call the last positional callback again for each extra positional503 //--------------------------------------------------------------------------------------------------510 //--------------------------------------------------------------------------------------------------514 * If less positional arguments are encountered than the number of positional callbacks when this515 * is allowed, any positional callbacks that don't have arguments won't be called. If this is not520 //--------------------------------------------------------------------------------------------------527 //--------------------------------------------------------------------------------------------------548 //--------------------------------------------------------------------------------------------------550 (556 //--------------------------------------------------------------------------------------------------558 * Register an error handler function to be called by le_arg_Scan() whenever an unexpected argument561 //--------------------------------------------------------------------------------------------------568 //--------------------------------------------------------------------------------------------------572 * The default behaviour is to exit. If this is set to false then le_arg_GetScanResult() should be575 //--------------------------------------------------------------------------------------------------582 //--------------------------------------------------------------------------------------------------586 * If process termination is disabled via le_arg_SetExitOnError(), then this function may be used591 //--------------------------------------------------------------------------------------------------597 //--------------------------------------------------------------------------------------------------602 //--------------------------------------------------------------------------------------------------609 //--------------------------------------------------------------------------------------------------616 //--------------------------------------------------------------------------------------------------624 //--------------------------------------------------------------------------------------------------626 * Tokenizes a string into individual arguments. Simple quoting is allowed using either ' or " to635 //--------------------------------------------------------------------------------------------------size_t le_arg_NumArgs(void)void le_arg_SetArgs(const size_t argc, const char **argv)le_result_t le_arg_GetIntOption(int *varPtr, const char *shortName, const char *longName)void le_arg_SetStringCallback(le_arg_StringCallbackFunc_t func, const char *shortName, const char *longName)void le_arg_SetExitOnError(bool exitOnError)void le_arg_SetStringVar(const char **varPtr, const char *shortName, const char *longName)le_result_t le_arg_GetScanResult(void)void le_arg_AllowMorePositionalArgsThanCallbacks(void)void le_arg_SetIntVar(int *varPtr, const char *shortName, const char *longName)const char * le_arg_GetProgramName(void)void le_arg_SetFlagCallback(le_arg_FlagCallbackFunc_t func, const char *shortName, const char *longName)void le_arg_Scan(void)void le_arg_SetFlagVar(bool *varPtr, const char *shortName, const char *longName)const char * le_arg_GetArg(size_t argIndex)void le_arg_AddPositionalCallback(le_arg_StringCallbackFunc_t func)void le_arg_AllowLessPositionalArgsThanCallbacks(void)void le_arg_SetErrorHandler(le_arg_ErrorHandlerFunc_t errorHandlerFunc)size_t(* le_arg_ErrorHandlerFunc_t)(size_t argIndex, le_result_t errorCode)Definition: le_args.h:550void(* le_arg_StringCallbackFunc_t)(const char *value)Definition: le_args.h:447le_result_t le_arg_Split(const char *firstStr, char *cmdlinePtr, int *argc, const char **argv)le_result_t le_arg_GetFlagOption(const char *shortName, const char *longName)void le_arg_SetIntCallback(le_arg_IntCallbackFunc_t func, const char *shortName, const char *longName)le_result_t le_arg_GetStringOption(const char **varPtr, const char *shortName, const char *longName)