Xmlb.ValueBindings

Fields

Name

Type

Access

Description

dummy0

int

r

dummy1

int

r

dummy10

int

r

dummy11

[object]

r

dummy12

[object]

r

dummy2

[object]

r

dummy3

int

r

dummy4

int

r

dummy5

[object]

r

dummy6

int

r

dummy7

int

r

dummy8

[object]

r

dummy9

int

r

Methods

bind_str (idx, str, destroy_func)

bind_val (idx, val)

clear ()

copy ()

copy_binding (idx, dest, dest_idx)

free ()

init ()

is_bound (idx)

lookup_opcode (idx)

Details

class Xmlb.ValueBindings

An opaque struct which contains values bound to a query.

New in version 0.3.0.

bind_str(idx, str, destroy_func)
Parameters:
  • idx (int) – 0-based index to bind to

  • str (str) – a string to bind to idx

  • destroy_func (GLib.DestroyNotify or None) – function to free str

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 Xmlb.ValueBindings is cleared or freed.

New in version 0.3.0.

bind_val(idx, val)
Parameters:
  • idx (int) – 0-based index to bind to

  • val (int) – an integer to bind to idx

Bind val to idx in the value bindings.

This will overwrite any previous binding at idx.

New in version 0.3.0.

clear()

Clear an Xmlb.ValueBindings, freeing any allocated memory it points to.

After this function has been called, the contents of the Xmlb.ValueBindings are undefined, and it’s only safe to call Xmlb.ValueBindings.init() on it.

New in version 0.3.0.

copy()
Returns:

a copy of self

Return type:

Xmlb.ValueBindings

Copy self into a new heap-allocated Xmlb.ValueBindings instance.

New in version 0.3.0.

copy_binding(idx, dest, dest_idx)
Parameters:
Returns:

True if idx was bound, False otherwise

Return type:

bool

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.

New in version 0.3.0.

free()

Free a heap-allocated Xmlb.ValueBindings instance. This should be used on Xmlb.ValueBindings instances created with Xmlb.ValueBindings.copy().

For stack-allocated instances, Xmlb.ValueBindings.clear() should be used instead.

New in version 0.3.0.

init()

Initialise a stack-allocated Xmlb.ValueBindings struct so it can be used.

Stack-allocated Xmlb.ValueBindings instances should be freed once finished with, using Xmlb.ValueBindings.clear() (or g_auto(XbValueBindings), which is equivalent).

New in version 0.3.0.

is_bound(idx)
Parameters:

idx (int) – 0-based index of the binding to check

Returns:

True if a value is bound to idx, False otherwise

Return type:

bool

Check whether a value has been bound to the given index using (for example) Xmlb.ValueBindings.bind_str().

New in version 0.3.0.

lookup_opcode(idx)
Parameters:

idx (int) – 0-based index to look up the binding from

Returns:

True if idx was bound, False otherwise

opcode_out:

pointer to an Xmlb.Opcode to initialise from the binding

Return type:

(bool, opcode_out: Xmlb.Opcode)

Initialises an Xmlb.Opcode 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 Xmlb.ValueBindings, so must have a shorter lifetime than the Xmlb.ValueBindings. It will be of kind Xmlb.OpcodeKind.BOUND_TEXT or Xmlb.OpcodeKind.BOUND_INTEGER.

New in version 0.3.0.