@girs/xmlb-2.0 2.0.0-4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/xmlb-2.0.d.ts ADDED
@@ -0,0 +1,1934 @@
1
+ /*
2
+ * Type Definitions for Gjs (https://gjs.guide/)
3
+ *
4
+ * These type definitions are automatically generated, do not edit them by hand.
5
+ * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
6
+ */
7
+
8
+ import './xmlb-2.0-ambient.d.ts';
9
+
10
+ /**
11
+ * Xmlb-2.0
12
+ */
13
+
14
+ import type Gio from '@girs/gio-2.0';
15
+ import type GObject from '@girs/gobject-2.0';
16
+ import type GLib from '@girs/glib-2.0';
17
+
18
+ export namespace Xmlb {
19
+ enum OpcodeKind {
20
+ /**
21
+ * Unknown opcode
22
+ */
23
+ UNKNOWN,
24
+ /**
25
+ * A literal integer value
26
+ */
27
+ INTEGER,
28
+ /**
29
+ * A literal text value
30
+ */
31
+ TEXT,
32
+ /**
33
+ * An operator
34
+ */
35
+ FUNCTION,
36
+ BOUND_UNSET,
37
+ /**
38
+ * A bound integer value
39
+ */
40
+ BOUND_INTEGER,
41
+ /**
42
+ * A bound text value
43
+ */
44
+ BOUND_TEXT,
45
+ /**
46
+ * An indexed text value
47
+ */
48
+ INDEXED_TEXT,
49
+ BOOLEAN,
50
+ /**
51
+ * An bound indexed text value
52
+ */
53
+ BOUND_INDEXED_TEXT,
54
+ }
55
+ /**
56
+ * Converts a string to an opcode kind.
57
+ * @param str a string, e.g. `FUNC`
58
+ * @returns a #XbOpcodeKind, e.g. %XB_OPCODE_KIND_TEXT
59
+ */
60
+ function opcode_kind_from_string(str: string): OpcodeKind;
61
+ /**
62
+ * Converts the opcode kind to a string.
63
+ * @param kind a #XbOpcodeKind, e.g. %XB_OPCODE_KIND_FUNCTION
64
+ * @returns opcode kind, e.g. `FUNC`
65
+ */
66
+ function opcode_kind_to_string(kind: OpcodeKind): string;
67
+ /**
68
+ * Escapes XPath control sequences such as newlines, tabs, and forward slashes.
69
+ * @param str string, e.g. `app/org.gnome.ghex/x86_64/stable`
70
+ * @returns new string that is safe to use for queries
71
+ */
72
+ function string_escape(str: string): string;
73
+ interface BuilderFixupFunc {
74
+ (self: BuilderFixup, bn: BuilderNode): boolean;
75
+ }
76
+ interface BuilderNodeSortFunc {
77
+ (bn1: BuilderNode, bn2: BuilderNode): number;
78
+ }
79
+ interface BuilderNodeTraverseFunc {
80
+ (bn: BuilderNode): boolean;
81
+ }
82
+ interface BuilderSourceNodeFunc {
83
+ (self: BuilderSource, bn: BuilderNode): boolean;
84
+ }
85
+ interface MachineMethodFunc {
86
+ (self: Machine, stack: Stack, result_unused: boolean, exec_data?: any | null): boolean;
87
+ }
88
+ interface MachineOpcodeFixupFunc {
89
+ (self: Machine, opcodes: Stack): boolean;
90
+ }
91
+ interface MachineTextHandlerFunc {
92
+ (self: Machine, opcodes: Stack, text: string, handled: boolean): boolean;
93
+ }
94
+ interface NodeTransmogrifyFunc {
95
+ (self: Node): boolean;
96
+ }
97
+ /**
98
+ * The flags for converting to XML.
99
+ */
100
+ enum BuilderCompileFlags {
101
+ /**
102
+ * No extra flags to use
103
+ */
104
+ NONE,
105
+ /**
106
+ * Only load native languages
107
+ */
108
+ NATIVE_LANGS,
109
+ /**
110
+ * Ignore invalid files without an error
111
+ */
112
+ IGNORE_INVALID,
113
+ /**
114
+ * Only store a single language
115
+ */
116
+ SINGLE_LANG,
117
+ /**
118
+ * Watch the XMLB file for changes
119
+ */
120
+ WATCH_BLOB,
121
+ /**
122
+ * Ignore the cache GUID value
123
+ */
124
+ IGNORE_GUID,
125
+ /**
126
+ * Require at most one root node
127
+ */
128
+ SINGLE_ROOT,
129
+ }
130
+ /**
131
+ * The flags used when building a node.
132
+ */
133
+ enum BuilderNodeFlags {
134
+ /**
135
+ * No extra flags to use
136
+ */
137
+ NONE,
138
+ /**
139
+ * Do not include this node in the silo
140
+ */
141
+ IGNORE,
142
+ /**
143
+ * Assume the node CDATA is already valid
144
+ */
145
+ LITERAL_TEXT,
146
+ /**
147
+ * If the node has leading text
148
+ */
149
+ HAS_TEXT,
150
+ /**
151
+ * If the node has trailing text
152
+ */
153
+ HAS_TAIL,
154
+ /**
155
+ * Tokenize and fold text to ASCII (Since: 0.3.1)
156
+ */
157
+ TOKENIZE_TEXT,
158
+ /**
159
+ * Strip leading and trailing spaces from text (Since:
160
+ * 0.3.4)
161
+ */
162
+ STRIP_TEXT,
163
+ }
164
+ /**
165
+ * The flags for converting to XML.
166
+ */
167
+ enum BuilderSourceFlags {
168
+ /**
169
+ * No extra flags to use
170
+ */
171
+ NONE,
172
+ /**
173
+ * Do not attempt to repair XML whitespace
174
+ */
175
+ LITERAL_TEXT,
176
+ /**
177
+ * Watch the source file for changes
178
+ */
179
+ WATCH_FILE,
180
+ /**
181
+ * Watch the directory containing the source file for
182
+ * changes (for example, if watching all the sources in a directory — this allows the file monitors
183
+ * to be shared)
184
+ */
185
+ WATCH_DIRECTORY,
186
+ }
187
+ /**
188
+ * The flags to control the amount of debugging is generated.
189
+ */
190
+ enum MachineDebugFlags {
191
+ /**
192
+ * No debug flags to use
193
+ */
194
+ NONE,
195
+ /**
196
+ * Show the stack addition and removal
197
+ */
198
+ SHOW_STACK,
199
+ /**
200
+ * Show the XPath predicate parsing
201
+ */
202
+ SHOW_PARSING,
203
+ /**
204
+ * Show the optimizer operation
205
+ */
206
+ SHOW_OPTIMIZER,
207
+ /**
208
+ * Show the query slow paths
209
+ */
210
+ SHOW_SLOW_PATH,
211
+ }
212
+ /**
213
+ * The flags to control the parsing behaviour.
214
+ */
215
+ enum MachineParseFlags {
216
+ /**
217
+ * No flags set
218
+ */
219
+ NONE,
220
+ /**
221
+ * Run an optimization pass on the predicate
222
+ */
223
+ OPTIMIZE,
224
+ }
225
+ /**
226
+ * The flags for converting to XML.
227
+ */
228
+ enum NodeExportFlags {
229
+ /**
230
+ * No extra flags to use
231
+ */
232
+ NONE,
233
+ /**
234
+ * Add an XML header to the data
235
+ */
236
+ ADD_HEADER,
237
+ /**
238
+ * Split up children with a newline
239
+ */
240
+ FORMAT_MULTILINE,
241
+ /**
242
+ * Indent the XML by child depth
243
+ */
244
+ FORMAT_INDENT,
245
+ /**
246
+ * Include the siblings when converting
247
+ */
248
+ INCLUDE_SIBLINGS,
249
+ /**
250
+ * Only export the children of the node
251
+ */
252
+ ONLY_CHILDREN,
253
+ /**
254
+ * If node has no children, collapse open and close
255
+ * tags
256
+ */
257
+ COLLAPSE_EMPTY,
258
+ }
259
+ /**
260
+ * The opcode flags. The values have been carefully chosen so that a simple
261
+ * bitmask can be done to know how to compare for equality.
262
+ *
263
+ * function─┐ ┌─string
264
+ * bound──┐ │ │ ┌──integer
265
+ * token┐ │ │ │ │
266
+ * X X X X X X X
267
+ * 8 4 2 1
268
+ */
269
+ enum OpcodeFlags {
270
+ UNKNOWN,
271
+ /**
272
+ * Integer value set
273
+ */
274
+ INTEGER,
275
+ /**
276
+ * Text value set
277
+ */
278
+ TEXT,
279
+ /**
280
+ * An operator
281
+ */
282
+ FUNCTION,
283
+ /**
284
+ * A bound value, assigned later
285
+ */
286
+ BOUND,
287
+ BOOLEAN,
288
+ /**
289
+ * Tokenized text
290
+ */
291
+ TOKENIZED,
292
+ }
293
+ /**
294
+ * The flags used for queries.
295
+ */
296
+ enum QueryFlags {
297
+ /**
298
+ * No extra flags to use
299
+ */
300
+ NONE,
301
+ /**
302
+ * Optimize the query when possible
303
+ */
304
+ OPTIMIZE,
305
+ /**
306
+ * Use the indexed parameters
307
+ */
308
+ USE_INDEXES,
309
+ /**
310
+ * Reverse the results order
311
+ */
312
+ REVERSE,
313
+ /**
314
+ * Always cache the #XbNode objects
315
+ */
316
+ FORCE_NODE_CACHE,
317
+ }
318
+ /**
319
+ * The flags for loading a silo.
320
+ */
321
+ enum SiloLoadFlags {
322
+ /**
323
+ * No extra flags to use
324
+ */
325
+ NONE,
326
+ /**
327
+ * No not check header signature
328
+ */
329
+ NO_MAGIC,
330
+ /**
331
+ * Watch the XMLB file for changes
332
+ */
333
+ WATCH_BLOB,
334
+ }
335
+ /**
336
+ * The flags used when profiling a silo.
337
+ */
338
+ enum SiloProfileFlags {
339
+ /**
340
+ * No extra flags to use
341
+ */
342
+ NONE,
343
+ /**
344
+ * Output profiling as debug
345
+ */
346
+ DEBUG,
347
+ /**
348
+ * Save profiling in an appended string
349
+ */
350
+ APPEND,
351
+ /**
352
+ * Save XPATH queries
353
+ */
354
+ XPATH,
355
+ /**
356
+ * Output the machine optimizer as debug
357
+ */
358
+ OPTIMIZER,
359
+ }
360
+ module Builder {
361
+ // Constructor properties interface
362
+
363
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
364
+ }
365
+
366
+ class Builder extends GObject.Object {
367
+ static $gtype: GObject.GType<Builder>;
368
+
369
+ // Constructors of Xmlb.Builder
370
+
371
+ constructor(properties?: Partial<Builder.ConstructorProps>, ...args: any[]);
372
+
373
+ _init(...args: any[]): void;
374
+
375
+ static ['new'](): Builder;
376
+
377
+ // Own methods of Xmlb.Builder
378
+
379
+ /**
380
+ * Adds a function that will get run on every #XbBuilderNode compile creates
381
+ * for the silo. This is run after all the #XbBuilderSource fixups have been
382
+ * run.
383
+ * @param fixup a #XbBuilderFixup
384
+ */
385
+ add_fixup(fixup: BuilderFixup): void;
386
+ /**
387
+ * Adds a locale to the builder. Locales added first will be prioritised over
388
+ * locales added later.
389
+ * @param locale a locale, e.g. "en_US"
390
+ */
391
+ add_locale(locale: string): void;
392
+ /**
393
+ * Adds the GUID to the internal correctness hash.
394
+ * @param guid any text, typcically a filename or GUID
395
+ */
396
+ append_guid(guid: string): void;
397
+ /**
398
+ * Compiles a #XbSilo.
399
+ * @param flags some #XbBuilderCompileFlags, e.g. %XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT
400
+ * @param cancellable a #GCancellable, or %NULL
401
+ * @returns a #XbSilo, or %NULL for error
402
+ */
403
+ compile(flags: BuilderCompileFlags, cancellable?: Gio.Cancellable | null): Silo;
404
+ /**
405
+ * Ensures `file` is up to date, and returns a compiled #XbSilo.
406
+ *
407
+ * If `silo` is being used by a query (e.g. in another thread) then all node
408
+ * data is immediately invalid.
409
+ *
410
+ * The returned #XbSilo will use the thread-default main context at the time of
411
+ * calling this function for its future signal emissions.
412
+ * @param file a #GFile
413
+ * @param flags some #XbBuilderCompileFlags, e.g. %XB_BUILDER_COMPILE_FLAG_IGNORE_INVALID
414
+ * @param cancellable a #GCancellable, or %NULL
415
+ * @returns a #XbSilo, or %NULL for error
416
+ */
417
+ ensure(file: Gio.File, flags: BuilderCompileFlags, cancellable?: Gio.Cancellable | null): Silo;
418
+ /**
419
+ * Adds a node tree to the builder.
420
+ *
421
+ * If you are manually adding dynamic data sourced from a non-static source then you MUST use
422
+ * xb_builder_append_guid() with the appropriate GUID value, e.g. the file name and mtime.
423
+ *
424
+ * If no appropriate value is available, the caller can use something like:
425
+ *
426
+ * g_autofree gchar *tmp = xb_builder_node_export(bn, XB_NODE_EXPORT_FLAG_NONE, NULL);
427
+ * xb_builder_append_guid(builder, tmp);
428
+ *
429
+ * Failure to include an appropriate GUID value would allow an out-of-data silo to be used.
430
+ * @param bn a #XbBuilderNode
431
+ */
432
+ import_node(bn: BuilderNode): void;
433
+ /**
434
+ * Adds a #XbBuilderSource to the #XbBuilder.
435
+ * @param source a #XbBuilderSource
436
+ */
437
+ import_source(source: BuilderSource): void;
438
+ /**
439
+ * Enables or disables the collection of profiling data.
440
+ * @param profile_flags some #XbSiloProfileFlags, e.g. %XB_SILO_PROFILE_FLAG_DEBUG
441
+ */
442
+ set_profile_flags(profile_flags: SiloProfileFlags): void;
443
+ }
444
+
445
+ module BuilderFixup {
446
+ // Constructor properties interface
447
+
448
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
449
+ }
450
+
451
+ class BuilderFixup extends GObject.Object {
452
+ static $gtype: GObject.GType<BuilderFixup>;
453
+
454
+ // Constructors of Xmlb.BuilderFixup
455
+
456
+ constructor(properties?: Partial<BuilderFixup.ConstructorProps>, ...args: any[]);
457
+
458
+ _init(...args: any[]): void;
459
+
460
+ static ['new'](id: string, func: BuilderFixupFunc): BuilderFixup;
461
+
462
+ // Own methods of Xmlb.BuilderFixup
463
+
464
+ /**
465
+ * Gets the maximum depth used for this fixup, if each node is being visited.
466
+ * @returns integer, or -1 if unset
467
+ */
468
+ get_max_depth(): number;
469
+ /**
470
+ * Sets the maximum depth used for this fixup. Use a `max_depth` of 0 to only
471
+ * visit the root node.
472
+ *
473
+ * Setting a maximum depth may increase performance considerably if using
474
+ * fixup functions on large and deeply nested XML files.
475
+ * @param max_depth integer, -1 for "all"
476
+ */
477
+ set_max_depth(max_depth: number): void;
478
+ }
479
+
480
+ module BuilderNode {
481
+ // Constructor properties interface
482
+
483
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
484
+ }
485
+
486
+ class BuilderNode extends GObject.Object {
487
+ static $gtype: GObject.GType<BuilderNode>;
488
+
489
+ // Constructors of Xmlb.BuilderNode
490
+
491
+ constructor(properties?: Partial<BuilderNode.ConstructorProps>, ...args: any[]);
492
+
493
+ _init(...args: any[]): void;
494
+
495
+ static ['new'](element: string): BuilderNode;
496
+
497
+ // Own methods of Xmlb.BuilderNode
498
+
499
+ /**
500
+ * Adds a child builder node.
501
+ * @param child A XbBuilderNode
502
+ */
503
+ add_child(child: BuilderNode): void;
504
+ /**
505
+ * Adds a flag to the builder node.
506
+ * @param flag a #XbBuilderNodeFlags
507
+ */
508
+ add_flag(flag: BuilderNodeFlags): void;
509
+ /**
510
+ * Adds a token to the builder node.
511
+ * @param token a new token
512
+ */
513
+ add_token(token: string): void;
514
+ /**
515
+ * Gets the depth of the node tree, where 0 is the root node.
516
+ */
517
+ depth(): number;
518
+ /**
519
+ * Exports the node to XML.
520
+ * @param flags some #XbNodeExportFlags, e.g. #XB_NODE_EXPORT_FLAG_NONE
521
+ * @returns XML data, or %NULL for an error
522
+ */
523
+ ['export'](flags: NodeExportFlags): string;
524
+ /**
525
+ * Gets an attribute from the builder node.
526
+ * @param name attribute name, e.g. `type`
527
+ * @returns string, or %NULL if unset
528
+ */
529
+ get_attr(name: string): string;
530
+ /**
531
+ * Gets an attribute from the builder node.
532
+ * @param name attribute name, e.g. `priority`
533
+ * @returns integer, or 0 if unset
534
+ */
535
+ get_attr_as_uint(name: string): number;
536
+ /**
537
+ * Finds a child builder node by the element name, and optionally text value.
538
+ * @param element An element name, e.g. "url"
539
+ * @param text node text, e.g. "gimp.desktop"
540
+ * @returns a new #XbBuilderNode, or %NULL if not found
541
+ */
542
+ get_child(element: string, text?: string | null): BuilderNode;
543
+ /**
544
+ * Gets the children of the builder node.
545
+ * @returns children
546
+ */
547
+ get_children(): BuilderNode[];
548
+ /**
549
+ * Gets the element from the builder node.
550
+ * @returns string, or %NULL if unset
551
+ */
552
+ get_element(): string;
553
+ /**
554
+ * Gets the first child of the builder node.
555
+ * @returns a #XbBuilderNode, or %NULL
556
+ */
557
+ get_first_child(): BuilderNode;
558
+ /**
559
+ * Gets the last child of the builder node.
560
+ * @returns a #XbBuilderNode, or %NULL
561
+ */
562
+ get_last_child(): BuilderNode;
563
+ /**
564
+ * Gets the parent node for the current node.
565
+ * @returns a new #XbBuilderNode, or %NULL no parent exists.
566
+ */
567
+ get_parent(): BuilderNode;
568
+ /**
569
+ * Gets the tail from the builder node.
570
+ * @returns string, or %NULL if unset
571
+ */
572
+ get_tail(): string;
573
+ /**
574
+ * Gets the text from the builder node.
575
+ * @returns string, or %NULL if unset
576
+ */
577
+ get_text(): string;
578
+ /**
579
+ * Gets the text from the builder node.
580
+ * @returns integer, or 0 if unset
581
+ */
582
+ get_text_as_uint(): number;
583
+ /**
584
+ * Gets the tokens of the builder node.
585
+ * @returns tokens
586
+ */
587
+ get_tokens(): string[] | null;
588
+ /**
589
+ * Checks a flag on the builder node.
590
+ * @param flag a #XbBuilderNodeFlags
591
+ * @returns %TRUE if @flag is set
592
+ */
593
+ has_flag(flag: BuilderNodeFlags): boolean;
594
+ /**
595
+ * Removes an attribute from the builder node.
596
+ * @param name attribute name, e.g. `type`
597
+ */
598
+ remove_attr(name: string): void;
599
+ /**
600
+ * Removes a child builder node.
601
+ * @param child A XbBuilderNode
602
+ */
603
+ remove_child(child: BuilderNode): void;
604
+ /**
605
+ * Adds an attribute to the builder node.
606
+ * @param name attribute name, e.g. `type`
607
+ * @param value attribute value, e.g. `desktop`
608
+ */
609
+ set_attr(name: string, value: string): void;
610
+ /**
611
+ * Sets the element name on the builder node.
612
+ * @param element a string element
613
+ */
614
+ set_element(element: string): void;
615
+ /**
616
+ * Sets the tail on the builder node.
617
+ * @param tail a string
618
+ * @param tail_len length of @tail, or -1 if @tail is NUL terminated
619
+ */
620
+ set_tail(tail: string | null, tail_len: number): void;
621
+ /**
622
+ * Sets the text on the builder node.
623
+ * @param text a string
624
+ * @param text_len length of @text, or -1 if @text is NUL terminated
625
+ */
626
+ set_text(text: string | null, text_len: number): void;
627
+ /**
628
+ * Sorts the node children using a custom sort function.
629
+ * @param func a #XbBuilderNodeSortFunc
630
+ */
631
+ sort_children(func: BuilderNodeSortFunc): void;
632
+ /**
633
+ * Tokenize text added with xb_builder_node_set_text().
634
+ *
635
+ * When searching, libxmlb often has to tokenize strings before they can be
636
+ * compared. This is done in the "fast path" and makes searching for non-ASCII
637
+ * text much slower.
638
+ *
639
+ * Adding the tokens to the deduplicated string table allows much faster
640
+ * searching at the expense of a ~5% size increase of the silo.
641
+ *
642
+ * This function adds all valid UTF-8 and ASCII search words generated from
643
+ * the value of xb_builder_node_set_text().
644
+ *
645
+ * The transliteration locale (e.g. `en_GB`) is read from the `xml:lang`
646
+ * node attribute if set.
647
+ */
648
+ tokenize_text(): void;
649
+ /**
650
+ * Traverses a tree starting from `self`. It calls the given function for each
651
+ * node visited.
652
+ *
653
+ * The traversal can be halted at any point by returning TRUE from `func`.
654
+ * @param order a #GTraverseType, e.g. %G_PRE_ORDER
655
+ * @param flags a #GTraverseFlags, e.g. %G_TRAVERSE_ALL
656
+ * @param max_depth the maximum depth of the traversal, or -1 for no limit
657
+ * @param func a #XbBuilderNodeTraverseFunc
658
+ */
659
+ traverse(
660
+ order: GLib.TraverseType,
661
+ flags: GLib.TraverseFlags,
662
+ max_depth: number,
663
+ func: BuilderNodeTraverseFunc,
664
+ ): void;
665
+ /**
666
+ * Unlinks a #XbBuilderNode from a tree, resulting in two separate trees.
667
+ *
668
+ * This should not be used from the function called by xb_builder_node_traverse()
669
+ * otherwise the entire tree will not be traversed.
670
+ *
671
+ * Instead use xb_builder_node_add_flag(bn,XB_BUILDER_NODE_FLAG_IGNORE);
672
+ */
673
+ unlink(): void;
674
+ }
675
+
676
+ module BuilderSource {
677
+ // Constructor properties interface
678
+
679
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
680
+ }
681
+
682
+ class BuilderSource extends GObject.Object {
683
+ static $gtype: GObject.GType<BuilderSource>;
684
+
685
+ // Constructors of Xmlb.BuilderSource
686
+
687
+ constructor(properties?: Partial<BuilderSource.ConstructorProps>, ...args: any[]);
688
+
689
+ _init(...args: any[]): void;
690
+
691
+ static ['new'](): BuilderSource;
692
+
693
+ // Own methods of Xmlb.BuilderSource
694
+
695
+ /**
696
+ * Adds a function that will get run on every #XbBuilderNode compile creates
697
+ * with this source.
698
+ * @param fixup a #XbBuilderFixup
699
+ */
700
+ add_fixup(fixup: BuilderFixup): void;
701
+ /**
702
+ * Loads XML data and begins to build a #XbSilo.
703
+ * @param bytes a #GBytes
704
+ * @param flags some #XbBuilderSourceFlags, e.g. %XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT
705
+ * @returns %TRUE for success
706
+ */
707
+ load_bytes(bytes: GLib.Bytes | Uint8Array, flags: BuilderSourceFlags): boolean;
708
+ /**
709
+ * Loads an optionally compressed XML file to build a #XbSilo.
710
+ * @param file a #GFile
711
+ * @param flags some #XbBuilderSourceFlags, e.g. %XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT
712
+ * @param cancellable a #GCancellable, or %NULL
713
+ * @returns %TRUE for success
714
+ */
715
+ load_file(file: Gio.File, flags: BuilderSourceFlags, cancellable?: Gio.Cancellable | null): boolean;
716
+ /**
717
+ * Loads XML data and begins to build a #XbSilo.
718
+ * @param xml XML data
719
+ * @param flags some #XbBuilderSourceFlags, e.g. %XB_BUILDER_SOURCE_FLAG_LITERAL_TEXT
720
+ * @returns %TRUE for success
721
+ */
722
+ load_xml(xml: string, flags: BuilderSourceFlags): boolean;
723
+ /**
724
+ * Sets an optional information metadata node on the root node.
725
+ * @param info a #XbBuilderNode
726
+ */
727
+ set_info(info?: BuilderNode | null): void;
728
+ /**
729
+ * Sets an optional prefix on the root node. This makes any nodes added
730
+ * using this source reside under a common shared parent node.
731
+ * @param prefix an XPath prefix, e.g. `installed`
732
+ */
733
+ set_prefix(prefix?: string | null): void;
734
+ }
735
+
736
+ module BuilderSourceCtx {
737
+ // Constructor properties interface
738
+
739
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
740
+ }
741
+
742
+ class BuilderSourceCtx extends GObject.Object {
743
+ static $gtype: GObject.GType<BuilderSourceCtx>;
744
+
745
+ // Constructors of Xmlb.BuilderSourceCtx
746
+
747
+ constructor(properties?: Partial<BuilderSourceCtx.ConstructorProps>, ...args: any[]);
748
+
749
+ _init(...args: any[]): void;
750
+
751
+ // Own methods of Xmlb.BuilderSourceCtx
752
+
753
+ /**
754
+ * Returns the data currently being processed.
755
+ *
756
+ * If the #XbBuilderSourceCtx is backed by a file, the returned #GBytes may be
757
+ * memory-mapped, and the backing file must not be modified until the #GBytes is
758
+ * destroyed.
759
+ * @param cancellable a #GCancellable, or %NULL
760
+ * @returns a #GBytes
761
+ */
762
+ get_bytes(cancellable?: Gio.Cancellable | null): GLib.Bytes;
763
+ /**
764
+ * Returns the basename of the file currently being processed.
765
+ * @returns a basename, or %NULL if unset
766
+ */
767
+ get_filename(): string | null;
768
+ /**
769
+ * Returns the input stream currently being processed.
770
+ * @returns a #GInputStream
771
+ */
772
+ get_stream(): Gio.InputStream;
773
+ }
774
+
775
+ module Machine {
776
+ // Constructor properties interface
777
+
778
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
779
+ }
780
+
781
+ class Machine extends GObject.Object {
782
+ static $gtype: GObject.GType<Machine>;
783
+
784
+ // Constructors of Xmlb.Machine
785
+
786
+ constructor(properties?: Partial<Machine.ConstructorProps>, ...args: any[]);
787
+
788
+ _init(...args: any[]): void;
789
+
790
+ static ['new'](): Machine;
791
+
792
+ // Own methods of Xmlb.Machine
793
+
794
+ /**
795
+ * Adds a new function to the virtual machine. Registered functions can then be
796
+ * used as methods.
797
+ *
798
+ * The `method_cb` must not modify the stack it’s passed unless it’s going to
799
+ * succeed. In particular, if a method call is not optimisable, it must not
800
+ * modify the stack it’s passed.
801
+ *
802
+ * You need to add a custom function using xb_machine_add_method() before using
803
+ * methods that may reference it, for example xb_machine_add_opcode_fixup().
804
+ * @param name function name, e.g. `contains`
805
+ * @param n_opcodes minimum number of opcodes required on the stack
806
+ * @param method_cb function to call
807
+ */
808
+ add_method(name: string, n_opcodes: number, method_cb: MachineMethodFunc): void;
809
+ /**
810
+ * Adds an opcode fixup. Fixups can be used to optimize the stack of opcodes or
811
+ * to add support for a nonstandard feature, for instance supporting missing
812
+ * attributes to functions.
813
+ * @param opcodes_sig signature, e.g. `INTE,TEXT`
814
+ * @param fixup_cb callback
815
+ */
816
+ add_opcode_fixup(opcodes_sig: string, fixup_cb: MachineOpcodeFixupFunc): void;
817
+ /**
818
+ * Adds a new operator to the virtual machine. Operators can then be used
819
+ * instead of explicit methods like `eq()`.
820
+ *
821
+ * You need to add a custom operator using xb_machine_add_operator() before
822
+ * using xb_machine_parse(). Common operators like `<=` and `=` are built-in
823
+ * and do not have to be added manually.
824
+ * @param str operator string, e.g. `==`
825
+ * @param name function name, e.g. `contains`
826
+ */
827
+ add_operator(str: string, name: string): void;
828
+ /**
829
+ * Adds a text handler. This allows the virtual machine to support nonstandard
830
+ * encoding or shorthand mnemonics for standard functions.
831
+ * @param handler_cb callback
832
+ */
833
+ add_text_handler(handler_cb: MachineTextHandlerFunc): void;
834
+ /**
835
+ * Gets the maximum stack size used for the machine.
836
+ * @returns integer
837
+ */
838
+ get_stack_size(): number;
839
+ /**
840
+ * Initialises a stack allocated #XbOpcode for a registered function.
841
+ * Some standard functions are registered by default, for instance `eq` or `ge`.
842
+ * Other functions have to be added using xb_machine_add_method().
843
+ * @param func_name function name, e.g. `eq`
844
+ * @returns %TRUE if the function was found and the opcode initialised, %FALSE otherwise
845
+ */
846
+ opcode_func_init(func_name: string): [boolean, Opcode];
847
+ /**
848
+ * Parses an XPath predicate. Not all of XPath 1.0 or XPath 1.0 is supported,
849
+ * and new functions and mnemonics can be added using xb_machine_add_method()
850
+ * and xb_machine_add_text_handler().
851
+ * @param text predicate to parse, e.g. `contains(text(),'xyx')`
852
+ * @param text_len length of @text, or -1 if @text is `NUL` terminated
853
+ * @returns opcodes, or %NULL on error
854
+ */
855
+ parse(text: string, text_len: number): Stack;
856
+ /**
857
+ * Parses an XPath predicate. Not all of XPath 1.0 or XPath 1.0 is supported,
858
+ * and new functions and mnemonics can be added using xb_machine_add_method()
859
+ * and xb_machine_add_text_handler().
860
+ * @param text predicate to parse, e.g. `contains(text(),'xyx')`
861
+ * @param text_len length of @text, or -1 if @text is `NUL` terminated
862
+ * @param flags #XbMachineParseFlags, e.g. %XB_MACHINE_PARSE_FLAG_OPTIMIZE
863
+ * @returns opcodes, or %NULL on error
864
+ */
865
+ parse_full(text: string, text_len: number, flags: MachineParseFlags): Stack;
866
+ /**
867
+ * Runs a set of opcodes on the virtual machine.
868
+ *
869
+ * It is safe to call this function from a different thread to the one that
870
+ * created the #XbMachine.
871
+ * @param opcodes a #XbStack of opcodes
872
+ * @param exec_data per-run user data that is passed to all the #XbMachineMethodFunc functions
873
+ * @returns a new #XbOpcode, or %NULL
874
+ */
875
+ run(opcodes: Stack, exec_data?: any | null): [boolean, boolean];
876
+ /**
877
+ * Runs a set of opcodes on the virtual machine, using the bound values given in
878
+ * `bindings` to substitute for bound opcodes.
879
+ *
880
+ * It is safe to call this function from a different thread to the one that
881
+ * created the #XbMachine.
882
+ * @param opcodes a #XbStack of opcodes
883
+ * @param bindings 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
884
+ * @param exec_data per-run user data that is passed to all the #XbMachineMethodFunc functions
885
+ * @returns a new #XbOpcode, or %NULL
886
+ */
887
+ run_with_bindings(opcodes: Stack, bindings: ValueBindings | null, exec_data?: any | null): [boolean, boolean];
888
+ /**
889
+ * Sets the debug level of the virtual machine.
890
+ * @param flags #XbMachineDebugFlags, e.g. %XB_MACHINE_DEBUG_FLAG_SHOW_STACK
891
+ */
892
+ set_debug_flags(flags: MachineDebugFlags): void;
893
+ /**
894
+ * Sets the maximum stack size used for the machine.
895
+ *
896
+ * The stack size will be affective for new jobs started with xb_machine_run()
897
+ * and xb_machine_parse().
898
+ * @param stack_size integer
899
+ */
900
+ set_stack_size(stack_size: number): void;
901
+ /**
902
+ * Pops an opcode from the stack.
903
+ * @param stack a #XbStack
904
+ * @returns %TRUE if popping succeeded, %FALSE if the stack was empty already
905
+ */
906
+ stack_pop(stack: Stack): [boolean, Opcode | null];
907
+ /**
908
+ * Pushes a new empty opcode onto the end of the stack. A pointer to the opcode
909
+ * is returned in `opcode_out` so that the caller can initialise it.
910
+ *
911
+ * If the stack reaches its maximum size, %G_IO_ERROR_NO_SPACE will be returned.
912
+ * @param stack a #XbStack
913
+ * @returns %TRUE if a new empty opcode was returned, or %FALSE if the stack has reached its maximum size
914
+ */
915
+ stack_push(stack: Stack): [boolean, Opcode | null];
916
+ /**
917
+ * Adds an integer literal to the stack.
918
+ *
919
+ * Errors are as for xb_machine_stack_push().
920
+ * @param stack a #XbStack
921
+ * @param val integer literal
922
+ * @returns %TRUE on success, %FALSE otherwise
923
+ */
924
+ stack_push_integer(stack: Stack, val: number): boolean;
925
+ /**
926
+ * Adds a text literal to the stack, copying `str`.
927
+ *
928
+ * Errors are as for xb_machine_stack_push().
929
+ * @param stack a #XbStack
930
+ * @param str text literal
931
+ * @returns %TRUE on success, %FALSE otherwise
932
+ */
933
+ stack_push_text(stack: Stack, str: string): boolean;
934
+ /**
935
+ * Adds static text literal to the stack.
936
+ *
937
+ * Errors are as for xb_machine_stack_push().
938
+ * @param stack a #XbStack
939
+ * @param str text literal
940
+ * @returns %TRUE on success, %FALSE otherwise
941
+ */
942
+ stack_push_text_static(stack: Stack, str: string): boolean;
943
+ /**
944
+ * Adds a stolen text literal to the stack.
945
+ *
946
+ * Errors are as for xb_machine_stack_push().
947
+ * @param stack a #XbStack
948
+ * @param str text literal
949
+ * @returns %TRUE on success, %FALSE otherwise
950
+ */
951
+ stack_push_text_steal(stack: Stack, str: string): boolean;
952
+ }
953
+
954
+ module Node {
955
+ // Constructor properties interface
956
+
957
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
958
+ }
959
+
960
+ class Node extends GObject.Object {
961
+ static $gtype: GObject.GType<Node>;
962
+
963
+ // Constructors of Xmlb.Node
964
+
965
+ constructor(properties?: Partial<Node.ConstructorProps>, ...args: any[]);
966
+
967
+ _init(...args: any[]): void;
968
+
969
+ // Own methods of Xmlb.Node
970
+
971
+ /**
972
+ * Exports the node back to XML.
973
+ * @param flags some #XbNodeExportFlags, e.g. #XB_NODE_EXPORT_FLAG_NONE
974
+ * @returns XML data, or %NULL for an error
975
+ */
976
+ ['export'](flags: NodeExportFlags): string;
977
+ /**
978
+ * Gets some attribute text data for a specific node.
979
+ * @param name an attribute name, e.g. "type"
980
+ * @returns a string, or %NULL for unset
981
+ */
982
+ get_attr(name: string): string;
983
+ /**
984
+ * Gets some attribute text data for a specific node.
985
+ * @param name an attribute name, e.g. `type`
986
+ * @returns a guint64, or %G_MAXUINT64 if unfound
987
+ */
988
+ get_attr_as_uint(name: string): number;
989
+ /**
990
+ * Gets the first child node for the current node.
991
+ * @returns a #XbNode, or %NULL
992
+ */
993
+ get_child(): Node;
994
+ /**
995
+ * Gets all the children for the current node.
996
+ * @returns an array of children
997
+ */
998
+ get_children(): Node[];
999
+ /**
1000
+ * Gets any data that has been set on the node using xb_node_set_data().
1001
+ *
1002
+ * This will only work across queries to the associated silo if the silo has
1003
+ * its #XbSilo:enable-node-cache property set to %TRUE. Otherwise a new #XbNode
1004
+ * may be constructed for future queries which return the same element as a
1005
+ * result.
1006
+ * @param key a string key, e.g. `fwupd::RemoteId`
1007
+ * @returns a #GBytes, or %NULL if not found
1008
+ */
1009
+ get_data(key: string): GLib.Bytes;
1010
+ // Conflicted with GObject.Object.get_data
1011
+ get_data(...args: never[]): any;
1012
+ /**
1013
+ * Gets the depth of the node to a root.
1014
+ * @returns a integer, where 0 is the root node itself.
1015
+ */
1016
+ get_depth(): number;
1017
+ /**
1018
+ * Gets the element name for a specific node.
1019
+ * @returns a string, or %NULL for the root node
1020
+ */
1021
+ get_element(): string;
1022
+ /**
1023
+ * Gets the next sibling node for the current node.
1024
+ * @returns a #XbNode, or %NULL
1025
+ */
1026
+ get_next(): Node;
1027
+ /**
1028
+ * Gets the parent node for the current node.
1029
+ * @returns a #XbNode, or %NULL
1030
+ */
1031
+ get_parent(): Node;
1032
+ /**
1033
+ * Gets the root node for the node.
1034
+ * @returns a #XbNode, or %NULL
1035
+ */
1036
+ get_root(): Node;
1037
+ /**
1038
+ * Gets the #XbSilo for the node.
1039
+ * @returns a #XbSilo
1040
+ */
1041
+ get_silo(): Silo;
1042
+ /**
1043
+ * Gets the tail data for a specific node.
1044
+ * @returns a string, or %NULL for unset
1045
+ */
1046
+ get_tail(): string;
1047
+ /**
1048
+ * Gets the text data for a specific node.
1049
+ * @returns a string, or %NULL for unset
1050
+ */
1051
+ get_text(): string;
1052
+ /**
1053
+ * Gets some attribute text data for a specific node.
1054
+ * @returns a guint64, or %G_MAXUINT64 if unfound
1055
+ */
1056
+ get_text_as_uint(): number;
1057
+ /**
1058
+ * Searches the silo using an XPath query, returning up to `limit` results.
1059
+ *
1060
+ * It is safe to call this function from a different thread to the one that
1061
+ * created the #XbSilo.
1062
+ *
1063
+ * Please note: Only a subset of XPath is supported.
1064
+ * @param xpath an XPath, e.g. `id[abe.desktop]`
1065
+ * @param limit maximum number of results to return, or 0 for "all"
1066
+ * @returns results, or %NULL if unfound
1067
+ */
1068
+ query(xpath: string, limit: number): Node[];
1069
+ /**
1070
+ * Searches the node using an XPath query, returning up to one result.
1071
+ *
1072
+ * It is safe to call this function from a different thread to the one that
1073
+ * created the #XbSilo.
1074
+ *
1075
+ * Please note: Only a subset of XPath is supported.
1076
+ * @param xpath An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]`
1077
+ * @param name an attribute name, e.g. `type`
1078
+ * @returns a string, or %NULL if unfound
1079
+ */
1080
+ query_attr(xpath: string, name: string): string;
1081
+ /**
1082
+ * Searches the node using an XPath query, returning up to one result.
1083
+ *
1084
+ * It is safe to call this function from a different thread to the one that
1085
+ * created the #XbSilo.
1086
+ *
1087
+ * Please note: Only a subset of XPath is supported.
1088
+ * @param xpath An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]`
1089
+ * @param name an attribute name, e.g. `type`
1090
+ * @returns a #guint64, or %G_MAXUINT64 if unfound
1091
+ */
1092
+ query_attr_as_uint(xpath: string, name: string): number;
1093
+ /**
1094
+ * Searches the node using an XPath query, returning an XML string of the
1095
+ * result and any children.
1096
+ *
1097
+ * It is safe to call this function from a different thread to the one that
1098
+ * created the #XbSilo.
1099
+ *
1100
+ * Please note: Only a subset of XPath is supported.
1101
+ * @param xpath An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]`
1102
+ * @returns a string, or %NULL if unfound
1103
+ */
1104
+ query_export(xpath: string): string;
1105
+ /**
1106
+ * Searches the node using an XPath query, returning up to one result.
1107
+ *
1108
+ * Please note: Only a tiny subset of XPath 1.0 is supported.
1109
+ * @param xpath An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]`
1110
+ * @returns a #XbNode, or %NULL if unfound
1111
+ */
1112
+ query_first(xpath: string): Node;
1113
+ /**
1114
+ * Searches the silo using a prepared query, returning up to one result. To
1115
+ * search using a query with bound values, use
1116
+ * xb_node_query_first_with_context().
1117
+ *
1118
+ * It is safe to call this function from a different thread to the one that
1119
+ * created the #XbSilo.
1120
+ *
1121
+ * Please note: Only a subset of XPath is supported.
1122
+ * @param query an #XbQuery
1123
+ * @returns a #XbNode, or %NULL if unfound
1124
+ */
1125
+ query_first_full(query: Query): Node;
1126
+ /**
1127
+ * Searches the silo using a prepared query, returning up to one result.
1128
+ *
1129
+ * It is safe to call this function from a different thread to the one that
1130
+ * created the #XbSilo.
1131
+ *
1132
+ * Please note: Only a subset of XPath is supported.
1133
+ * @param query an #XbQuery
1134
+ * @param context 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
1135
+ * @returns a #XbNode, or %NULL if unfound
1136
+ */
1137
+ query_first_with_context(query: Query, context?: QueryContext | null): Node;
1138
+ /**
1139
+ * Searches the silo using a prepared query. To search using a query with
1140
+ * bound values, use xb_node_query_with_context().
1141
+ *
1142
+ * It is safe to call this function from a different thread to the one that
1143
+ * created the #XbSilo.
1144
+ *
1145
+ * Please note: Only a subset of XPath is supported.
1146
+ * @param query an #XbQuery
1147
+ * @returns results, or %NULL if unfound
1148
+ */
1149
+ query_full(query: Query): Node[];
1150
+ /**
1151
+ * Searches the node using an XPath query, returning up to one result.
1152
+ *
1153
+ * It is safe to call this function from a different thread to the one that
1154
+ * created the #XbSilo.
1155
+ *
1156
+ * Please note: Only a subset of XPath is supported.
1157
+ * @param xpath An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]`
1158
+ * @returns a string, or %NULL if unfound
1159
+ */
1160
+ query_text(xpath: string): string;
1161
+ /**
1162
+ * Searches the node using an XPath query, returning up to one result.
1163
+ *
1164
+ * It is safe to call this function from a different thread to the one that
1165
+ * created the #XbSilo.
1166
+ *
1167
+ * Please note: Only a subset of XPath is supported.
1168
+ * @param xpath An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]`
1169
+ * @returns a #guint64, or %G_MAXUINT64 if unfound
1170
+ */
1171
+ query_text_as_uint(xpath: string): number;
1172
+ /**
1173
+ * Searches the silo using a prepared query, substituting values from the
1174
+ * bindings in `context` for bound opcodes as needed.
1175
+ *
1176
+ * It is safe to call this function from a different thread to the one that
1177
+ * created the #XbSilo.
1178
+ *
1179
+ * Please note: Only a subset of XPath is supported.
1180
+ * @param query an #XbQuery
1181
+ * @param context 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
1182
+ * @returns results, or %NULL if unfound
1183
+ */
1184
+ query_with_context(query: Query, context?: QueryContext | null): Node[];
1185
+ /**
1186
+ * Sets some data on the node which can be retrieved using xb_node_get_data().
1187
+ *
1188
+ * This will only work across queries to the associated silo if the silo has
1189
+ * its #XbSilo:enable-node-cache property set to %TRUE. Otherwise a new #XbNode
1190
+ * may be constructed for future queries which return the same element as a
1191
+ * result.
1192
+ * @param key a string key, e.g. `fwupd::RemoteId`
1193
+ * @param data a #GBytes
1194
+ */
1195
+ set_data(key: string, data: GLib.Bytes | Uint8Array): void;
1196
+ // Conflicted with GObject.Object.set_data
1197
+ set_data(...args: never[]): any;
1198
+ /**
1199
+ * Traverses a tree starting from `self`. It calls the given functions for each
1200
+ * node visited. This allows transmogrification of the source, for instance
1201
+ * converting the XML description to PangoMarkup or even something completely
1202
+ * different like markdown.
1203
+ *
1204
+ * The traversal can be halted at any point by returning TRUE from `func`.
1205
+ * @param func_text (allow-none): a #XbBuilderNodeTraverseFunc
1206
+ * @param func_tail (allow-none): a #XbBuilderNodeTraverseFunc
1207
+ * @returns %TRUE if all nodes were visited
1208
+ */
1209
+ transmogrify(func_text: NodeTransmogrifyFunc, func_tail: NodeTransmogrifyFunc): boolean;
1210
+ }
1211
+
1212
+ module Query {
1213
+ // Constructor properties interface
1214
+
1215
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
1216
+ }
1217
+
1218
+ class Query extends GObject.Object {
1219
+ static $gtype: GObject.GType<Query>;
1220
+
1221
+ // Constructors of Xmlb.Query
1222
+
1223
+ constructor(properties?: Partial<Query.ConstructorProps>, ...args: any[]);
1224
+
1225
+ _init(...args: any[]): void;
1226
+
1227
+ static ['new'](silo: Silo, xpath: string): Query;
1228
+
1229
+ static new_full(silo: Silo, xpath: string, flags: QueryFlags): Query;
1230
+
1231
+ // Own methods of Xmlb.Query
1232
+
1233
+ /**
1234
+ * Assigns a string to a bound value specified using `?`.
1235
+ * @param idx an integer index
1236
+ * @param str string to assign to the bound variable
1237
+ * @returns %TRUE if the @idx existed
1238
+ */
1239
+ bind_str(idx: number, str: string): boolean;
1240
+ /**
1241
+ * Assigns a string to a bound value specified using `?`.
1242
+ * @param idx an integer index
1243
+ * @param val value to assign to the bound variable
1244
+ * @returns %TRUE if the @idx existed
1245
+ */
1246
+ bind_val(idx: number, val: number): boolean;
1247
+ /**
1248
+ * Gets the flags used for this query.
1249
+ * @returns #XbQueryFlags, default %XB_QUERY_FLAG_NONE
1250
+ */
1251
+ get_flags(): QueryFlags;
1252
+ /**
1253
+ * Gets the results limit on this query, where 0 is 'all'.
1254
+ * @returns integer, default 0
1255
+ */
1256
+ get_limit(): number;
1257
+ /**
1258
+ * Gets the XPath string that created the query.
1259
+ * @returns string
1260
+ */
1261
+ get_xpath(): string;
1262
+ /**
1263
+ * Sets the flags to use for this query.
1264
+ * @param flags a #XbQueryFlags, e.g. %XB_QUERY_FLAG_USE_INDEXES
1265
+ */
1266
+ set_flags(flags: QueryFlags): void;
1267
+ /**
1268
+ * Sets the results limit on this query, where 0 is 'all'.
1269
+ * @param limit integer
1270
+ */
1271
+ set_limit(limit: number): void;
1272
+ }
1273
+
1274
+ module Silo {
1275
+ // Constructor properties interface
1276
+
1277
+ interface ConstructorProps extends GObject.Object.ConstructorProps {
1278
+ enable_node_cache: boolean;
1279
+ enableNodeCache: boolean;
1280
+ guid: string;
1281
+ valid: boolean;
1282
+ }
1283
+ }
1284
+
1285
+ class Silo extends GObject.Object {
1286
+ static $gtype: GObject.GType<Silo>;
1287
+
1288
+ // Own properties of Xmlb.Silo
1289
+
1290
+ /**
1291
+ * Whether to cache all #XbNode instances ever constructed in a single
1292
+ * cache in the #XbSilo, so that the same #XbNode instance is always
1293
+ * returned in query results for a given XPath. This is a form of
1294
+ * memoisation, and allows xb_node_get_data() and xb_node_set_data() to
1295
+ * be used.
1296
+ *
1297
+ * This is enabled by default to preserve compatibility with older
1298
+ * versions of libxmlb, but most clients will want to disable it. It
1299
+ * adds a large memory overhead (no #XbNode is ever finalised) but
1300
+ * achieves moderately low hit rates for typical XML parsing workloads
1301
+ * where most nodes are accessed only once or twice as they are
1302
+ * processed and then processing moves on to other nodes.
1303
+ *
1304
+ * This property can only be changed before the #XbSilo is passed
1305
+ * between threads. Changing it is not thread-safe.
1306
+ */
1307
+ get enable_node_cache(): boolean;
1308
+ set enable_node_cache(val: boolean);
1309
+ /**
1310
+ * Whether to cache all #XbNode instances ever constructed in a single
1311
+ * cache in the #XbSilo, so that the same #XbNode instance is always
1312
+ * returned in query results for a given XPath. This is a form of
1313
+ * memoisation, and allows xb_node_get_data() and xb_node_set_data() to
1314
+ * be used.
1315
+ *
1316
+ * This is enabled by default to preserve compatibility with older
1317
+ * versions of libxmlb, but most clients will want to disable it. It
1318
+ * adds a large memory overhead (no #XbNode is ever finalised) but
1319
+ * achieves moderately low hit rates for typical XML parsing workloads
1320
+ * where most nodes are accessed only once or twice as they are
1321
+ * processed and then processing moves on to other nodes.
1322
+ *
1323
+ * This property can only be changed before the #XbSilo is passed
1324
+ * between threads. Changing it is not thread-safe.
1325
+ */
1326
+ get enableNodeCache(): boolean;
1327
+ set enableNodeCache(val: boolean);
1328
+ get guid(): string;
1329
+ set guid(val: string);
1330
+ get valid(): boolean;
1331
+
1332
+ // Constructors of Xmlb.Silo
1333
+
1334
+ constructor(properties?: Partial<Silo.ConstructorProps>, ...args: any[]);
1335
+
1336
+ _init(...args: any[]): void;
1337
+
1338
+ static ['new'](): Silo;
1339
+
1340
+ static new_from_xml(xml: string): Silo;
1341
+
1342
+ // Own methods of Xmlb.Silo
1343
+
1344
+ /**
1345
+ * Exports the silo back to XML.
1346
+ * @param flags some #XbNodeExportFlags, e.g. #XB_NODE_EXPORT_FLAG_NONE
1347
+ * @returns XML data, or %NULL for an error
1348
+ */
1349
+ ['export'](flags: NodeExportFlags): string;
1350
+ /**
1351
+ * Exports the silo back to an XML file.
1352
+ * @param file a #GFile
1353
+ * @param flags some #XbNodeExportFlags, e.g. #XB_NODE_EXPORT_FLAG_NONE
1354
+ * @param cancellable a #GCancellable, or %NULL
1355
+ * @returns %TRUE on success
1356
+ */
1357
+ export_file(file: Gio.File, flags: NodeExportFlags, cancellable?: Gio.Cancellable | null): boolean;
1358
+ /**
1359
+ * Gets the backing object that created the blob.
1360
+ *
1361
+ * You should never *ever* modify this data.
1362
+ * @returns A #GBytes, or %NULL if never set
1363
+ */
1364
+ get_bytes(): GLib.Bytes;
1365
+ /**
1366
+ * Get #XbSilo:enable-node-cache.
1367
+ */
1368
+ get_enable_node_cache(): boolean;
1369
+ /**
1370
+ * Gets the GUID used to identify this silo.
1371
+ * @returns a string, otherwise %NULL
1372
+ */
1373
+ get_guid(): string;
1374
+ /**
1375
+ * Returns the profiling data. This will only return profiling text if
1376
+ * xb_silo_set_profile_flags() was used with %XB_SILO_PROFILE_FLAG_APPEND.
1377
+ * @returns text profiling data
1378
+ */
1379
+ get_profile_string(): string;
1380
+ /**
1381
+ * Gets the root node for the silo. (MIGHT BE MORE).
1382
+ * @returns A #XbNode, or %NULL for an error
1383
+ */
1384
+ get_root(): Node;
1385
+ /**
1386
+ * Gets the number of nodes in the silo.
1387
+ * @returns a integer, or 0 is an empty blob
1388
+ */
1389
+ get_size(): number;
1390
+ /**
1391
+ * Invalidates a silo. Future calls xb_silo_is_valid() will return %FALSE.
1392
+ */
1393
+ invalidate(): void;
1394
+ /**
1395
+ * Checks is the silo is valid. The usual reason the silo is invalidated is
1396
+ * when the backing mmapped file has changed, or one of the imported files have
1397
+ * been modified.
1398
+ * @returns %TRUE if valid
1399
+ */
1400
+ is_valid(): boolean;
1401
+ /**
1402
+ * Loads a silo from memory location.
1403
+ * @param blob a #GBytes
1404
+ * @param flags #XbSiloLoadFlags, e.g. %XB_SILO_LOAD_FLAG_NONE
1405
+ * @returns %TRUE for success, otherwise @error is set.
1406
+ */
1407
+ load_from_bytes(blob: GLib.Bytes | Uint8Array, flags: SiloLoadFlags): boolean;
1408
+ /**
1409
+ * Loads a silo from file.
1410
+ * @param file a #GFile
1411
+ * @param flags #XbSiloLoadFlags, e.g. %XB_SILO_LOAD_FLAG_NONE
1412
+ * @param cancellable a #GCancellable, or %NULL
1413
+ * @returns %TRUE for success, otherwise @error is set.
1414
+ */
1415
+ load_from_file(file: Gio.File, flags: SiloLoadFlags, cancellable?: Gio.Cancellable | null): boolean;
1416
+ /**
1417
+ * Create an #XbQuery from the given `xpath` XPath string, or return it from the
1418
+ * query cache in the #XbSilo.
1419
+ *
1420
+ * `xpath` must be valid: it is a programmer error if creating the query fails
1421
+ * (i.e. if xb_query_new() returns an error).
1422
+ *
1423
+ * This function is thread-safe.
1424
+ * @param xpath an XPath query string
1425
+ * @returns an #XbQuery representing @xpath
1426
+ */
1427
+ lookup_query(xpath: string): Query;
1428
+ /**
1429
+ * Searches the silo using an XPath query, returning up to `limit` results.
1430
+ *
1431
+ * It is safe to call this function from a different thread to the one that
1432
+ * created the #XbSilo.
1433
+ *
1434
+ * Please note: Only a subset of XPath is supported.
1435
+ * @param xpath an XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]`
1436
+ * @param limit maximum number of results to return, or 0 for "all"
1437
+ * @returns results, or %NULL if unfound
1438
+ */
1439
+ query(xpath: string, limit: number): Node[];
1440
+ /**
1441
+ * Adds the `attr()` or `text()` results of a query to the index.
1442
+ * @param xpath An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]`
1443
+ * @param attr Attribute name, e.g. `type`, or NULL
1444
+ * @returns %TRUE for success
1445
+ */
1446
+ query_build_index(xpath: string, attr?: string | null): boolean;
1447
+ /**
1448
+ * Searches the silo using an XPath query, returning up to one result.
1449
+ *
1450
+ * It is safe to call this function from a different thread to the one that
1451
+ * created the #XbSilo.
1452
+ *
1453
+ * Please note: Only a tiny subset of XPath 1.0 is supported.
1454
+ * @param xpath An XPath, e.g. `/components/component[@type=desktop]/id[abe.desktop]`
1455
+ * @returns a #XbNode, or %NULL if unfound
1456
+ */
1457
+ query_first(xpath: string): Node;
1458
+ /**
1459
+ * Searches the silo using an XPath query, returning up to one result.
1460
+ *
1461
+ * It is safe to call this function from a different thread to the one that
1462
+ * created the #XbSilo.
1463
+ *
1464
+ * Please note: Only a tiny subset of XPath 1.0 is supported.
1465
+ * @param query an #XbQuery
1466
+ * @returns a #XbNode, or %NULL if unfound
1467
+ */
1468
+ query_first_full(query: Query): Node;
1469
+ /**
1470
+ * Searches the silo using an XPath query, returning up to one result.
1471
+ *
1472
+ * It is safe to call this function from a different thread to the one that
1473
+ * created the #XbSilo.
1474
+ *
1475
+ * Please note: Only a tiny subset of XPath 1.0 is supported.
1476
+ * @param query an #XbQuery
1477
+ * @param context 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
1478
+ * @returns a #XbNode, or %NULL if unfound
1479
+ */
1480
+ query_first_with_context(query: Query, context?: QueryContext | null): Node;
1481
+ /**
1482
+ * Searches the silo using an XPath query.
1483
+ *
1484
+ * It is safe to call this function from a different thread to the one that
1485
+ * created the #XbSilo.
1486
+ *
1487
+ * Please note: Only a subset of XPath is supported.
1488
+ * @param query an #XbQuery
1489
+ * @returns results, or %NULL if unfound
1490
+ */
1491
+ query_full(query: Query): Node[];
1492
+ /**
1493
+ * Searches the silo using an XPath query.
1494
+ *
1495
+ * It is safe to call this function from a different thread to the one that
1496
+ * created the #XbSilo.
1497
+ *
1498
+ * Please note: Only a subset of XPath is supported.
1499
+ * @param query an #XbQuery
1500
+ * @param context 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
1501
+ * @returns results, or %NULL if unfound
1502
+ */
1503
+ query_with_context(query: Query, context?: QueryContext | null): Node[];
1504
+ /**
1505
+ * Saves a silo to a file.
1506
+ * @param file a #GFile
1507
+ * @param cancellable a #GCancellable, or %NULL
1508
+ * @returns %TRUE for success, otherwise @error is set.
1509
+ */
1510
+ save_to_file(file: Gio.File, cancellable?: Gio.Cancellable | null): boolean;
1511
+ /**
1512
+ * Set #XbSilo:enable-node-cache.
1513
+ *
1514
+ * This is not thread-safe, and can only be called before the #XbSilo is passed
1515
+ * between threads.
1516
+ * @param enable_node_cache %TRUE to enable the node cache, %FALSE otherwise
1517
+ */
1518
+ set_enable_node_cache(enable_node_cache: boolean): void;
1519
+ /**
1520
+ * Enables or disables the collection of profiling data.
1521
+ * @param profile_flags some #XbSiloProfileFlags, e.g. %XB_SILO_PROFILE_FLAG_DEBUG
1522
+ */
1523
+ set_profile_flags(profile_flags: SiloProfileFlags): void;
1524
+ /**
1525
+ * Converts the silo to an internal string representation. This is only
1526
+ * really useful for debugging #XbSilo itself.
1527
+ * @returns A string, or %NULL for an error
1528
+ */
1529
+ to_string(): string;
1530
+ /**
1531
+ * Adds a file monitor to the silo. If the file or directory for `file` changes
1532
+ * then the silo will be invalidated.
1533
+ *
1534
+ * The monitor will internally use the #GMainContext which was the thread
1535
+ * default when the #XbSilo was created, so that #GMainContext must be iterated
1536
+ * for monitoring to work.
1537
+ * @param file a #GFile
1538
+ * @param cancellable a #GCancellable, or %NULL
1539
+ * @returns %TRUE for success, otherwise @error is set.
1540
+ */
1541
+ watch_file(file: Gio.File, cancellable?: Gio.Cancellable | null): boolean;
1542
+ }
1543
+
1544
+ type BuilderClass = typeof Builder;
1545
+ type BuilderFixupClass = typeof BuilderFixup;
1546
+ type BuilderNodeClass = typeof BuilderNode;
1547
+ type BuilderSourceClass = typeof BuilderSource;
1548
+ type BuilderSourceCtxClass = typeof BuilderSourceCtx;
1549
+ type MachineClass = typeof Machine;
1550
+ /**
1551
+ * A #XbNodeAttrIter structure represents an iterator that can be used
1552
+ * to iterate over the attributes of a #XbNode. #XbNodeAttrIter
1553
+ * structures are typically allocated on the stack and then initialized
1554
+ * with xb_node_attr_iter_init().
1555
+ *
1556
+ * The iteration order of a #XbNodeAttrIter is not defined.
1557
+ */
1558
+ class NodeAttrIter {
1559
+ static $gtype: GObject.GType<NodeAttrIter>;
1560
+
1561
+ // Constructors of Xmlb.NodeAttrIter
1562
+
1563
+ constructor(properties?: Partial<{}>);
1564
+ _init(...args: any[]): void;
1565
+
1566
+ // Own methods of Xmlb.NodeAttrIter
1567
+
1568
+ /**
1569
+ * Initializes a name/value pair iterator for the node attributes
1570
+ * and associates it with `self`.
1571
+ * The #XbNodeAttrIter structure is typically allocated on the stack
1572
+ * and does not need to be freed explicitly.
1573
+ * @param self a #XbNode
1574
+ */
1575
+ init(self: Node): void;
1576
+ /**
1577
+ * Returns the current attribute name and value and advances the iterator.
1578
+ * Example:
1579
+ *
1580
+ * ```c
1581
+ * XbNodeAttrIter iter;
1582
+ * const gchar *attr_name, *attr_value;
1583
+ *
1584
+ * xb_node_attr_iter_init (&iter, node);
1585
+ * while (xb_node_attr_iter_next (&iter, &attr_name, &attr_value)) {
1586
+ * // use attr_name and attr_value; no need to free them
1587
+ * }
1588
+ * ```
1589
+ *
1590
+ * @returns %TRUE if there are more attributes.
1591
+ */
1592
+ next(): [boolean, string, string];
1593
+ }
1594
+
1595
+ /**
1596
+ * A #XbNodeChildIter structure represents an iterator that can be used
1597
+ * to iterate over the children of a #XbNode. #XbNodeChildIter
1598
+ * structures are typically allocated on the stack and then initialized
1599
+ * with xb_node_child_iter_init().
1600
+ */
1601
+ class NodeChildIter {
1602
+ static $gtype: GObject.GType<NodeChildIter>;
1603
+
1604
+ // Constructors of Xmlb.NodeChildIter
1605
+
1606
+ constructor(properties?: Partial<{}>);
1607
+ _init(...args: any[]): void;
1608
+
1609
+ // Own methods of Xmlb.NodeChildIter
1610
+
1611
+ /**
1612
+ * Initializes a child iterator for the node's children and associates
1613
+ * it with `self`.
1614
+ * The #XbNodeChildIter structure is typically allocated on the stack
1615
+ * and does not need to be freed explicitly.
1616
+ * @param self a #XbNode
1617
+ */
1618
+ init(self: Node): void;
1619
+ /**
1620
+ * Returns the current child and advances the iterator.
1621
+ * The retrieved #XbNode child needs to be dereferenced with g_object_unref().
1622
+ * Example:
1623
+ *
1624
+ * ```c
1625
+ * XbNodeChildIter iter;
1626
+ * g_autoptr(XbNode) child = NULL;
1627
+ *
1628
+ * xb_node_child_iter_init (&iter, node);
1629
+ * while (xb_node_child_iter_next (&iter, &child)) {
1630
+ * // do something with the node child
1631
+ * g_clear_pointer (&child, g_object_unref);
1632
+ * }
1633
+ * ```
1634
+ *
1635
+ * @returns %FALSE if the last child has been reached.
1636
+ */
1637
+ next(): [boolean, Node | null];
1638
+ }
1639
+
1640
+ type NodeClass = typeof Node;
1641
+ abstract class Opcode {
1642
+ static $gtype: GObject.GType<Opcode>;
1643
+
1644
+ // Constructors of Xmlb.Opcode
1645
+
1646
+ _init(...args: any[]): void;
1647
+
1648
+ // Own static methods of Xmlb.Opcode
1649
+
1650
+ /**
1651
+ * Converts a string to an opcode kind.
1652
+ * @param str a string, e.g. `FUNC`
1653
+ */
1654
+ static kind_from_string(str: string): OpcodeKind;
1655
+ /**
1656
+ * Converts the opcode kind to a string.
1657
+ * @param kind a #XbOpcodeKind, e.g. %XB_OPCODE_KIND_FUNCTION
1658
+ */
1659
+ static kind_to_string(kind: OpcodeKind): string;
1660
+
1661
+ // Own methods of Xmlb.Opcode
1662
+
1663
+ /**
1664
+ * Checks if the opcode can be compared using the string value.
1665
+ * @returns #%TRUE if this opcode can be compared as an string
1666
+ */
1667
+ cmp_str(): boolean;
1668
+ /**
1669
+ * Checks if the opcode can be compared using the integer value.
1670
+ * @returns #%TRUE if this opcode can be compared as an integer
1671
+ */
1672
+ cmp_val(): boolean;
1673
+ /**
1674
+ * Initialises a stack allocated #XbOpcode to contain a specific function.
1675
+ * Custom functions can be registered using xb_machine_add_func() and retrieved
1676
+ * using xb_machine_opcode_func_new().
1677
+ * @param func a function index
1678
+ */
1679
+ func_init(func: number): void;
1680
+ /**
1681
+ * Gets the opcode kind.
1682
+ * @returns a #XbOpcodeKind, e.g. %XB_OPCODE_KIND_INTEGER
1683
+ */
1684
+ get_kind(): OpcodeKind;
1685
+ /**
1686
+ * Gets the string value stored on the opcode.
1687
+ * @returns a string, or %NULL if unset
1688
+ */
1689
+ get_str(): string;
1690
+ /**
1691
+ * Gets the integer value stored in the opcode. This may be a function ID,
1692
+ * a index into the string table or a literal integer.
1693
+ * @returns value, or 0 for unset.
1694
+ */
1695
+ get_val(): number;
1696
+ /**
1697
+ * Initialises a stack allocated #XbOpcode to contain an integer literal.
1698
+ * @param val a integer value
1699
+ */
1700
+ integer_init(val: number): void;
1701
+ /**
1702
+ * Initialises a stack allocated #XbOpcode to contain a text literal.
1703
+ * The `str` argument is copied internally and is not tied to the lifecycle of
1704
+ * the #XbOpcode.
1705
+ * @param str a string
1706
+ */
1707
+ text_init(str: string): void;
1708
+ /**
1709
+ * Initialises a stack allocated #XbOpcode to contain a text literal, where
1710
+ * `str` is either static text or will outlive the #XbOpcode lifecycle.
1711
+ * @param str a string
1712
+ */
1713
+ text_init_static(str: string): void;
1714
+ /**
1715
+ * Initialises a stack allocated #XbOpcode to contain a text literal, stealing
1716
+ * the `str`. Once the opcode is finalized g_free() will be called on `str`.
1717
+ * @param str a string
1718
+ */
1719
+ text_init_steal(str: string): void;
1720
+ /**
1721
+ * Returns a string representing the specific opcode.
1722
+ * @returns text
1723
+ */
1724
+ to_string(): string;
1725
+ }
1726
+
1727
+ type QueryClass = typeof Query;
1728
+ /**
1729
+ * An opaque struct which contains context for executing a query in, such as the
1730
+ * number of results to return, or values to bind to query placeholders.
1731
+ */
1732
+ class QueryContext {
1733
+ static $gtype: GObject.GType<QueryContext>;
1734
+
1735
+ // Constructors of Xmlb.QueryContext
1736
+
1737
+ constructor(properties?: Partial<{}>);
1738
+ _init(...args: any[]): void;
1739
+
1740
+ // Own methods of Xmlb.QueryContext
1741
+
1742
+ /**
1743
+ * Clear an #XbQueryContext, freeing any allocated memory it points to.
1744
+ *
1745
+ * After this function has been called, the contents of the #XbQueryContext are
1746
+ * undefined, and it’s only safe to call xb_query_context_init() on it.
1747
+ */
1748
+ clear(): void;
1749
+ /**
1750
+ * Copy `self` into a new heap-allocated #XbQueryContext instance.
1751
+ * @returns a copy of @self
1752
+ */
1753
+ copy(): QueryContext;
1754
+ /**
1755
+ * Free a heap-allocated #XbQueryContext instance. This should be used on
1756
+ * #XbQueryContext instances created with xb_query_context_copy().
1757
+ *
1758
+ * For stack-allocated instances, xb_query_context_clear() should be used
1759
+ * instead.
1760
+ */
1761
+ free(): void;
1762
+ /**
1763
+ * Get the #XbValueBindings for this query context.
1764
+ * @returns bindings
1765
+ */
1766
+ get_bindings(): ValueBindings;
1767
+ /**
1768
+ * Get the flags set on the context. See xb_query_context_set_flags().
1769
+ * @returns query flags
1770
+ */
1771
+ get_flags(): QueryFlags;
1772
+ /**
1773
+ * Get the limit on the number of query results. See
1774
+ * xb_query_context_set_limit().
1775
+ * @returns limit on results, or `0` if unlimited
1776
+ */
1777
+ get_limit(): number;
1778
+ /**
1779
+ * Initialise a stack-allocated #XbQueryContext struct so it can be used.
1780
+ *
1781
+ * Stack-allocated #XbQueryContext instances should be freed once finished
1782
+ * with, using xb_query_context_clear() (or `g_auto(XbQueryContext)`, which is
1783
+ * equivalent).
1784
+ */
1785
+ init(): void;
1786
+ /**
1787
+ * Set flags which affect the behaviour of the query.
1788
+ * @param flags query flags, or %XB_QUERY_FLAG_NONE for none
1789
+ */
1790
+ set_flags(flags: QueryFlags): void;
1791
+ /**
1792
+ * Set the limit on the number of results to return from the query.
1793
+ * @param limit number of query results to return, or `0` for unlimited
1794
+ */
1795
+ set_limit(limit: number): void;
1796
+ }
1797
+
1798
+ type SiloClass = typeof Silo;
1799
+ abstract class Stack {
1800
+ static $gtype: GObject.GType<Stack>;
1801
+
1802
+ // Constructors of Xmlb.Stack
1803
+
1804
+ _init(...args: any[]): void;
1805
+
1806
+ // Own methods of Xmlb.Stack
1807
+
1808
+ /**
1809
+ * Pops an opcode off the stack.
1810
+ * @returns %TRUE if popping succeeded, %FALSE if the stack was empty already
1811
+ */
1812
+ pop(): [boolean, Opcode | null];
1813
+ /**
1814
+ * Pushes a new empty opcode onto the end of the stack. A pointer to the opcode
1815
+ * is returned in `opcode_out` so that the caller can initialise it. This must be
1816
+ * done before the stack is next used as, for performance reasons, the newly
1817
+ * pushed opcode is not zero-initialised.
1818
+ * @returns %TRUE if a new empty opcode was returned, or %FALSE if the stack has reached its maximum size
1819
+ */
1820
+ push(): [boolean, Opcode | null];
1821
+ /**
1822
+ * Returns a string representing a stack.
1823
+ * @returns text
1824
+ */
1825
+ to_string(): string;
1826
+ }
1827
+
1828
+ /**
1829
+ * An opaque struct which contains values bound to a query.
1830
+ */
1831
+ class ValueBindings {
1832
+ static $gtype: GObject.GType<ValueBindings>;
1833
+
1834
+ // Constructors of Xmlb.ValueBindings
1835
+
1836
+ constructor(properties?: Partial<{}>);
1837
+ _init(...args: any[]): void;
1838
+
1839
+ // Own methods of Xmlb.ValueBindings
1840
+
1841
+ /**
1842
+ * Bind `str` to `idx` in the value bindings.
1843
+ *
1844
+ * This will overwrite any previous binding at `idx`. It will take ownership of
1845
+ * `str,` and an appropriate `destroy_func` must be provided to free `str` once the
1846
+ * binding is no longer needed. `destroy_func` will be called exactly once at
1847
+ * some point before the #XbValueBindings is cleared or freed.
1848
+ * @param idx 0-based index to bind to
1849
+ * @param str a string to bind to @idx
1850
+ * @param destroy_func function to free @str
1851
+ */
1852
+ bind_str(idx: number, str: string, destroy_func?: GLib.DestroyNotify | null): void;
1853
+ /**
1854
+ * Bind `val` to `idx` in the value bindings.
1855
+ *
1856
+ * This will overwrite any previous binding at `idx`.
1857
+ * @param idx 0-based index to bind to
1858
+ * @param val an integer to bind to @idx
1859
+ */
1860
+ bind_val(idx: number, val: number): void;
1861
+ /**
1862
+ * Clear an #XbValueBindings, freeing any allocated memory it points to.
1863
+ *
1864
+ * After this function has been called, the contents of the #XbValueBindings are
1865
+ * undefined, and it’s only safe to call xb_value_bindings_init() on it.
1866
+ */
1867
+ clear(): void;
1868
+ /**
1869
+ * Copy `self` into a new heap-allocated #XbValueBindings instance.
1870
+ * @returns a copy of @self
1871
+ */
1872
+ copy(): ValueBindings;
1873
+ /**
1874
+ * Copies the value bound at `idx` on `self` to `dest_idx` on `dest`. If no value is
1875
+ * bound at `idx,` `dest` is not modified and %FALSE is returned.
1876
+ *
1877
+ * `dest` must be initialised. If a binding already exists at `dest_idx,` it will
1878
+ * be overwritten.
1879
+ * @param idx 0-based index to look up the binding from in @self
1880
+ * @param dest an #XbValueBindings to copy to
1881
+ * @param dest_idx 0-based index to copy the binding to in @dest
1882
+ * @returns %TRUE if @idx was bound, %FALSE otherwise
1883
+ */
1884
+ copy_binding(idx: number, dest: ValueBindings, dest_idx: number): boolean;
1885
+ /**
1886
+ * Free a heap-allocated #XbValueBindings instance. This should be used on
1887
+ * #XbValueBindings instances created with xb_value_bindings_copy().
1888
+ *
1889
+ * For stack-allocated instances, xb_value_bindings_clear() should be used
1890
+ * instead.
1891
+ */
1892
+ free(): void;
1893
+ /**
1894
+ * Initialise a stack-allocated #XbValueBindings struct so it can be used.
1895
+ *
1896
+ * Stack-allocated #XbValueBindings instances should be freed once finished
1897
+ * with, using xb_value_bindings_clear() (or `g_auto(XbValueBindings)`, which is
1898
+ * equivalent).
1899
+ */
1900
+ init(): void;
1901
+ /**
1902
+ * Check whether a value has been bound to the given index using (for example)
1903
+ * xb_value_bindings_bind_str().
1904
+ * @param idx 0-based index of the binding to check
1905
+ * @returns %TRUE if a value is bound to @idx, %FALSE otherwise
1906
+ */
1907
+ is_bound(idx: number): boolean;
1908
+ /**
1909
+ * Initialises an #XbOpcode with the value bound to `idx,` if a value is bound.
1910
+ * If no value is bound, `opcode_out` is not touched and %FALSE is returned.
1911
+ *
1912
+ * `opcode_out` is initialised to point to the data inside the #XbValueBindings,
1913
+ * so must have a shorter lifetime than the #XbValueBindings. It will be of kind
1914
+ * %XB_OPCODE_KIND_BOUND_TEXT or %XB_OPCODE_KIND_BOUND_INTEGER.
1915
+ * @param idx 0-based index to look up the binding from
1916
+ * @returns %TRUE if @idx was bound, %FALSE otherwise
1917
+ */
1918
+ lookup_opcode(idx: number): [boolean, Opcode];
1919
+ }
1920
+
1921
+ /**
1922
+ * Name of the imported GIR library
1923
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
1924
+ */
1925
+ const __name__: string;
1926
+ /**
1927
+ * Version of the imported GIR library
1928
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
1929
+ */
1930
+ const __version__: string;
1931
+ }
1932
+
1933
+ export default Xmlb;
1934
+ // END