1 2libpkgconf `fragment` module 3============================ 4 5The `fragment` module provides low-level management and rendering of fragment lists. A 6`fragment list` contains various `fragments` of text (such as ``-I /usr/include``) in a matter 7which is composable, mergeable and reorderable. 8 9.. c:function:: void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string, unsigned int flags) 10 11 Adds a `fragment` of text to a `fragment list`, possibly modifying the fragment if a sysroot is set. 12 13 :param pkgconf_client_t* client: The pkgconf client being accessed. 14 :param pkgconf_list_t* list: The fragment list. 15 :param char* string: The string of text to add as a fragment to the fragment list. 16 :param uint flags: Parsing-related flags for the package. 17 :return: nothing 18 19.. c:function:: bool pkgconf_fragment_has_system_dir(const pkgconf_client_t *client, const pkgconf_fragment_t *frag) 20 21 Checks if a `fragment` contains a `system path`. System paths are detected at compile time and optionally overridden by 22 the ``PKG_CONFIG_SYSTEM_INCLUDE_PATH`` and ``PKG_CONFIG_SYSTEM_LIBRARY_PATH`` environment variables. 23 24 :param pkgconf_client_t* client: The pkgconf client object the fragment belongs to. 25 :param pkgconf_fragment_t* frag: The fragment being checked. 26 :return: true if the fragment contains a system path, else false 27 :rtype: bool 28 29.. c:function:: void pkgconf_fragment_copy(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_fragment_t *base, bool is_private) 30 31 Copies a `fragment` to another `fragment list`, possibly removing a previous copy of the `fragment` 32 in a process known as `mergeback`. 33 34 :param pkgconf_client_t* client: The pkgconf client being accessed. 35 :param pkgconf_list_t* list: The list the fragment is being added to. 36 :param pkgconf_fragment_t* base: The fragment being copied. 37 :param bool is_private: Whether the fragment list is a `private` fragment list (static linking). 38 :return: nothing 39 40.. c:function:: void pkgconf_fragment_copy_list(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_list_t *base) 41 42 Copies a `fragment list` to another `fragment list`, possibly removing a previous copy of the fragments 43 in a process known as `mergeback`. 44 45 :param pkgconf_client_t* client: The pkgconf client being accessed. 46 :param pkgconf_list_t* list: The list the fragments are being added to. 47 :param pkgconf_list_t* base: The list the fragments are being copied from. 48 :return: nothing 49 50.. c:function:: void pkgconf_fragment_filter(const pkgconf_client_t *client, pkgconf_list_t *dest, pkgconf_list_t *src, pkgconf_fragment_filter_func_t filter_func) 51 52 Copies a `fragment list` to another `fragment list` which match a user-specified filtering function. 53 54 :param pkgconf_client_t* client: The pkgconf client being accessed. 55 :param pkgconf_list_t* dest: The destination list. 56 :param pkgconf_list_t* src: The source list. 57 :param pkgconf_fragment_filter_func_t filter_func: The filter function to use. 58 :param void* data: Optional data to pass to the filter function. 59 :return: nothing 60 61.. c:function:: size_t pkgconf_fragment_render_len(const pkgconf_list_t *list, bool escape, const pkgconf_fragment_render_ops_t *ops) 62 63 Calculates the required memory to store a `fragment list` when rendered as a string. 64 65 :param pkgconf_list_t* list: The `fragment list` being rendered. 66 :param bool escape: Whether or not to escape special shell characters (deprecated). 67 :param pkgconf_fragment_render_ops_t* ops: An optional ops structure to use for custom renderers, else ``NULL``. 68 :return: the amount of bytes required to represent the `fragment list` when rendered 69 :rtype: size_t 70 71.. c:function:: void pkgconf_fragment_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, bool escape, const pkgconf_fragment_render_ops_t *ops) 72 73 Renders a `fragment list` into a buffer. 74 75 :param pkgconf_list_t* list: The `fragment list` being rendered. 76 :param char* buf: The buffer to render the fragment list into. 77 :param size_t buflen: The length of the buffer. 78 :param bool escape: Whether or not to escape special shell characters (deprecated). 79 :param pkgconf_fragment_render_ops_t* ops: An optional ops structure to use for custom renderers, else ``NULL``. 80 :return: nothing 81 82.. c:function:: char *pkgconf_fragment_render(const pkgconf_list_t *list) 83 84 Allocate memory and render a `fragment list` into it. 85 86 :param pkgconf_list_t* list: The `fragment list` being rendered. 87 :param bool escape: Whether or not to escape special shell characters (deprecated). 88 :param pkgconf_fragment_render_ops_t* ops: An optional ops structure to use for custom renderers, else ``NULL``. 89 :return: An allocated string containing the rendered `fragment list`. 90 :rtype: char * 91 92.. c:function:: void pkgconf_fragment_delete(pkgconf_list_t *list, pkgconf_fragment_t *node) 93 94 Delete a `fragment node` from a `fragment list`. 95 96 :param pkgconf_list_t* list: The `fragment list` to delete from. 97 :param pkgconf_fragment_t* node: The `fragment node` to delete. 98 :return: nothing 99 100.. c:function:: void pkgconf_fragment_free(pkgconf_list_t *list) 101 102 Delete an entire `fragment list`. 103 104 :param pkgconf_list_t* list: The `fragment list` to delete. 105 :return: nothing 106 107.. c:function:: bool pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value) 108 109 Parse a string into a `fragment list`. 110 111 :param pkgconf_client_t* client: The pkgconf client being accessed. 112 :param pkgconf_list_t* list: The `fragment list` to add the fragment entries to. 113 :param pkgconf_list_t* vars: A list of variables to use for variable substitution. 114 :param uint flags: Any parsing flags to be aware of. 115 :param char* value: The string to parse into fragments. 116 :return: true on success, false on parse error 117