Creates a new builder. The #XbSilo returned by the methods of this #XbBuilder will use the thread-default main context at the time of calling this function for its future signal emissions. a new #XbBuilder Adds a function that will get run on every #XbBuilderNode compile creates for the silo. This is run after all the #XbBuilderSource fixups have been run. a #XbBuilder a #XbBuilderFixup Adds a locale to the builder. Locales added first will be prioritised over locales added later. a #XbSilo a locale, e.g. "en_US" Adds the GUID to the internal correctness hash. a #XbSilo any text, typcically a filename or GUID Compiles a #XbSilo. a #XbSilo, or %NULL for error a #XbSilo some #XbBuilderCompileFlags, e.g. %XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT a #GCancellable, or %NULL Ensures @file is up to date, and returns a compiled #XbSilo. If @silo is being used by a query (e.g. in another thread) then all node data is immediately invalid. The returned #XbSilo will use the thread-default main context at the time of calling this function for its future signal emissions. a #XbSilo, or %NULL for error a #XbSilo a #GFile some #XbBuilderCompileFlags, e.g. %XB_BUILDER_COMPILE_FLAG_IGNORE_INVALID a #GCancellable, or %NULL Adds a node tree to the builder. If you are manually adding dynamic data sourced from a non-static source then you MUST use xb_builder_append_guid() with the appropriate GUID value, e.g. the file name and mtime. If no appropriate value is available, the caller can use something like: g_autofree gchar *tmp = xb_builder_node_export(bn, XB_NODE_EXPORT_FLAG_NONE, NULL); xb_builder_append_guid(builder, tmp); Failure to include an appropriate GUID value would allow an out-of-data silo to be used. a #XbSilo a #XbBuilderNode Adds a #XbBuilderSource to the #XbBuilder. a #XbSilo a #XbBuilderSource Enables or disables the collection of profiling data. a #XbBuilder some #XbSiloProfileFlags, e.g. %XB_SILO_PROFILE_FLAG_DEBUG The flags for converting to XML. No extra flags to use Only load native languages Ignore invalid files without an error Only store a single language Watch the XMLB file for changes Ignore the cache GUID value Require at most one root node Creates a function that will get run on every #XbBuilderNode compile creates. a new #XbBuilderFixup a text ID value, e.g. `AppStreamUpgrade` a callback user pointer to pass to @func, or %NULL a function which gets called to free @user_data, or %NULL Gets the maximum depth used for this fixup, if each node is being visited. integer, or -1 if unset a #XbBuilderFixup Sets the maximum depth used for this fixup. Use a @max_depth of 0 to only visit the root node. Setting a maximum depth may increase performance considerably if using fixup functions on large and deeply nested XML files. a #XbBuilderFixup integer, -1 for "all" Creates a new builder node. a new #XbBuilderNode An element name, e.g. "component" Adds a child builder node. A XbBuilderNode A XbBuilderNode Adds a flag to the builder node. a #XbBuilderNode a #XbBuilderNodeFlags Adds a token to the builder node. a #XbBuilderNode a new token Gets the depth of the node tree, where 0 is the root node. a #XbBuilderNode Exports the node to XML. XML data, or %NULL for an error a #XbBuilderNode some #XbNodeExportFlags, e.g. #XB_NODE_EXPORT_FLAG_NONE Gets an attribute from the builder node. string, or %NULL if unset a #XbBuilderNode attribute name, e.g. `type` Gets an attribute from the builder node. integer, or 0 if unset a #XbBuilderNode attribute name, e.g. `priority` Finds a child builder node by the element name, and optionally text value. a new #XbBuilderNode, or %NULL if not found a #XbBuilderNode An element name, e.g. "url" node text, e.g. "gimp.desktop" Gets the children of the builder node. children a #XbBuilderNode Gets the element from the builder node. string, or %NULL if unset a #XbBuilderNode Gets the first child of the builder node. a #XbBuilderNode, or %NULL a #XbBuilderNode Gets the last child of the builder node. a #XbBuilderNode, or %NULL a #XbBuilderNode Gets the parent node for the current node. a new #XbBuilderNode, or %NULL no parent exists. a #XbBuilderNode Gets the tail from the builder node. string, or %NULL if unset a #XbBuilderNode Gets the text from the builder node. string, or %NULL if unset a #XbBuilderNode Gets the text from the builder node. integer, or 0 if unset a #XbBuilderNode Gets the tokens of the builder node. tokens a #XbBuilderNode Checks a flag on the builder node. %TRUE if @flag is set a #XbBuilderNode a #XbBuilderNodeFlags Creates a new builder node. a new #XbBuilderNode A XbBuilderNode, or %NULL An element name, e.g. "component" any attributes to add to the node, terminated by %NULL Creates a new builder node with optional node text. A XbBuilderNode, or %NULL An element name, e.g. "id" node text, e.g. "gimp.desktop" any attributes to add to the node, terminated by %NULL Removes an attribute from the builder node. a #XbBuilderNode attribute name, e.g. `type` Removes a child builder node. A XbBuilderNode A XbBuilderNode Adds an attribute to the builder node. a #XbBuilderNode attribute name, e.g. `type` attribute value, e.g. `desktop` Sets the element name on the builder node. a #XbBuilderNode a string element Sets the tail on the builder node. a #XbBuilderNode a string length of @tail, or -1 if @tail is NUL terminated Sets the text on the builder node. a #XbBuilderNode a string length of @text, or -1 if @text is NUL terminated Sorts the node children using a custom sort function. a #XbBuilderNode a #XbBuilderNodeSortFunc user pointer to pass to @func, or %NULL Tokenize text added with xb_builder_node_set_text(). When searching, libxmlb often has to tokenize strings before they can be compared. This is done in the "fast path" and makes searching for non-ASCII text much slower. Adding the tokens to the deduplicated string table allows much faster searching at the expense of a ~5% size increase of the silo. This function adds all valid UTF-8 and ASCII search words generated from the value of xb_builder_node_set_text(). The transliteration locale (e.g. `en_GB`) is read from the `xml:lang` node attribute if set. a #XbBuilderNode Traverses a tree starting from @self. It calls the given function for each node visited. The traversal can be halted at any point by returning TRUE from @func. a #XbBuilderNode a #GTraverseType, e.g. %G_PRE_ORDER a #GTraverseFlags, e.g. %G_TRAVERSE_ALL the maximum depth of the traversal, or -1 for no limit a #XbBuilderNodeTraverseFunc user pointer to pass to @func, or %NULL Unlinks a #XbBuilderNode from a tree, resulting in two separate trees. This should not be used from the function called by xb_builder_node_traverse() otherwise the entire tree will not be traversed. Instead use xb_builder_node_add_flag(bn,XB_BUILDER_NODE_FLAG_IGNORE); a #XbBuilderNode The flags used when building a node. No extra flags to use Do not include this node in the silo Assume the node CDATA is already valid If the node has leading text If the node has trailing text Tokenize and fold text to ASCII (Since: 0.3.1) Strip leading and trailing spaces from text (Since: 0.3.4) Creates a new builder source. a new #XbBuilderSource Adds a function that can be used to convert streams loaded with xb_builder_source_load_xml(). This will decompress multiple layers of content, for instance decompressing a gzip stream into a different content type that can then be parsed. Use xb_builder_source_add_simple_adapter() when this recursive behaviour is not desired. a #XbBuilderSource mimetypes, e.g. `application/x-desktop,application/gzip` a callback, or %NULL user pointer to pass to @func, or %NULL a function which gets called to free @user_data, or %NULL Adds a function that will get run on every #XbBuilderNode compile creates with this source. a #XbBuilderSource a #XbBuilderFixup Adds a function that can be used to convert streams loaded with xb_builder_source_load_xml(). This function is similar to xb_builder_source_add_adapter() but is limited to one "layer" of content, for instance handling application/xml or a single simple type added using xb_builder_source_add_adapter(). a #XbBuilderSource mimetypes, e.g. `application/x-desktop,application/gzip` a callback, or %NULL user pointer to pass to @func, or %NULL a function which gets called to free @user_data, or %NULL Loads XML data and begins to build a #XbSilo. %TRUE for success a #XbBuilderSource a #GBytes some #XbBuilderSourceFlags, e.g. %XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT Loads an optionally compressed XML file to build a #XbSilo. %TRUE for success a #XbBuilderSource a #GFile some #XbBuilderSourceFlags, e.g. %XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT a #GCancellable, or %NULL Loads XML data and begins to build a #XbSilo. %TRUE for success a #XbBuilderSource XML data some #XbBuilderSourceFlags, e.g. %XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT Sets an optional information metadata node on the root node. a #XbBuilderSource a #XbBuilderNode Sets an optional prefix on the root node. This makes any nodes added using this source reside under a common shared parent node. a #XbBuilderSource an XPath prefix, e.g. `installed` Returns the data currently being processed. If the #XbBuilderSourceCtx is backed by a file, the returned #GBytes may be memory-mapped, and the backing file must not be modified until the #GBytes is destroyed. a #GBytes a #XbBuilderSourceCtx a #GCancellable, or %NULL Returns the basename of the file currently being processed. a basename, or %NULL if unset a #XbBuilderSourceCtx Returns the input stream currently being processed. a #GInputStream a #XbBuilderSourceCtx The flags for converting to XML. No extra flags to use Do not attempt to repair XML whitespace Watch the source file for changes Watch the directory containing the source file for changes (for example, if watching all the sources in a directory — this allows the file monitors to be shared) Check whether a libxmlb version equal to or greater than major.minor.micro. Major version number Minor version number Micro version number The compile-time major version The compile-time micro version The compile-time minor version Creates a new virtual machine. a new #XbMachine Adds a new function to the virtual machine. Registered functions can then be used as methods. The @method_cb must not modify the stack it’s passed unless it’s going to succeed. In particular, if a method call is not optimisable, it must not modify the stack it’s passed. You need to add a custom function using xb_machine_add_method() before using methods that may reference it, for example xb_machine_add_opcode_fixup(). a #XbMachine function name, e.g. `contains` minimum number of opcodes required on the stack function to call user pointer to pass to @method_cb, or %NULL a function which gets called to free @user_data, or %NULL Adds an opcode fixup. Fixups can be used to optimize the stack of opcodes or to add support for a nonstandard feature, for instance supporting missing attributes to functions. a #XbMachine signature, e.g. `INTE,TEXT` callback user pointer to pass to @fixup_cb a function which gets called to free @user_data, or %NULL Adds a new operator to the virtual machine. Operators can then be used instead of explicit methods like `eq()`. You need to add a custom operator using xb_machine_add_operator() before using xb_machine_parse(). Common operators like `<=` and `=` are built-in and do not have to be added manually. a #XbMachine operator string, e.g. `==` function name, e.g. `contains` Adds a text handler. This allows the virtual machine to support nonstandard encoding or shorthand mnemonics for standard functions. a #XbMachine callback user pointer to pass to @handler_cb a function which gets called to free @user_data, or %NULL Gets the maximum stack size used for the machine. integer a #XbMachine Initialises a stack allocated #XbOpcode for a registered function. Some standard functions are registered by default, for instance `eq` or `ge`. Other functions have to be added using xb_machine_add_method(). %TRUE if the function was found and the opcode initialised, %FALSE otherwise a #XbMachine a stack allocated #XbOpcode to initialise function name, e.g. `eq` Parses an XPath predicate. Not all of XPath 1.0 or XPath 1.0 is supported, and new functions and mnemonics can be added using xb_machine_add_method() and xb_machine_add_text_handler(). opcodes, or %NULL on error a #XbMachine predicate to parse, e.g. `contains(text(),'xyx')` length of @text, or -1 if @text is `NUL` terminated Parses an XPath predicate. Not all of XPath 1.0 or XPath 1.0 is supported, and new functions and mnemonics can be added using xb_machine_add_method() and xb_machine_add_text_handler(). opcodes, or %NULL on error a #XbMachine predicate to parse, e.g. `contains(text(),'xyx')` length of @text, or -1 if @text is `NUL` terminated #XbMachineParseFlags, e.g. %XB_MACHINE_PARSE_FLAG_OPTIMIZE Runs a set of opcodes on the virtual machine. It is safe to call this function from a different thread to the one that created the #XbMachine. Use xb_machine_run_with_bindings() instead. a new #XbOpcode, or %NULL a #XbMachine a #XbStack of opcodes return status after running @opcodes per-run user data that is passed to all the #XbMachineMethodFunc functions Runs a set of opcodes on the virtual machine, using the bound values given in @bindings to substitute for bound opcodes. It is safe to call this function from a different thread to the one that created the #XbMachine. a new #XbOpcode, or %NULL a #XbMachine a #XbStack of opcodes values bound to opcodes of type %XB_OPCODE_KIND_BOUND_INTEGER or %XB_OPCODE_KIND_BOUND_TEXT, or %NULL if the query doesn’t need any bound values return status after running @opcodes per-run user data that is passed to all the #XbMachineMethodFunc functions Sets the debug level of the virtual machine. a #XbMachine #XbMachineDebugFlags, e.g. %XB_MACHINE_DEBUG_FLAG_SHOW_STACK Sets the maximum stack size used for the machine. The stack size will be affective for new jobs started with xb_machine_run() and xb_machine_parse(). a #XbMachine integer Pops an opcode from the stack. %TRUE if popping succeeded, %FALSE if the stack was empty already a #XbMachine a #XbStack return location for the popped #XbOpcode Pushes a new empty opcode onto the end of the stack. A pointer to the opcode is returned in @opcode_out so that the caller can initialise it. If the stack reaches its maximum size, %G_IO_ERROR_NO_SPACE will be returned. %TRUE if a new empty opcode was returned, or %FALSE if the stack has reached its maximum size a #XbMachine a #XbStack return location for the new #XbOpcode Adds an integer literal to the stack. Errors are as for xb_machine_stack_push(). %TRUE on success, %FALSE otherwise a #XbMachine a #XbStack integer literal Adds a text literal to the stack, copying @str. Errors are as for xb_machine_stack_push(). %TRUE on success, %FALSE otherwise a #XbMachine a #XbStack text literal Adds static text literal to the stack. Errors are as for xb_machine_stack_push(). %TRUE on success, %FALSE otherwise a #XbMachine a #XbStack text literal Adds a stolen text literal to the stack. Errors are as for xb_machine_stack_push(). %TRUE on success, %FALSE otherwise a #XbMachine a #XbStack text literal The flags to control the amount of debugging is generated. No debug flags to use Show the stack addition and removal Show the XPath predicate parsing Show the optimizer operation Show the query slow paths The flags to control the parsing behaviour. No flags set Run an optimization pass on the predicate Exports the node back to XML. XML data, or %NULL for an error a #XbNode some #XbNodeExportFlags, e.g. #XB_NODE_EXPORT_FLAG_NONE Gets some attribute text data for a specific node. a string, or %NULL for unset a #XbNode an attribute name, e.g. "type" Gets some attribute text data for a specific node. a guint64, or %G_MAXUINT64 if unfound a #XbNode an attribute name, e.g. `type` Gets the first child node for the current node. a #XbNode, or %NULL a #XbNode Gets all the children for the current node. an array of children a #XbNode Gets any data that has been set on the node using xb_node_set_data(). This will only work across queries to the associated silo if the silo has its #XbSilo:enable-node-cache property set to %TRUE. Otherwise a new #XbNode may be constructed for future queries which return the same element as a result. a #GBytes, or %NULL if not found a #XbNode a string key, e.g. `fwupd::RemoteId` Gets the depth of the node to a root. a integer, where 0 is the root node itself. a #XbNode Gets the element name for a specific node. a string, or %NULL for the root node a #XbNode Gets the next sibling node for the current node. a #XbNode, or %NULL a #XbNode Gets the parent node for the current node. a #XbNode, or %NULL a #XbNode Gets the root node for the node. a #XbNode, or %NULL a #XbNode Gets the #XbSilo for the node. a #XbSilo a #XbNode Gets the tail data for a specific node. a string, or %NULL for unset a #XbNode Gets the text data for a specific node. a string, or %NULL for unset a #XbNode Gets some attribute text data for a specific node. a guint64, or %G_MAXUINT64 if unfound a #XbNode Searches the silo using an XPath query, returning up to @limit results. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. results, or %NULL if unfound a #XbNode an XPath, e.g. `id[abe.desktop]` maximum number of results to return, or 0 for "all" Searches the node using an XPath query, returning up to one result. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. a string, or %NULL if unfound a #XbNode An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` an attribute name, e.g. `type` Searches the node using an XPath query, returning up to one result. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. a #guint64, or %G_MAXUINT64 if unfound a #XbNode An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` an attribute name, e.g. `type` Searches the node using an XPath query, returning an XML string of the result and any children. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. a string, or %NULL if unfound a #XbNode An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` Searches the node using an XPath query, returning up to one result. Please note: Only a tiny subset of XPath 1.0 is supported. a #XbNode, or %NULL if unfound a #XbNode An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` Searches the silo using a prepared query, returning up to one result. To search using a query with bound values, use xb_node_query_first_with_context(). It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. a #XbNode, or %NULL if unfound a #XbNode an #XbQuery Searches the silo using a prepared query, returning up to one result. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. a #XbNode, or %NULL if unfound a #XbNode an #XbQuery context including values bound to opcodes of type %XB_OPCODE_KIND_BOUND_INTEGER or %XB_OPCODE_KIND_BOUND_TEXT, or %NULL if the query doesn’t need any context Searches the silo using a prepared query. To search using a query with bound values, use xb_node_query_with_context(). It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. results, or %NULL if unfound a #XbNode an #XbQuery Searches the node using an XPath query, returning up to one result. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. a string, or %NULL if unfound a #XbNode An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` Searches the node using an XPath query, returning up to one result. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. a #guint64, or %G_MAXUINT64 if unfound a #XbNode An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` Searches the silo using a prepared query, substituting values from the bindings in @context for bound opcodes as needed. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. results, or %NULL if unfound a #XbNode an #XbQuery context including values bound to opcodes of type %XB_OPCODE_KIND_BOUND_INTEGER or %XB_OPCODE_KIND_BOUND_TEXT, or %NULL if the query doesn’t need any context Sets some data on the node which can be retrieved using xb_node_get_data(). This will only work across queries to the associated silo if the silo has its #XbSilo:enable-node-cache property set to %TRUE. Otherwise a new #XbNode may be constructed for future queries which return the same element as a result. a #XbNode a string key, e.g. `fwupd::RemoteId` a #GBytes Traverses a tree starting from @self. It calls the given functions for each node visited. This allows transmogrification of the source, for instance converting the XML description to PangoMarkup or even something completely different like markdown. The traversal can be halted at any point by returning TRUE from @func. %TRUE if all nodes were visited a #XbNode (allow-none): a #XbBuilderNodeTraverseFunc (allow-none): a #XbBuilderNodeTraverseFunc user pointer to pass to @func, or %NULL A #XbNodeAttrIter structure represents an iterator that can be used to iterate over the attributes of a #XbNode. #XbNodeAttrIter structures are typically allocated on the stack and then initialized with xb_node_attr_iter_init(). The iteration order of a #XbNodeAttrIter is not defined. Initializes a name/value pair iterator for the node attributes and associates it with @self. The #XbNodeAttrIter structure is typically allocated on the stack and does not need to be freed explicitly. an uninitialized #XbNodeAttrIter a #XbNode Returns the current attribute name and value and advances the iterator. Example: |[<!-- language="C" --> XbNodeAttrIter iter; const gchar *attr_name, *attr_value; xb_node_attr_iter_init (&iter, node); while (xb_node_attr_iter_next (&iter, &attr_name, &attr_value)) { // use attr_name and attr_value; no need to free them } ]| %TRUE if there are more attributes. an initialized #XbNodeAttrIter Destination of the returned attribute name Destination of the returned attribute value A #XbNodeChildIter structure represents an iterator that can be used to iterate over the children of a #XbNode. #XbNodeChildIter structures are typically allocated on the stack and then initialized with xb_node_child_iter_init(). Initializes a child iterator for the node's children and associates it with @self. The #XbNodeChildIter structure is typically allocated on the stack and does not need to be freed explicitly. an uninitialized #XbNodeChildIter a #XbNode Returns the current child and advances the iterator. On the first call to this function, the @child pointer is assumed to point at uninitialised memory. On any later calls, it is assumed that the same pointers will be given and that they will point to the memory as set by the previous call to this function. This allows the previous values to be freed, as appropriate. Example: |[<!-- language="C" --> XbNodeChildIter iter; XbNode *child; xb_node_child_iter_init (&iter, node); while (xb_node_child_iter_loop (&iter, &child)) { // do something with the node child // no need to free 'child' unless breaking out of this loop } ]| %FALSE if the last child has been reached. an initialized #XbNodeAttrIter Destination of the returned child Returns the current child and advances the iterator. The retrieved #XbNode child needs to be dereferenced with g_object_unref(). Example: |[<!-- language="C" --> XbNodeChildIter iter; g_autoptr(XbNode) child = NULL; xb_node_child_iter_init (&iter, node); while (xb_node_child_iter_next (&iter, &child)) { // do something with the node child g_clear_pointer (&child, g_object_unref); } ]| %FALSE if the last child has been reached. an initialized #XbNodeAttrIter Destination of the returned child The flags for converting to XML. No extra flags to use Add an XML header to the data Split up children with a newline Indent the XML by child depth Include the siblings when converting Only export the children of the node If node has no children, collapse open and close tags Checks if the opcode can be compared using the string value. #%TRUE if this opcode can be compared as an string a #XbOpcode Checks if the opcode can be compared using the integer value. #%TRUE if this opcode can be compared as an integer a #XbOpcode Initialises a stack allocated #XbOpcode to contain a specific function. Custom functions can be registered using xb_machine_add_func() and retrieved using xb_machine_opcode_func_new(). a stack allocated #XbOpcode to initialise a function index Gets the opcode kind. a #XbOpcodeKind, e.g. %XB_OPCODE_KIND_INTEGER a #XbOpcode Gets the string value stored on the opcode. a string, or %NULL if unset a #XbOpcode Gets the integer value stored in the opcode. This may be a function ID, a index into the string table or a literal integer. value, or 0 for unset. a #XbOpcode Initialises a stack allocated #XbOpcode to contain an integer literal. a stack allocated #XbOpcode to initialise a integer value Initialises a stack allocated #XbOpcode to contain a text literal. The @str argument is copied internally and is not tied to the lifecycle of the #XbOpcode. a stack allocated #XbOpcode to initialise a string Initialises a stack allocated #XbOpcode to contain a text literal, where @str is either static text or will outlive the #XbOpcode lifecycle. a stack allocated #XbOpcode to initialise a string Initialises a stack allocated #XbOpcode to contain a text literal, stealing the @str. Once the opcode is finalized g_free() will be called on @str. a stack allocated #XbOpcode to initialise a string Returns a string representing the specific opcode. text a #XbOpcode Converts a string to an opcode kind. a #XbOpcodeKind, e.g. %XB_OPCODE_KIND_TEXT a string, e.g. `FUNC` Converts the opcode kind to a string. opcode kind, e.g. `FUNC` a #XbOpcodeKind, e.g. %XB_OPCODE_KIND_FUNCTION The opcode flags. The values have been carefully chosen so that a simple bitmask can be done to know how to compare for equality. function─┐ ┌─string bound──┐ │ │ ┌──integer token┐ │ │ │ │ X X X X X X X 8 4 2 1 Integer value set Text value set An operator A bound value, assigned later Tokenized text Unknown opcode A literal integer value A literal text value An operator A bound integer value A bound text value An indexed text value An bound indexed text value Static initialiser for #XbQueryContext so it can be used on the stack. Use it in association with g_auto(), to ensure the bindings are freed once finished with: |[ g_auto(XbQueryContext) context = XB_QUERY_CONTEXT_INIT (); xb_query_context_set_limit (&context, 0); ]| Creates a query to be used by @silo. It may be quicker to create a query manually and re-use it multiple times. a #XbQuery a #XbSilo The XPath query Creates a query to be used by @silo. It may be quicker to create a query manually and re-use it multiple times. The query will point to strings inside @silo, so the lifetime of @silo must exceed the lifetime of the returned query. a #XbQuery a #XbSilo The XPath query some #XbQueryFlags, e.g. #XB_QUERY_FLAG_USE_INDEXES Assigns a string to a bound value specified using `?`. Use #XbValueBindings and xb_value_bindings_bind_str() instead. That keeps the value bindings separate from the #XbQuery, allowing queries to be re-used over time and between threads. %TRUE if the @idx existed a #XbQuery an integer index string to assign to the bound variable Assigns a string to a bound value specified using `?`. Use #XbValueBindings and xb_value_bindings_bind_val() instead. That keeps the value bindings separate from the #XbQuery, allowing queries to be re-used over time and between threads. %TRUE if the @idx existed a #XbQuery an integer index value to assign to the bound variable Gets the flags used for this query. This is not thread-safe. Use xb_query_context_get_flags() instead. #XbQueryFlags, default %XB_QUERY_FLAG_NONE a #XbQuery Gets the results limit on this query, where 0 is 'all'. This is not thread-safe. Use xb_query_context_get_limit() instead. integer, default 0 a #XbQuery Gets the XPath string that created the query. string a #XbQuery Sets the flags to use for this query. This is not thread-safe. Use xb_query_context_set_flags() instead. a #XbQuery a #XbQueryFlags, e.g. %XB_QUERY_FLAG_USE_INDEXES Sets the results limit on this query, where 0 is 'all'. This is not thread-safe. Use xb_query_context_set_limit() instead. a #XbQuery integer An opaque struct which contains context for executing a query in, such as the number of results to return, or values to bind to query placeholders. Clear an #XbQueryContext, freeing any allocated memory it points to. After this function has been called, the contents of the #XbQueryContext are undefined, and it’s only safe to call xb_query_context_init() on it. an #XbQueryContext Copy @self into a new heap-allocated #XbQueryContext instance. a copy of @self an #XbQueryContext Free a heap-allocated #XbQueryContext instance. This should be used on #XbQueryContext instances created with xb_query_context_copy(). For stack-allocated instances, xb_query_context_clear() should be used instead. a heap-allocated #XbQueryContext Get the #XbValueBindings for this query context. bindings an #XbQueryContext Get the flags set on the context. See xb_query_context_set_flags(). query flags an #XbQueryContext Get the limit on the number of query results. See xb_query_context_set_limit(). limit on results, or `0` if unlimited an #XbQueryContext Initialise a stack-allocated #XbQueryContext struct so it can be used. Stack-allocated #XbQueryContext instances should be freed once finished with, using xb_query_context_clear() (or `g_auto(XbQueryContext)`, which is equivalent). an uninitialised #XbQueryContext to initialise Set flags which affect the behaviour of the query. an #XbQueryContext query flags, or %XB_QUERY_FLAG_NONE for none Set the limit on the number of results to return from the query. an #XbQueryContext number of query results to return, or `0` for unlimited The flags used for queries. No extra flags to use Optimize the query when possible Use the indexed parameters Reverse the results order Always cache the #XbNode objects Creates a new silo. a new #XbSilo Creates a new silo from an XML string. a new #XbSilo, or %NULL XML string Exports the silo back to XML. XML data, or %NULL for an error a #XbSilo some #XbNodeExportFlags, e.g. #XB_NODE_EXPORT_FLAG_NONE Exports the silo back to an XML file. %TRUE on success a #XbSilo a #GFile some #XbNodeExportFlags, e.g. #XB_NODE_EXPORT_FLAG_NONE a #GCancellable, or %NULL Gets the backing object that created the blob. You should never *ever* modify this data. A #GBytes, or %NULL if never set a #XbSilo Get #XbSilo:enable-node-cache. an #XbSilo Gets the GUID used to identify this silo. a string, otherwise %NULL a #XbSilo Returns the profiling data. This will only return profiling text if xb_silo_set_profile_flags() was used with %XB_SILO_PROFILE_FLAG_APPEND. text profiling data a #XbSilo Gets the root node for the silo. (MIGHT BE MORE). A #XbNode, or %NULL for an error a #XbSilo Gets the number of nodes in the silo. a integer, or 0 is an empty blob a #XbSilo Invalidates a silo. Future calls xb_silo_is_valid() will return %FALSE. a #XbSilo Checks is the silo is valid. The usual reason the silo is invalidated is when the backing mmapped file has changed, or one of the imported files have been modified. %TRUE if valid a #XbSilo Loads a silo from memory location. %TRUE for success, otherwise @error is set. a #XbSilo a #GBytes #XbSiloLoadFlags, e.g. %XB_SILO_LOAD_FLAG_NONE Loads a silo from file. %TRUE for success, otherwise @error is set. a #XbSilo a #GFile #XbSiloLoadFlags, e.g. %XB_SILO_LOAD_FLAG_NONE a #GCancellable, or %NULL Create an #XbQuery from the given @xpath XPath string, or return it from the query cache in the #XbSilo. @xpath must be valid: it is a programmer error if creating the query fails (i.e. if xb_query_new() returns an error). This function is thread-safe. an #XbQuery representing @xpath an #XbSilo an XPath query string Searches the silo using an XPath query, returning up to @limit results. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. results, or %NULL if unfound a #XbSilo an XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` maximum number of results to return, or 0 for "all" Adds the `attr()` or `text()` results of a query to the index. %TRUE for success a #XbSilo An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` Attribute name, e.g. `type`, or NULL Searches the silo using an XPath query, returning up to one result. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a tiny subset of XPath 1.0 is supported. a #XbNode, or %NULL if unfound a #XbSilo An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]` Searches the silo using an XPath query, returning up to one result. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a tiny subset of XPath 1.0 is supported. a #XbNode, or %NULL if unfound a #XbSilo an #XbQuery Searches the silo using an XPath query, returning up to one result. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a tiny subset of XPath 1.0 is supported. a #XbNode, or %NULL if unfound a #XbSilo an #XbQuery context including values bound to opcodes of type %XB_OPCODE_KIND_BOUND_INTEGER or %XB_OPCODE_KIND_BOUND_TEXT, or %NULL if the query doesn’t need any context Searches the silo using an XPath query. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. results, or %NULL if unfound a #XbSilo an #XbQuery Searches the silo using an XPath query. It is safe to call this function from a different thread to the one that created the #XbSilo. Please note: Only a subset of XPath is supported. results, or %NULL if unfound a #XbSilo an #XbQuery context including values bound to opcodes of type %XB_OPCODE_KIND_BOUND_INTEGER or %XB_OPCODE_KIND_BOUND_TEXT, or %NULL if the query doesn’t need any context Saves a silo to a file. %TRUE for success, otherwise @error is set. a #XbSilo a #GFile a #GCancellable, or %NULL Set #XbSilo:enable-node-cache. This is not thread-safe, and can only be called before the #XbSilo is passed between threads. an #XbSilo %TRUE to enable the node cache, %FALSE otherwise Enables or disables the collection of profiling data. a #XbSilo some #XbSiloProfileFlags, e.g. %XB_SILO_PROFILE_FLAG_DEBUG Converts the silo to an internal string representation. This is only really useful for debugging #XbSilo itself. A string, or %NULL for an error a #XbSilo Adds a file monitor to the silo. If the file or directory for @file changes then the silo will be invalidated. The monitor will internally use the #GMainContext which was the thread default when the #XbSilo was created, so that #GMainContext must be iterated for monitoring to work. %TRUE for success, otherwise @error is set. a #XbSilo a #GFile a #GCancellable, or %NULL Whether to cache all #XbNode instances ever constructed in a single cache in the #XbSilo, so that the same #XbNode instance is always returned in query results for a given XPath. This is a form of memoisation, and allows xb_node_get_data() and xb_node_set_data() to be used. This is enabled by default to preserve compatibility with older versions of libxmlb, but most clients will want to disable it. It adds a large memory overhead (no #XbNode is ever finalised) but achieves moderately low hit rates for typical XML parsing workloads where most nodes are accessed only once or twice as they are processed and then processing moves on to other nodes. This property can only be changed before the #XbSilo is passed between threads. Changing it is not thread-safe. The flags for loading a silo. No extra flags to use No not check header signature Watch the XMLB file for changes The flags used when profiling a silo. No extra flags to use Output profiling as debug Save profiling in an appended string Save XPATH queries Output the machine optimizer as debug Pops an opcode off the stack. %TRUE if popping succeeded, %FALSE if the stack was empty already a #XbStack return location for the popped #XbOpcode Pushes a new empty opcode onto the end of the stack. A pointer to the opcode is returned in @opcode_out so that the caller can initialise it. This must be done before the stack is next used as, for performance reasons, the newly pushed opcode is not zero-initialised. %TRUE if a new empty opcode was returned, or %FALSE if the stack has reached its maximum size a #XbStack return location for the new #XbOpcode Returns a string representing a stack. text a #XbStack Static initialiser for #XbValueBindings so it can be used on the stack. Use it in association with g_auto(), to ensure the bindings are freed once finished with: |[ g_auto(XbValueBindings) bindings = XB_VALUE_BINDINGS_INIT (); xb_value_bindings_bind_str (&bindings, 0, "test", NULL); ]| An opaque struct which contains values bound to a query. Bind @str to @idx in the value bindings. This will overwrite any previous binding at @idx. It will take ownership of @str, and an appropriate @destroy_func must be provided to free @str once the binding is no longer needed. @destroy_func will be called exactly once at some point before the #XbValueBindings is cleared or freed. an #XbValueBindings 0-based index to bind to a string to bind to @idx function to free @str Bind @val to @idx in the value bindings. This will overwrite any previous binding at @idx. an #XbValueBindings 0-based index to bind to an integer to bind to @idx Clear an #XbValueBindings, freeing any allocated memory it points to. After this function has been called, the contents of the #XbValueBindings are undefined, and it’s only safe to call xb_value_bindings_init() on it. an #XbValueBindings Copy @self into a new heap-allocated #XbValueBindings instance. a copy of @self an #XbValueBindings Copies the value bound at @idx on @self to @dest_idx on @dest. If no value is bound at @idx, @dest is not modified and %FALSE is returned. @dest must be initialised. If a binding already exists at @dest_idx, it will be overwritten. %TRUE if @idx was bound, %FALSE otherwise an #XbValueBindings to copy from 0-based index to look up the binding from in @self an #XbValueBindings to copy to 0-based index to copy the binding to in @dest Free a heap-allocated #XbValueBindings instance. This should be used on #XbValueBindings instances created with xb_value_bindings_copy(). For stack-allocated instances, xb_value_bindings_clear() should be used instead. a heap-allocated #XbValueBindings Initialise a stack-allocated #XbValueBindings struct so it can be used. Stack-allocated #XbValueBindings instances should be freed once finished with, using xb_value_bindings_clear() (or `g_auto(XbValueBindings)`, which is equivalent). an uninitialised #XbValueBindings to initialise Check whether a value has been bound to the given index using (for example) xb_value_bindings_bind_str(). %TRUE if a value is bound to @idx, %FALSE otherwise an #XbValueBindings 0-based index of the binding to check Initialises an #XbOpcode with the value bound to @idx, if a value is bound. If no value is bound, @opcode_out is not touched and %FALSE is returned. @opcode_out is initialised to point to the data inside the #XbValueBindings, so must have a shorter lifetime than the #XbValueBindings. It will be of kind %XB_OPCODE_KIND_BOUND_TEXT or %XB_OPCODE_KIND_BOUND_INTEGER. %TRUE if @idx was bound, %FALSE otherwise an #XbValueBindings 0-based index to look up the binding from pointer to an #XbOpcode to initialise from the binding Converts a string to an opcode kind. a #XbOpcodeKind, e.g. %XB_OPCODE_KIND_TEXT a string, e.g. `FUNC` Converts the opcode kind to a string. opcode kind, e.g. `FUNC` a #XbOpcodeKind, e.g. %XB_OPCODE_KIND_FUNCTION Appends an XPath query into the string, automatically adding the union operator (`|`) if required. The #GString to operate on The format string varargs for @fmt Escapes XPath control sequences such as newlines, tabs, and forward slashes. new string that is safe to use for queries string, e.g. `app/org.gnome.ghex/x86_64/stable` Gets the XMLb installed runtime version. a version number, e.g. "0.3.19" #XbSilo provides read-only access and querying of a previously parsed blob of XML data. All signal emissions from #XbSilo (currently only #GObject::notify emissions) will happen in the #GMainContext which is the thread default when the #XbSilo is constructed. This #GMainContext must be iterated for file monitoring using xb_silo_watch_file() to function correctly. These compile time macros allow the user to enable parts of client code depending on the version of libxmlb installed.