XbBuilderSource: libxmlb Reference Manual

## XbBuilderSource XbBuilderSource |

## Functions

gboolean | (*XbBuilderSourceNodeFunc) ()
GInputStream * | (*XbBuilderSourceAdapterFunc) ()
XbBuilderSource * | xb_builder_source_new ()
gboolean | xb_builder_source_load_file ()
gboolean | xb_builder_source_load_xml ()
gboolean | xb_builder_source_load_bytes ()
void | xb_builder_source_set_info ()
void | xb_builder_source_set_prefix ()
void | xb_builder_source_add_fixup ()
void | xb_builder_source_add_adapter ()
void | xb_builder_source_add_simple_adapter ()

## Types and Values

#define | XB_TYPE_BUILDER_SOURCE
struct | XbBuilderSourceClass
enum | XbBuilderSourceFlags
| XbBuilderSource

## Description

## Functions

### XbBuilderSourceNodeFunc ()

    gboolean
    (*XbBuilderSourceNodeFunc) (XbBuilderSource *self,
                                XbBuilderNode *bn,
                                gpointer user_data,
                                GError **error);

### XbBuilderSourceAdapterFunc ()

    GInputStream *
    (*XbBuilderSourceAdapterFunc) (XbBuilderSource *self,
                                   XbBuilderSourceCtx *ctx,
                                   gpointer user_data,
                                   GCancellable *cancellable,
                                   GError **error);

### xb_builder_source_new ()

    XbBuilderSource *
    xb_builder_source_new (void);

Creates a new builder source.

#### Returns

a new XbBuilderSource

Since: 0.1.1

### xb_builder_source_load_file ()

    gboolean
    xb_builder_source_load_file (XbBuilderSource *self,
                                 GFile *file,
                                 XbBuilderSourceFlags flags,
                                 GCancellable *cancellable,
                                 GError **error);

Loads an optionally compressed XML file to build a XbSilo.

#### Parameters

self | a XbBuilderSource |
file | a GFile |
flags | some XbBuilderSourceFlags, e.g. `XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT` |
cancellable | a GCancellable, or `NULL` |
error | the GError, or `NULL` |

#### Returns

`TRUE` for success

Since: 0.1.1

### xb_builder_source_load_xml ()

    gboolean
    xb_builder_source_load_xml (XbBuilderSource *self,
                                const gchar *xml,
                                XbBuilderSourceFlags flags,
                                GError **error);

Loads XML data and begins to build a XbSilo.

#### Parameters

self | a XbBuilderSource |
xml | XML data |
flags | some XbBuilderSourceFlags, e.g. `XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT` |
error | the GError, or `NULL` |

#### Returns

`TRUE` for success

Since: 0.1.1

### xb_builder_source_load_bytes ()

    gboolean
    xb_builder_source_load_bytes (XbBuilderSource *self,
                                  GBytes *bytes,
                                  XbBuilderSourceFlags flags,
                                  GError **error);

Loads XML data and begins to build a XbSilo.

#### Parameters

self | a XbBuilderSource |
bytes | a GBytes |
flags | some XbBuilderSourceFlags, e.g. `XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT` |
error | the GError, or `NULL` |

#### Returns

`TRUE` for success

Since: 0.1.2

### xb_builder_source_set_info ()

    void
    xb_builder_source_set_info (XbBuilderSource *self,
                                XbBuilderNode *info);

Sets an optional information metadata node on the root node.

#### Parameters

self | a XbBuilderSource |
info | a XbBuilderNode. | [allow-none]

Since: 0.1.0

### xb_builder_source_set_prefix ()

    void
    xb_builder_source_set_prefix (XbBuilderSource *self,
                                  const gchar *prefix);

Sets an optional prefix on the root node. This makes any nodes added using this source reside under a common shared parent node.

#### Parameters

self | a XbBuilderSource |
prefix | an XPath prefix, e.g. `installed`. | [allow-none]

Since: 0.1.0

### xb_builder_source_add_fixup ()

    void
    xb_builder_source_add_fixup (XbBuilderSource *self,
                                 XbBuilderFixup *fixup);

Adds a function that will get run on every XbBuilderNode compile creates with this source.

#### Parameters

self | a XbBuilderSource |
fixup | a XbBuilderFixup |

Since: 0.1.3

### xb_builder_source_add_adapter ()

    void
    xb_builder_source_add_adapter (XbBuilderSource *self,
                                   const gchar *content_types,
                                   XbBuilderSourceAdapterFunc func,
                                   gpointer user_data,
                                   GDestroyNotify user_data_free);

Adds a function that can be used to convert streams loaded with `xb_builder_source_load_xml()`.

#### Parameters

self | a XbBuilderSource |
content_types | mimetypes, e.g. `application/x-desktop,application/gzip` |
func | a callback, or `NULL` |
user_data | user pointer to pass to `func` , or `NULL` |
user_data_free | a function which gets called to free `user_data` , or `NULL` |

Since: 0.1.7

### xb_builder_source_add_simple_adapter ()

    void
    xb_builder_source_add_simple_adapter (XbBuilderSource *self,
                                          const gchar *content_types,
                                          XbBuilderSourceAdapterFunc func,
                                          gpointer user_data,
                                          GDestroyNotify user_data_free);

Adds a function that can be used to convert streams loaded with `xb_builder_source_load_xml()`.

#### Parameters

self | a XbBuilderSource |
content_types | mimetypes, e.g. `application/x-desktop,application/gzip` |
func | a callback, or `NULL` |
user_data | user pointer to pass to `func` , or `NULL` |
user_data_free | a function which gets called to free `user_data` , or `NULL` |

Since: 0.1.15

## Types and Values

### XB_TYPE_BUILDER_SOURCE

    #define             XB_TYPE_BUILDER_SOURCE

### struct XbBuilderSourceClass

    struct XbBuilderSourceClass {
    	GObjectClass			 parent_class;
    };

### enum XbBuilderSourceFlags

The flags for converting to XML.

#### Members

XB_BUILDER_SOURCE_FLAG_NONE |  |
XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT |  |
XB_BUILDER_SOURCE_FLAG_WATCH_FILE |  |
XB_BUILDER_SOURCE_FLAG_WATCH_DIRECTORY |  |

### XbBuilderSource

    typedef struct _XbBuilderSource XbBuilderSource;