|
libclap 1.0.0
Command Line Argument Parser for C
|
Type definitions for libclap. More...


Go to the source code of this file.
Typedefs | |
| typedef struct clap_parser_s | clap_parser_t |
| typedef struct clap_argument_s | clap_argument_t |
| typedef struct clap_namespace_s | clap_namespace_t |
| typedef bool(* | clap_type_handler_t) (const char *input, void *output, size_t output_size, clap_error_t *error) |
| Type validation / conversion handler function pointer. | |
| typedef bool(* | clap_action_handler_t) (clap_parser_t *parser, clap_argument_t *argument, clap_namespace_t *namespace, const char **values, size_t value_count, void *user_data, clap_error_t *error) |
| Custom action handler function pointer. | |
Enumerations | |
| enum | clap_parse_result_t { CLAP_PARSE_SUCCESS = 0 , CLAP_PARSE_ERROR = 1 , CLAP_PARSE_HELP = 2 , CLAP_PARSE_VERSION = 3 } |
| Parse result codes returned by clap_parse_args() More... | |
Type definitions for libclap.
| typedef bool(* clap_action_handler_t) (clap_parser_t *parser, clap_argument_t *argument, clap_namespace_t *namespace, const char **values, size_t value_count, void *user_data, clap_error_t *error) |
Custom action handler function pointer.
Invoked when a CUSTOM-action argument is encountered during parsing. The handler receives the full parser context and the list of values associated with this argument occurrence.
| parser | The parser being used for this parse run. The handler may inspect parser state but should not add/modify arguments or groups during parsing. |
| argument | The argument definition that triggered this handler. |
| namespace | The result namespace. Write parsed values here via clap_namespace_set_* / clap_namespace_append_*. |
| values | Array of raw string values for this occurrence. For nargs=1 or the first value of nargs>1, this contains one element. The handler is called once per argument occurrence. |
| value_count | Number of elements in values. |
| user_data | Opaque pointer set via clap_argument_data(). May be NULL. |
| error | Set on failure with a descriptive message. |
| typedef struct clap_argument_s clap_argument_t |
| typedef struct clap_namespace_s clap_namespace_t |
| typedef struct clap_parser_s clap_parser_t |
| typedef bool(* clap_type_handler_t) (const char *input, void *output, size_t output_size, clap_error_t *error) |
Type validation / conversion handler function pointer.
Converts a string input into a typed value. Built-in handlers exist for "string", "int", "float", and "bool" and their converted output is persisted in the namespace.
Custom type handlers registered via clap_register_type() are used for validation only — the handler must return false on invalid input, but the converted output value is discarded. The raw input string is always stored in the namespace, retrievable via clap_namespace_get_string(). Use CLAP_ACTION_CUSTOM if you need to persist a typed conversion result.
| input | NUL-terminated string to convert. |
| output | Pointer to output buffer of output_size bytes. The handler writes the converted value here. |
| output_size | Size of the output buffer in bytes. |
| error | Optional (may be NULL). Set on failure with a descriptive message. |
| enum clap_parse_result_t |
Parse result codes returned by clap_parse_args()
CLAP_PARSE_SUCCESS (0): Parsing completed successfully. CLAP_PARSE_ERROR (1): An error occurred; check clap_error_t. CLAP_PARSE_HELP (2): –help or -h was requested; help has been printed to stdout. The caller should exit with code 0. CLAP_PARSE_VERSION(3): –version was requested; version has been printed to stdout. The caller should exit with code 0.
| Enumerator | |
|---|---|
| CLAP_PARSE_SUCCESS | |
| CLAP_PARSE_ERROR | |
| CLAP_PARSE_HELP | |
| CLAP_PARSE_VERSION | |