This file is indexed.

/usr/include/d/gtkd-3/glib/VariantBuilder.d is in libgtkd-3-dev 3.7.5-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module glib.VariantBuilder;

private import glib.ConstructionException;
private import glib.Str;
private import glib.Variant;
private import glib.VariantType;
private import glib.c.functions;
public  import glib.c.types;
public  import gtkc.glibtypes;
private import gtkd.Loader;


/**
 * A utility type for constructing container-type #GVariant instances.
 * 
 * This is an opaque structure and may only be accessed using the
 * following functions.
 * 
 * #GVariantBuilder is not threadsafe in any way.  Do not attempt to
 * access it from more than one thread.
 */
public class VariantBuilder
{
	/** the main Gtk struct */
	protected GVariantBuilder* gVariantBuilder;
	protected bool ownedRef;

	/** Get the main Gtk struct */
	public GVariantBuilder* getVariantBuilderStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gVariantBuilder;
	}

	/** the main Gtk struct as a void* */
	protected void* getStruct()
	{
		return cast(void*)gVariantBuilder;
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GVariantBuilder* gVariantBuilder, bool ownedRef = false)
	{
		this.gVariantBuilder = gVariantBuilder;
		this.ownedRef = ownedRef;
	}

	~this ()
	{
		if ( Linker.isLoaded(LIBRARY_GLIB) && ownedRef )
			g_variant_builder_unref(gVariantBuilder);
	}


	/**
	 * Allocates and initialises a new #GVariantBuilder.
	 *
	 * You should call g_variant_builder_unref() on the return value when it
	 * is no longer needed.  The memory will not be automatically freed by
	 * any other call.
	 *
	 * In most cases it is easier to place a #GVariantBuilder directly on
	 * the stack of the calling function and initialise it with
	 * g_variant_builder_init().
	 *
	 * Params:
	 *     type = a container type
	 *
	 * Returns: a #GVariantBuilder
	 *
	 * Since: 2.24
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(VariantType type)
	{
		auto p = g_variant_builder_new((type is null) ? null : type.getVariantTypeStruct());

		if(p is null)
		{
			throw new ConstructionException("null returned by new");
		}

		this(cast(GVariantBuilder*) p);
	}

	/**
	 * Adds @value to @builder.
	 *
	 * It is an error to call this function in any way that would create an
	 * inconsistent value to be constructed.  Some examples of this are
	 * putting different types of items into an array, putting the wrong
	 * types or number of items in a tuple, putting more than one value into
	 * a variant, etc.
	 *
	 * If @value is a floating reference (see g_variant_ref_sink()),
	 * the @builder instance takes ownership of @value.
	 *
	 * Params:
	 *     value = a #GVariant
	 *
	 * Since: 2.24
	 */
	public void addValue(Variant value)
	{
		g_variant_builder_add_value(gVariantBuilder, (value is null) ? null : value.getVariantStruct());
	}

	/**
	 * Releases all memory associated with a #GVariantBuilder without
	 * freeing the #GVariantBuilder structure itself.
	 *
	 * It typically only makes sense to do this on a stack-allocated
	 * #GVariantBuilder if you want to abort building the value part-way
	 * through.  This function need not be called if you call
	 * g_variant_builder_end() and it also doesn't need to be called on
	 * builders allocated with g_variant_builder_new() (see
	 * g_variant_builder_unref() for that).
	 *
	 * This function leaves the #GVariantBuilder structure set to all-zeros.
	 * It is valid to call this function on either an initialised
	 * #GVariantBuilder or one that is set to all-zeros but it is not valid
	 * to call this function on uninitialised memory.
	 *
	 * Since: 2.24
	 */
	public void clear()
	{
		g_variant_builder_clear(gVariantBuilder);
	}

	/**
	 * Closes the subcontainer inside the given @builder that was opened by
	 * the most recent call to g_variant_builder_open().
	 *
	 * It is an error to call this function in any way that would create an
	 * inconsistent value to be constructed (ie: too few values added to the
	 * subcontainer).
	 *
	 * Since: 2.24
	 */
	public void close()
	{
		g_variant_builder_close(gVariantBuilder);
	}

	/**
	 * Ends the builder process and returns the constructed value.
	 *
	 * It is not permissible to use @builder in any way after this call
	 * except for reference counting operations (in the case of a
	 * heap-allocated #GVariantBuilder) or by reinitialising it with
	 * g_variant_builder_init() (in the case of stack-allocated). This
	 * means that for the stack-allocated builders there is no need to
	 * call g_variant_builder_clear() after the call to
	 * g_variant_builder_end().
	 *
	 * It is an error to call this function in any way that would create an
	 * inconsistent value to be constructed (ie: insufficient number of
	 * items added to a container with a specific number of children
	 * required).  It is also an error to call this function if the builder
	 * was created with an indefinite array or maybe type and no children
	 * have been added; in this case it is impossible to infer the type of
	 * the empty array.
	 *
	 * Returns: a new, floating, #GVariant
	 *
	 * Since: 2.24
	 */
	public Variant end()
	{
		auto p = g_variant_builder_end(gVariantBuilder);

		if(p is null)
		{
			return null;
		}

		return new Variant(cast(GVariant*) p);
	}

	/**
	 * Initialises a #GVariantBuilder structure.
	 *
	 * @type must be non-%NULL.  It specifies the type of container to
	 * construct.  It can be an indefinite type such as
	 * %G_VARIANT_TYPE_ARRAY or a definite type such as "as" or "(ii)".
	 * Maybe, array, tuple, dictionary entry and variant-typed values may be
	 * constructed.
	 *
	 * After the builder is initialised, values are added using
	 * g_variant_builder_add_value() or g_variant_builder_add().
	 *
	 * After all the child values are added, g_variant_builder_end() frees
	 * the memory associated with the builder and returns the #GVariant that
	 * was created.
	 *
	 * This function completely ignores the previous contents of @builder.
	 * On one hand this means that it is valid to pass in completely
	 * uninitialised memory.  On the other hand, this means that if you are
	 * initialising over top of an existing #GVariantBuilder you need to
	 * first call g_variant_builder_clear() in order to avoid leaking
	 * memory.
	 *
	 * You must not call g_variant_builder_ref() or
	 * g_variant_builder_unref() on a #GVariantBuilder that was initialised
	 * with this function.  If you ever pass a reference to a
	 * #GVariantBuilder outside of the control of your own code then you
	 * should assume that the person receiving that reference may try to use
	 * reference counting; you should use g_variant_builder_new() instead of
	 * this function.
	 *
	 * Params:
	 *     type = a container type
	 *
	 * Since: 2.24
	 */
	public void init(VariantType type)
	{
		g_variant_builder_init(gVariantBuilder, (type is null) ? null : type.getVariantTypeStruct());
	}

	/**
	 * Opens a subcontainer inside the given @builder.  When done adding
	 * items to the subcontainer, g_variant_builder_close() must be called. @type
	 * is the type of the container: so to build a tuple of several values, @type
	 * must include the tuple itself.
	 *
	 * It is an error to call this function in any way that would cause an
	 * inconsistent value to be constructed (ie: adding too many values or
	 * a value of an incorrect type).
	 *
	 * Example of building a nested variant:
	 * |[<!-- language="C" -->
	 * GVariantBuilder builder;
	 * guint32 some_number = get_number ();
	 * g_autoptr (GHashTable) some_dict = get_dict ();
	 * GHashTableIter iter;
	 * const gchar *key;
	 * const GVariant *value;
	 * g_autoptr (GVariant) output = NULL;
	 *
	 * g_variant_builder_init (&builder, G_VARIANT_TYPE ("(ua{sv})"));
	 * g_variant_builder_add (&builder, "u", some_number);
	 * g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));
	 *
	 * g_hash_table_iter_init (&iter, some_dict);
	 * while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value))
	 * {
	 * g_variant_builder_open (&builder, G_VARIANT_TYPE ("{sv}"));
	 * g_variant_builder_add (&builder, "s", key);
	 * g_variant_builder_add (&builder, "v", value);
	 * g_variant_builder_close (&builder);
	 * }
	 *
	 * g_variant_builder_close (&builder);
	 *
	 * output = g_variant_builder_end (&builder);
	 * ]|
	 *
	 * Params:
	 *     type = the #GVariantType of the container
	 *
	 * Since: 2.24
	 */
	public void open(VariantType type)
	{
		g_variant_builder_open(gVariantBuilder, (type is null) ? null : type.getVariantTypeStruct());
	}

	/**
	 * Increases the reference count on @builder.
	 *
	 * Don't call this on stack-allocated #GVariantBuilder instances or bad
	 * things will happen.
	 *
	 * Returns: a new reference to @builder
	 *
	 * Since: 2.24
	 */
	public VariantBuilder doref()
	{
		auto p = g_variant_builder_ref(gVariantBuilder);

		if(p is null)
		{
			return null;
		}

		return new VariantBuilder(cast(GVariantBuilder*) p, true);
	}

	/**
	 * Decreases the reference count on @builder.
	 *
	 * In the event that there are no more references, releases all memory
	 * associated with the #GVariantBuilder.
	 *
	 * Don't call this on stack-allocated #GVariantBuilder instances or bad
	 * things will happen.
	 *
	 * Since: 2.24
	 */
	public void unref()
	{
		g_variant_builder_unref(gVariantBuilder);
	}
}