libpkgconf fragment module¶
The fragment module provides low-level management and rendering of fragment lists. A
fragment list contains various fragments of text (such as -I /usr/include
) in a matter
which is composable, mergeable and reorderable.
-
void
pkgconf_fragment_add
(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string, unsigned int flags)¶ Adds a fragment of text to a fragment list, possibly modifying the fragment if a sysroot is set.
Parameters: - client (pkgconf_client_t*) – The pkgconf client being accessed.
- list (pkgconf_list_t*) – The fragment list.
- string (char*) – The string of text to add as a fragment to the fragment list.
- flags (uint) – Parsing-related flags for the package.
Returns: nothing
-
bool
pkgconf_fragment_has_system_dir
(const pkgconf_client_t *client, const pkgconf_fragment_t *frag)¶ Checks if a fragment contains a system path. System paths are detected at compile time and optionally overridden by the
PKG_CONFIG_SYSTEM_INCLUDE_PATH
andPKG_CONFIG_SYSTEM_LIBRARY_PATH
environment variables.Parameters: - client (pkgconf_client_t*) – The pkgconf client object the fragment belongs to.
- frag (pkgconf_fragment_t*) – The fragment being checked.
Returns: true if the fragment contains a system path, else false
Return type: bool
-
void
pkgconf_fragment_copy
(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_fragment_t *base, bool is_private)¶ Copies a fragment to another fragment list, possibly removing a previous copy of the fragment in a process known as mergeback.
Parameters: - client (pkgconf_client_t*) – The pkgconf client being accessed.
- list (pkgconf_list_t*) – The list the fragment is being added to.
- base (pkgconf_fragment_t*) – The fragment being copied.
- is_private (bool) – Whether the fragment list is a private fragment list (static linking).
Returns: nothing
-
void
pkgconf_fragment_copy_list
(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_list_t *base)¶ Copies a fragment list to another fragment list, possibly removing a previous copy of the fragments in a process known as mergeback.
Parameters: - client (pkgconf_client_t*) – The pkgconf client being accessed.
- list (pkgconf_list_t*) – The list the fragments are being added to.
- base (pkgconf_list_t*) – The list the fragments are being copied from.
Returns: nothing
-
void
pkgconf_fragment_filter
(const pkgconf_client_t *client, pkgconf_list_t *dest, pkgconf_list_t *src, pkgconf_fragment_filter_func_t filter_func)¶ Copies a fragment list to another fragment list which match a user-specified filtering function.
Parameters: - client (pkgconf_client_t*) – The pkgconf client being accessed.
- dest (pkgconf_list_t*) – The destination list.
- src (pkgconf_list_t*) – The source list.
- filter_func (pkgconf_fragment_filter_func_t) – The filter function to use.
- data (void*) – Optional data to pass to the filter function.
Returns: nothing
-
size_t
pkgconf_fragment_render_len
(const pkgconf_list_t *list, bool escape, const pkgconf_fragment_render_ops_t *ops)¶ Calculates the required memory to store a fragment list when rendered as a string.
Parameters: - list (pkgconf_list_t*) – The fragment list being rendered.
- escape (bool) – Whether or not to escape special shell characters (deprecated).
- ops (pkgconf_fragment_render_ops_t*) – An optional ops structure to use for custom renderers, else
NULL
.
Returns: the amount of bytes required to represent the fragment list when rendered
Return type: size_t
-
void
pkgconf_fragment_render_buf
(const pkgconf_list_t *list, char *buf, size_t buflen, bool escape, const pkgconf_fragment_render_ops_t *ops)¶ Renders a fragment list into a buffer.
Parameters: - list (pkgconf_list_t*) – The fragment list being rendered.
- buf (char*) – The buffer to render the fragment list into.
- buflen (size_t) – The length of the buffer.
- escape (bool) – Whether or not to escape special shell characters (deprecated).
- ops (pkgconf_fragment_render_ops_t*) – An optional ops structure to use for custom renderers, else
NULL
.
Returns: nothing
-
char *
pkgconf_fragment_render
(const pkgconf_list_t *list)¶ Allocate memory and render a fragment list into it.
Parameters: - list (pkgconf_list_t*) – The fragment list being rendered.
- escape (bool) – Whether or not to escape special shell characters (deprecated).
- ops (pkgconf_fragment_render_ops_t*) – An optional ops structure to use for custom renderers, else
NULL
.
Returns: An allocated string containing the rendered fragment list.
Return type: char *
-
void
pkgconf_fragment_delete
(pkgconf_list_t *list, pkgconf_fragment_t *node)¶ Delete a fragment node from a fragment list.
Parameters: - list (pkgconf_list_t*) – The fragment list to delete from.
- node (pkgconf_fragment_t*) – The fragment node to delete.
Returns: nothing
-
void
pkgconf_fragment_free
(pkgconf_list_t *list)¶ Delete an entire fragment list.
Parameters: - list (pkgconf_list_t*) – The fragment list to delete.
Returns: nothing
-
bool
pkgconf_fragment_parse
(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value)¶ Parse a string into a fragment list.
Parameters: - client (pkgconf_client_t*) – The pkgconf client being accessed.
- list (pkgconf_list_t*) – The fragment list to add the fragment entries to.
- vars (pkgconf_list_t*) – A list of variables to use for variable substitution.
- flags (uint) – Any parsing flags to be aware of.
- value (char*) – The string to parse into fragments.
Returns: true on success, false on parse error