Config-UCL
view release on metacpan or search on metacpan
libucl-0.8.1/include/ucl.h view on Meta::CPAN
/**
* Create new safe iterator for the specified object
* @param obj object to iterate
* @return new iterator object that should be used with safe iterators API only
*/
UCL_EXTERN ucl_object_iter_t ucl_object_iterate_new (const ucl_object_t *obj)
UCL_WARN_UNUSED_RESULT;
/**
* Reset initialized iterator to a new object
* @param obj new object to iterate
* @return modified iterator object
*/
UCL_EXTERN ucl_object_iter_t ucl_object_iterate_reset (ucl_object_iter_t it,
const ucl_object_t *obj);
/**
* Get the next object from the `obj`. This function iterates over arrays, objects
* and implicit arrays
* @param iter safe iterator
* @param expand_values expand explicit arrays and objects
* @return the next object in sequence
*/
UCL_EXTERN const ucl_object_t* ucl_object_iterate_safe (ucl_object_iter_t iter,
bool expand_values);
/**
* Iteration type enumerator
*/
enum ucl_iterate_type {
UCL_ITERATE_EXPLICIT = 1 << 0, /**< Iterate just explicit arrays and objects */
UCL_ITERATE_IMPLICIT = 1 << 1, /**< Iterate just implicit arrays */
UCL_ITERATE_BOTH = (1 << 0) | (1 << 1), /**< Iterate both explicit and implicit arrays*/
};
/**
* Get the next object from the `obj`. This function iterates over arrays, objects
* and implicit arrays if needed
* @param iter safe iterator
* @param
* @return the next object in sequence
*/
UCL_EXTERN const ucl_object_t* ucl_object_iterate_full (ucl_object_iter_t iter,
enum ucl_iterate_type type);
/**
* Free memory associated with the safe iterator
* @param it safe iterator object
*/
UCL_EXTERN void ucl_object_iterate_free (ucl_object_iter_t it);
/** @} */
/**
* @defgroup parser Parsing functions
* These functions are used to parse UCL objects
*
* @{
*/
/**
* Macro handler for a parser
* @param data the content of macro
* @param len the length of content
* @param arguments arguments object
* @param ud opaque user data
* @param err error pointer
* @return true if macro has been parsed
*/
typedef bool (*ucl_macro_handler) (const unsigned char *data, size_t len,
const ucl_object_t *arguments,
void* ud);
/**
* Context dependent macro handler for a parser
* @param data the content of macro
* @param len the length of content
* @param arguments arguments object
* @param context previously parsed context
* @param ud opaque user data
* @param err error pointer
* @return true if macro has been parsed
*/
typedef bool (*ucl_context_macro_handler) (const unsigned char *data, size_t len,
const ucl_object_t *arguments,
const ucl_object_t *context,
void* ud);
/* Opaque parser */
struct ucl_parser;
/**
* Creates new parser object
* @param pool pool to allocate memory from
* @return new parser object
*/
UCL_EXTERN struct ucl_parser* ucl_parser_new (int flags);
/**
* Sets the default priority for the parser applied to chunks that do not
* specify priority explicitly
* @param parser parser object
* @param prio default priority (0 .. 16)
* @return true if parser's default priority was set
*/
UCL_EXTERN bool ucl_parser_set_default_priority (struct ucl_parser *parser,
unsigned prio);
/**
* Gets the default priority for the parser applied to chunks that do not
* specify priority explicitly
* @param parser parser object
* @return true default priority (0 .. 16), -1 for failure
*/
UCL_EXTERN int ucl_parser_get_default_priority (struct ucl_parser *parser);
/**
* Register new handler for a macro
* @param parser parser object
* @param macro macro name (without leading dot)
* @param handler handler (it is called immediately after macro is parsed)
* @param ud opaque user data for a handler
*/
( run in 1.101 second using v1.01-cache-2.11-cpan-39bf76dae61 )