[][src]Crate uclicious_libucl_sys

Re-exports

pub use self::ucl_error as ucl_error_t;
pub use self::ucl_type as ucl_type_t;
pub use self::ucl_emitter as ucl_emitter_t;
pub use self::ucl_parser_flags as ucl_parser_flags_t;
pub use self::ucl_string_flags as ucl_string_flags_t;
pub use self::ucl_object_flags as ucl_object_flags_t;

Structs

pthread
pthread_mutex
ucl_emitter_context

@defgroup emitter Emitting functions These functions are used to serialise UCL objects to some string representation.

ucl_emitter_functions

Structure using for emitter callbacks

ucl_emitter_operations
ucl_object_flags

Basic flags for an object

ucl_object_s

UCL object structure. Please mention that the most of fields should not be touched by UCL users. In future, this structure may be converted to private one.

ucl_parser
ucl_parser_flags

These flags defines parser behaviour. If you specify #UCL_PARSER_ZEROCOPY you must ensure that the input memory is not freed if an object is in use. Moreover, if you want to use zero-terminated keys and string values then you should not use zero-copy mode, as in this case UCL still has to perform copying implicitly.

ucl_schema_error

Generic ucl schema error

ucl_string_flags

String conversion flags, that are used in #ucl_object_fromstring_common function.

Enums

ucl_duplicate_strategy

Duplicate policy types

ucl_emitter

You can use one of these types to serialise #ucl_object_t by using ucl_object_emit().

ucl_error

The common error codes returned by ucl parser

ucl_iterate_type

Iteration type enumerator

ucl_parse_type

Input format type

ucl_schema_error_code

Used to define UCL schema error

ucl_type

#ucl_object_t may have one of specified types, some types are compatible with each other and some are not. For example, you can always convert #UCL_TIME to #UCL_FLOAT. Also you can convert #UCL_FLOAT to #UCL_INTEGER by loosing floating point. Every object may be converted to a string by #ucl_object_tostring_forced() function.

Functions

ucl_array_append

Append an element to the end of array object @param top destination object (must NOT be NULL) @param elt element to append (must NOT be NULL) @return true if value has been inserted

ucl_array_delete

Removes an element elt from the array top, returning the object that was removed. This object is not released, caller must unref the returned object when it is no longer needed. @param top array ucl object @param elt element to remove @return removed element or NULL if top is NULL or not an array

ucl_array_find_index

Return object identified by index of the array top @param top object to get a key from (must be of type UCL_ARRAY) @param index array index to return @return object at the specified index or NULL if index is not found

ucl_array_head

Returns the first element of the array top @param top array ucl object @return element or NULL if top is NULL or not an array

ucl_array_index_of

