## XbBuilder

XbBuilder

## Functions

XbBuilder * | xb_builder_new ()
void | xb_builder_append_guid ()
void | xb_builder_import_source ()
void | xb_builder_import_node ()
XbSilo * | xb_builder_compile ()
XbSilo * | xb_builder_ensure ()
void | xb_builder_add_locale ()
void | xb_builder_add_fixup ()
void | xb_builder_set_profile_flags ()

## Types and Values

#define | XB_TYPE_BUILDER
struct | XbBuilderClass
enum | XbBuilderCompileFlags
| XbBuilder

## Description

## Functions

### xb_builder_new ()

    XbBuilder *
    xb_builder_new (void);

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.

#### Returns

a new XbBuilder

Since: 0.1.0

### xb_builder_append_guid ()

    void
    xb_builder_append_guid (XbBuilder *self,
                            const gchar *guid);

Adds the GUID to the internal correctness hash.

#### Parameters

self | a XbSilo |
guid | any text, typcically a filename or GUID |

Since: 0.1.0

### xb_builder_import_source ()

    void
    xb_builder_import_source (XbBuilder *self,
                              XbBuilderSource *source);

Adds a XbBuilderSource to the XbBuilder.

#### Parameters

self | a XbSilo |
source | a XbBuilderSource |

Since: 0.1.0

### xb_builder_import_node ()

    void
    xb_builder_import_node (XbBuilder *self,
                            XbBuilderNode *bn);

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.

#### Parameters

self | a XbSilo |
bn | a XbBuilderNode |

Since: 0.1.0

### xb_builder_compile ()

    XbSilo *
    xb_builder_compile (XbBuilder *self,
                        XbBuilderCompileFlags flags,
                        GCancellable *cancellable,
                        GError **error);

Compiles a XbSilo.

#### Parameters

self | a XbSilo |
flags | some XbBuilderCompileFlags, e.g. `XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT` |
cancellable | a GCancellable, or `NULL` |
error | the GError, or `NULL` |

#### Returns

a XbSilo, or `NULL` for error.

[transfer full]

Since: 0.1.0

### xb_builder_ensure ()

    XbSilo *
    xb_builder_ensure (XbBuilder *self,
                       GFile *file,
                       XbBuilderCompileFlags flags,
                       GCancellable *cancellable,
                       GError **error);

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.

#### Parameters

self | a XbSilo |
file | a GFile |
flags | some XbBuilderCompileFlags, e.g. `XB_BUILDER_COMPILE_FLAG_IGNORE_INVALID` |
cancellable | a GCancellable, or `NULL` |
error | the GError, or `NULL` |

#### Returns

a XbSilo, or `NULL` for error.

[transfer full]

Since: 0.1.0

### xb_builder_add_locale ()

    void
    xb_builder_add_locale (XbBuilder *self,
                           const gchar *locale);

Adds a locale to the builder. Locales added first will be prioritised over locales added later.

#### Parameters

self | a XbSilo |
locale | a locale, e.g. "en_US" |

Since: 0.1.0

### xb_builder_add_fixup ()

    void
    xb_builder_add_fixup (XbBuilder *self,
                          XbBuilderFixup *fixup);

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.

#### Parameters

self | a XbBuilder |
fixup | a XbBuilderFixup |

Since: 0.1.3

### xb_builder_set_profile_flags ()

    void
    xb_builder_set_profile_flags (XbBuilder *self,
                                  XbSiloProfileFlags profile_flags);

Enables or disables the collection of profiling data.

#### Parameters

self | a XbBuilder |
profile_flags | some XbSiloProfileFlags, e.g. `XB_SILO_PROFILE_FLAG_DEBUG` |

Since: 0.1.1

## Types and Values

### XB_TYPE_BUILDER

    #define             XB_TYPE_BUILDER

### struct XbBuilderClass

    struct XbBuilderClass {
    	GObjectClass parent_class;
    };

### enum XbBuilderCompileFlags

The flags for converting to XML.

#### Members

XB_BUILDER_COMPILE_FLAG_NONE |  |
XB_BUILDER_COMPILE_FLAG_NATIVE_LANGS |  |
XB_BUILDER_COMPILE_FLAG_IGNORE_INVALID |  |
XB_BUILDER_COMPILE_FLAG_SINGLE_LANG |  |
XB_BUILDER_COMPILE_FLAG_WATCH_BLOB |  |
XB_BUILDER_COMPILE_FLAG_IGNORE_GUID |  |
XB_BUILDER_COMPILE_FLAG_SINGLE_ROOT |  |

### XbBuilder

    typedef struct _XbBuilder XbBuilder;