NAME
conf_get_argument, conf_get_argument_count - retrieve a directive's argument
LIBRARY
Configuration parser (libconfetti, -lconfetti)
SYNOPSIS
#include <confetti.h>
const char *conf_get_argument(const conf_directive *dir, long index);
long conf_get_argument_count(const conf_directive *dir);
DESCRIPTION
The conf_get_argument() function returns the argument at index for directive dir. The pointer returned remains valid until the configuration unit that directive dir is derived from is released with conf_free(3).
The conf_get_argument_count() function returns the number of arguments dir has.
Argument structure
The conf_argument structure includes the following fields:
const char *value;
size_t lexeme_offset;
size_t lexeme_length;
bool is_expression;
The value field is the evaluated argument as a null-terminated UTF-8 encoded string. The string is freed with the configuration unit.
The lexeme_offset and lexeme_length fields describe the span of UTF-8 code units of the argument in the Confetti source text.
The is_expression field, if true, indicates the argument is an expression argument. Expression arguments are arguments enclosed in parentheses. Expression arguments are a language extension enabled via the conf_extensions structure.
RETURN VALUE
The conf_get_argument() function returns the argument at index for the Confetti directive dir. If index is out-of-bounds or dir is NULL, then NULL is returned.
The conf_get_argument_count() function returns the number of arguments for the Confetti directive dir.
SEE ALSO
conf_get_directive(3), conf_get_directive_count(3)
LICENSING
Confetti is Open Source software distributed under the MIT License. Please see the LICENSE file included with the Confetti distribution for details.