Return the index of elt in the array top @param top object to get a key from (must be of type UCL_ARRAY) @param elt element to find index of (must NOT be NULL) @return index of elt in the array top or (unsigned int)-1 if elt` is not found

ucl_array_merge

Merge all elements of second array into the first array @param top destination array (must be of type UCL_ARRAY) @param elt array to copy elements from (must be of type UCL_ARRAY) @param copy copy elements instead of referencing them @return true if arrays were merged

ucl_array_pop_first

Removes the first element from the array top, returning the object that was removed. This object is not released, caller must unref the returned object when it is no longer needed. @param top array ucl object @return removed element or NULL if top is NULL or not an array

ucl_array_pop_last

Removes the last element from the array top, returning the object that was removed. This object is not released, caller must unref the returned object when it is no longer needed. @param top array ucl object @return removed element or NULL if top is NULL or not an array

ucl_array_prepend

Append an element to the start of array object @param top destination object (must NOT be NULL) @param elt element to append (must NOT be NULL) @return true if value has been inserted

ucl_array_replace_index

Replace an element in an array with a different element, returning the object that was replaced. This object is not released, caller must unref the returned object when it is no longer needed. @param top destination object (must be of type UCL_ARRAY) @param elt element to append (must NOT be NULL) @param index array index in destination to overwrite with elt @return object that was replaced or NULL if index is not found

ucl_array_size

Return size of the array top @param top object to get size from (must be of type UCL_ARRAY) @return size of the array

ucl_array_tail

Returns the last element of the array top @param top array ucl object @return element or NULL if top is NULL or not an array

ucl_comments_add

Adds a new comment for an object @param comments comments object @param obj object to add comment to @param comment string representation of a comment

ucl_comments_find

Utility function to find a comment object for the specified object in the input @param comments comments object @param srch search object @return string comment enclosed in ucl_object_t

ucl_comments_move

Move comment from from object to to object @param comments comments object @param what source object @param with destination object @return true if from has comment and it has been moved to to

ucl_copy_key_trash

@defgroup utils Utility functions A number of utility functions simplify handling of UCL objects

ucl_copy_value_trash

Copy and return a string value of an object, returned key is zero-terminated @param obj CL object @return zero terminated string representation of object value

ucl_elt_append

Append a element to another element forming an implicit array @param head head to append (may be NULL) @param elt new element @return the new implicit array

ucl_object_array_sort

Sort UCL array using cmp compare function @param ar @param cmp

ucl_object_compare

Compare objects o1 and o2 @param o1 the first object @param o2 the second object @return values >0, 0 and <0 if o1 is more than, equal and less than o2. The order of comparison:

ucl_object_compare_qsort

Compare objects o1 and o2 useful for sorting @param o1 the first object @param o2 the second object @return values >0, 0 and <0 if o1 is more than, equal and less than o2. The order of comparison:

ucl_object_copy

Perform deep copy of an object copying everything @param other object to copy @return new object with refcount equal to 1

ucl_object_delete_key

Delete a object associated with key 'key', old object will be unrefered, @param top object @param key key associated to the object to remove

ucl_object_delete_keyl

Delete a object associated with key 'key', old object will be unrefered, @param top object @param key key associated to the object to remove @param keylen length of the key (or 0 for NULL terminated keys)

ucl_object_emit

Emit object to a string @param obj object @param emit_type if type is #UCL_EMIT_JSON then emit json, if type is #UCL_EMIT_CONFIG then emit config like object @return dump of an object (must be freed after using) or NULL in case of error

ucl_object_emit_fd_funcs

Returns functions to emit object to a file descriptor @param fd file descriptor @return emitter functions structure

ucl_object_emit_full

Emit object to a string @param obj object @param emit_type if type is #UCL_EMIT_JSON then emit json, if type is #UCL_EMIT_CONFIG then emit config like object @param emitter a set of emitter functions @param comments optional comments for the parser @return dump of an object (must be freed after using) or NULL in case of error

ucl_object_emit_funcs_free

Free emitter functions @param f pointer to functions

ucl_object_emit_len

Emit object to a string that can contain \0 inside @param obj object @param emit_type if type is #UCL_EMIT_JSON then emit json, if type is #UCL_EMIT_CONFIG then emit config like object @param len the resulting length @return dump of an object (must be freed after using) or NULL in case of error

ucl_object_emit_memory_funcs

Returns functions to emit object to memory @param pmem target pointer (should be freed by caller) @return emitter functions structure

ucl_object_emit_streamline_add_object

Add a complete UCL object to streamlined output @param ctx streamlined context @param obj object to output

ucl_object_emit_streamline_end_container

End previously added container @param ctx streamlined context

ucl_object_emit_streamline_finish

Terminate streamlined container finishing all containers in it @param ctx streamlined context

ucl_object_emit_streamline_new

Start streamlined UCL object emitter @param obj top UCL object @param emit_type emit type @param emitter a set of emitter functions @return new streamlined context that should be freed by ucl_object_emit_streamline_finish

ucl_object_emit_streamline_start_container

Start object or array container for the streamlined output @param ctx streamlined context @param obj container object

ucl_object_free
ucl_object_frombool

Create an object from a boolean @param bv bool value @return new object

ucl_object_fromdouble

Create an object from a float number @param dv number @return new object

ucl_object_fromint

Create an object from an integer number @param iv number @return new object

ucl_object_fromlstring

Create a UCL object from the specified string @param str fixed size string, will be json escaped @param len length of a string @return new object

ucl_object_fromstring

Create a UCL object from the specified string @param str NULL terminated string, will be json escaped @return new object

ucl_object_fromstring_common

Convert any string to an ucl object making the specified transformations @param str fixed size or NULL terminated string @param len length (if len is zero, than str is treated as NULL terminated) @param flags conversion flags @return new object

ucl_object_get_priority

Get the priority for specific UCL object @param obj any ucl object @return priority of an object

ucl_object_insert_key

Insert a object 'elt' to the hash 'top' and associate it with key 'key' @param top destination object (must be of type UCL_OBJECT) @param elt element to insert (must NOT be NULL) @param key key to associate with this object (either const or preallocated) @param keylen length of the key (or 0 for NULL terminated keys) @param copy_key make an internal copy of key @return true if key has been inserted

ucl_object_insert_key_merged

Insert a object 'elt' to the hash 'top' and associate it with key 'key', if the specified key exist, try to merge its content @param top destination object (must be of type UCL_OBJECT) @param elt element to insert (must NOT be NULL) @param key key to associate with this object (either const or preallocated) @param keylen length of the key (or 0 for NULL terminated keys) @param copy_key make an internal copy of key @return true if key has been inserted

ucl_object_iterate

Get next key from an object @param obj object to iterate @param iter opaque iterator, must be set to NULL on the first call: ucl_object_iter_t it = NULL; while ((cur = ucl_iterate_object (obj, &it)) != NULL) ... @return the next object or NULL

ucl_object_iterate_free

Free memory associated with the safe iterator @param it safe iterator object

ucl_object_iterate_full

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_object_iterate_new

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_object_iterate_reset

Reset initialized iterator to a new object @param obj new object to iterate @return modified iterator object

ucl_object_iterate_safe

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_object_key

Returns a key of an object as a NULL terminated string @param obj CL object @return key or NULL if there is no key

ucl_object_keyl

Returns a key of an object as a fixed size string (may be more efficient) @param obj CL object @param len target key length @return key pointer

ucl_object_lookup

Return object identified by a key in the specified object @param obj object to get a key from (must be of type UCL_OBJECT) @param key key to search @return object matching the specified key or NULL if key was not found

ucl_object_lookup_any

Return object identified by a key in the specified object, if the first key is not found then look for the next one. This process is repeated unless the next argument in the list is not NULL. So, ucl_object_find_any_key(obj, key, NULL) is equal to ucl_object_find_key(obj, key) @param obj object to get a key from (must be of type UCL_OBJECT) @param key key to search @param ... list of alternative keys to search (NULL terminated) @return object matching the specified key or NULL if key was not found

ucl_object_lookup_len

Return object identified by a fixed size key in the specified object @param obj object to get a key from (must be of type UCL_OBJECT) @param key key to search @param klen length of a key @return object matching the specified key or NULL if key was not found

ucl_object_lookup_path

Return object identified by dot notation string @param obj object to search in @param path dot.notation.path to the path to lookup. May use numeric .index on arrays @return object matched the specified path or NULL if path is not found

ucl_object_lookup_path_char

Return object identified by object notation string using arbitrary delimiter @param obj object to search in @param path dot.notation.path to the path to lookup. May use numeric .index on arrays @param sep the sepatorator to use in place of . (incase keys have . in them) @return object matched the specified path or NULL if path is not found

ucl_object_merge

Merge the keys from one object to another object. Overwrite on conflict @param top destination object (must be of type UCL_OBJECT) @param elt element to insert (must be of type UCL_OBJECT) @param copy copy rather than reference the elements @return true if all keys have been merged

ucl_object_new

Creates a new object @return new object

ucl_object_new_full

Create new object with type and priority specified @param type type of a new object @param priority priority of an object @return new object

ucl_object_new_userdata

Create new object with userdata dtor @param dtor destructor function @param emitter emitter for userdata @param ptr opaque pointer @return new object

ucl_object_pop_key

Removes key from top object returning the object that was removed. This object is not released, caller must unref the returned object when it is no longer needed. @param top object @param key key to remove @return removed object or NULL if object has not been found

ucl_object_pop_keyl

Removes key from top object, returning the object that was removed. This object is not released, caller must unref the returned object when it is no longer needed. @param top object @param key key to remove @param keylen length of the key (or 0 for NULL terminated keys) @return removed object or NULL if object has not been found

ucl_object_ref

Increase reference count for an object @param obj object to ref @return the referenced object

ucl_object_replace_key

Replace a object 'elt' to the hash 'top' and associate it with key 'key', old object will be unrefed, if no object has been found this function works like ucl_object_insert_key() @param top destination object (must be of type UCL_OBJECT) @param elt element to insert (must NOT be NULL) @param key key to associate with this object (either const or preallocated) @param keylen length of the key (or 0 for NULL terminated keys) @param copy_key make an internal copy of key @return true if key has been inserted

ucl_object_reserve

Reserve space in ucl array or object for elt elements @param obj object to reserve @param reserved size to reserve in an object

ucl_object_set_priority

Set explicit priority of an object. @param obj any ucl object @param priority new priroity value (only 4 least significant bits are considred)

ucl_object_string_to_type

Converts string that represents ucl type to real ucl type enum @param input C string with name of type @param res resulting target @return true if input is a name of type stored in res

ucl_object_toboolean

Unsafe version of \ref ucl_obj_toboolean_safe @param obj CL object @return boolean value

ucl_object_toboolean_safe

Converts an object to boolean value @param obj CL object @param target target boolean variable @return true if conversion was successful

ucl_object_todouble

Unsafe version of \ref ucl_obj_todouble_safe @param obj CL object @return double value

ucl_object_todouble_safe

Converts an object to double value @param obj CL object @param target target double variable @return true if conversion was successful

ucl_object_toint

Unsafe version of \ref ucl_obj_toint_safe @param obj CL object @return int value

ucl_object_toint_safe

Converts an object to integer value @param obj CL object @param target target integer variable @return true if conversion was successful

ucl_object_tolstring

Unsafe version of \ref ucl_obj_tolstring_safe @param obj CL object @return string value

ucl_object_tolstring_safe

Return string as char * and len, string may be not zero terminated, more efficient that \ref ucl_obj_tostring as it allows zero-copy (if #UCL_PARSER_ZEROCOPY has been used during parsing) @param obj CL object @param target target string variable, no need to free value @param tlen target length @return true if conversion was successful

ucl_object_tostring

Unsafe version of \ref ucl_obj_tostring_safe @param obj CL object @return string value

ucl_object_tostring_forced

Convert any object to a string in JSON notation if needed @param obj CL object @return string value

ucl_object_tostring_safe

Converts an object to string value @param obj CL object @param target target string variable, no need to free value @return true if conversion was successful

ucl_object_type

Return the type of an object @return the object type

ucl_object_type_to_string

Converts ucl object type to its string representation @param type type of object @return constant string describing type

ucl_object_typed_new

Create new object with type specified @param type type of a new object @return new object

ucl_object_unref

Decrease reference count for an object @param obj object to unref

ucl_object_validate

Validate object obj using schema object schema. @param schema schema object @param obj object to validate @param err error pointer, if this parameter is not NULL and error has been occurred, then err is filled with the exact error definition. @return true if obj is valid using schema

ucl_object_validate_root

Validate object obj using schema object schema and root schema at root. @param schema schema object @param obj object to validate @param root root schema object @param err error pointer, if this parameter is not NULL and error has been occurred, then err is filled with the exact error definition. @return true if obj is valid using schema

ucl_object_validate_root_ext

Validate object obj using schema object schema and root schema at root using some external references provided. @param schema schema object @param obj object to validate @param root root schema object @param ext_refs external references (might be modified during validation) @param err error pointer, if this parameter is not NULL and error has been occurred, then err is filled with the exact error definition. @return true if obj is valid using schema

ucl_parser_add_chunk

Load new chunk to a parser @param parser parser structure @param data the pointer to the beginning of a chunk @param len the length of a chunk @return true if chunk has been added and false in case of error

ucl_parser_add_chunk_full

Full version of ucl_add_chunk with priority and duplicate strategy @param parser parser structure @param data the pointer to the beginning of a chunk @param len the length of a chunk @param priority the desired priority of a chunk (only 4 least significant bits are considered for this parameter) @param strat duplicates merging strategy @param parse_type input format @return true if chunk has been added and false in case of error

ucl_parser_add_chunk_priority

Load new chunk to a parser with the specified priority @param parser parser structure @param data the pointer to the beginning of a chunk @param len the length of a chunk @param priority the desired priority of a chunk (only 4 least significant bits are considered for this parameter) @return true if chunk has been added and false in case of error

ucl_parser_add_fd

Load and add data from a file descriptor @param parser parser structure @param filename the name of file @param err if *err is NULL it is set to parser error @return true if chunk has been added and false in case of error

ucl_parser_add_fd_full

Load and add data from a file descriptor @param parser parser structure @param filename the name of file @param err if *err is NULL it is set to parser error @param priority the desired priority of a chunk (only 4 least significant bits are considered for this parameter) @param strat Merge strategy to use while parsing this file @param parse_type Parser type to use while parsing this file @return true if chunk has been added and false in case of error

ucl_parser_add_fd_priority

Load and add data from a file descriptor @param parser parser structure @param filename the name of file @param err if *err is NULL it is set to parser error @param priority the desired priority of a chunk (only 4 least significant bits are considered for this parameter) @return true if chunk has been added and false in case of error

ucl_parser_add_file

Load and add data from a file @param parser parser structure @param filename the name of file @param err if *err is NULL it is set to parser error @return true if chunk has been added and false in case of error

ucl_parser_add_file_full

Load and add data from a file @param parser parser structure @param filename the name of file @param priority the desired priority of a chunk (only 4 least significant bits are considered for this parameter) @param strat Merge strategy to use while parsing this file @param parse_type Parser type to use while parsing this file @return true if chunk has been added and false in case of error

ucl_parser_add_file_priority

Load and add data from a file @param parser parser structure @param filename the name of file @param err if *err is NULL it is set to parser error @param priority the desired priority of a chunk (only 4 least significant bits are considered for this parameter) @return true if chunk has been added and false in case of error

ucl_parser_add_string

Load ucl object from a string @param parser parser structure @param data the pointer to the string @param len the length of the string, if len is 0 then data must be zero-terminated string @return true if string has been added and false in case of error

ucl_parser_add_string_priority

Load ucl object from a string @param parser parser structure @param data the pointer to the string @param len the length of the string, if len is 0 then data must be zero-terminated string @param priority the desired priority of a chunk (only 4 least significant bits are considered for this parameter) @return true if string has been added and false in case of error

ucl_parser_chunk_peek

Peek at the character at the current chunk position @param parser parser structure @return current chunk position character

ucl_parser_chunk_skip

Skip the character at the current chunk position @param parser parser structure @return success boolean

ucl_parser_clear_error

Clear the error in the parser @param parser parser object

ucl_parser_free

Free ucl parser object @param parser parser object

ucl_parser_get_column

Get the current column number within parser @param parser parser object @return current column number

ucl_parser_get_comments

Get constant opaque pointer to comments structure for this parser. Increase refcount to prevent this object to be destroyed on parser's destruction @param parser parser structure @return ucl comments pointer or NULL

ucl_parser_get_current_stack_object

Get the current stack object as stack accessor function for use in macro functions (refcount is increased) @param parser parser object @param depth depth of stack to retrieve (top is 0) @return current stack object or NULL

ucl_parser_get_default_priority

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_parser_get_error

Get the error string if parsing has been failed @param parser parser object @return error description

ucl_parser_get_error_code

Get the code of the last error @param parser parser object @return error code

ucl_parser_get_linenum

Get the current line number within parser @param parser parser object @return current line number

ucl_parser_get_object

Get a top object for a parser (refcount is increased) @param parser parser structure @param err if *err is NULL it is set to parser error @return top parser object or NULL

ucl_parser_insert_chunk

Insert new chunk to a parser (must have previously processed data with an existing top object) @param parser parser structure @param data the pointer to the beginning of a chunk @param len the length of a chunk @return true if chunk has been added and false in case of error

ucl_parser_new

Creates new parser object @param pool pool to allocate memory from @return new parser object

ucl_parser_pubkey_add

Add new public key to parser for signatures check @param parser parser object @param key PEM representation of a key @param len length of the key @param err if *err is NULL it is set to parser error @return true if a key has been successfully added

ucl_parser_register_context_macro

Register new context dependent 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

ucl_parser_register_macro

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

ucl_parser_register_variable

Register new parser variable @param parser parser object @param var variable name @param value variable value

ucl_parser_set_default_priority

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_parser_set_filevars

Set FILENAME and CURDIR variables in parser @param parser parser object @param filename filename to set or NULL to set FILENAME to "undef" and CURDIR to getcwd() @param need_expand perform realpath() if this variable is true and filename is not NULL @return true if variables has been set

ucl_parser_set_variables_handler

Set handler for unknown variables @param parser parser structure @param handler desired handler @param ud opaque data for the handler

ucl_set_include_path

Provide a UCL_ARRAY of paths to search for include files. The object is copied so caller must unref the object. @param parser parser structure @param paths UCL_ARRAY of paths to search @return true if the path search array was replaced in the parser

Type Definitions

__int64_t
__off_t
__size_t
__uint64_t
fpos_t
ucl_context_macro_handler

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

ucl_macro_handler

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

ucl_object_iter_t

Opaque iterator object

ucl_object_t
ucl_userdata_dtor

Destructor type for userdata objects @param ud user specified data pointer

ucl_userdata_emitter
ucl_variable_handler

Handler to detect unregistered variables @param data variable data @param len length of variable @param replace (out) replace value for variable @param replace_len (out) replace length for variable @param need_free (out) UCL will free dest after usage @param ud opaque userdata @return true if variable

Unions

ucl_object_s__bindgen_ty_1

Variant value type