1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gstreamer-GstStructure.html
27  * outPack = gstreamer
28  * outFile = Structure
29  * strct   = GstStructure
30  * realStrct=
31  * ctorStrct=
32  * clss    = Structure
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_structure_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * 	- gst_structure_new_from_string
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.Date
49  * 	- gobject.Value
50  * 	- gstreamer.DateTime
51  * structWrap:
52  * 	- GDate* -> Date
53  * 	- GValue* -> Value
54  * 	- GstDateTime* -> DateTime
55  * 	- GstStructure* -> Structure
56  * module aliases:
57  * local aliases:
58  * overrides:
59  * 	- toString
60  */
61 
62 module gstreamer.Structure;
63 
64 public  import gstreamerc.gstreamertypes;
65 
66 private import gstreamerc.gstreamer;
67 private import glib.ConstructionException;
68 private import gobject.ObjectG;
69 
70 private import glib.Str;
71 private import glib.Date;
72 private import gobject.Value;
73 private import gstreamer.DateTime;
74 
75 
76 
77 /**
78  * A GstStructure is a collection of key/value pairs. The keys are expressed
79  * as GQuarks and the values can be of any GType.
80  *
81  * In addition to the key/value pairs, a GstStructure also has a name. The name
82  * starts with a letter and can be filled by letters, numbers and any of "/-_.:".
83  *
84  * GstStructure is used by various GStreamer subsystems to store information
85  * in a flexible and extensible way. A GstStructure does not have a refcount
86  * because it usually is part of a higher level object such as GstCaps,
87  * GstMessage, GstEvent, GstQuery. It provides a means to enforce mutability
88  * using the refcount of the parent with the gst_structure_set_parent_refcount()
89  * method.
90  *
91  * A GstStructure can be created with gst_structure_new_empty() or
92  * gst_structure_new(), which both take a name and an optional set of
93  * key/value pairs along with the types of the values.
94  *
95  * Field values can be changed with gst_structure_set_value() or
96  * gst_structure_set().
97  *
98  * Field values can be retrieved with gst_structure_get_value() or the more
99  * convenient gst_structure_get_*() functions.
100  *
101  * Fields can be removed with gst_structure_remove_field() or
102  * gst_structure_remove_fields().
103  *
104  * Strings in structures must be ASCII or UTF-8 encoded. Other encodings are
105  * not allowed. Strings must not be empty either, but may be NULL.
106  *
107  * Last reviewed on 2012-03-29 (0.11.3)
108  */
109 public class Structure
110 {
111 	
112 	/** the main Gtk struct */
113 	protected GstStructure* gstStructure;
114 	
115 	
116 	/** Get the main Gtk struct */
117 	public GstStructure* getStructureStruct()
118 	{
119 		return gstStructure;
120 	}
121 	
122 	
123 	/** the main Gtk struct as a void* */
124 	protected void* getStruct()
125 	{
126 		return cast(void*)gstStructure;
127 	}
128 	
129 	/**
130 	 * Sets our main struct and passes it to the parent class
131 	 */
132 	public this (GstStructure* gstStructure)
133 	{
134 		this.gstStructure = gstStructure;
135 	}
136 	
137 	public static Structure fromString(string name)
138 	{
139 		// GstStructure* gst_structure_new_from_string(const gchar *string);
140 		auto p = gst_structure_new_from_string(Str.toStringz(name));
141 		if(p is null)
142 		{
143 			throw new ConstructionException("null returned by gst_structure_new_from_string(Str.toStringz(name))");
144 		}
145 		return new Structure(cast(GstStructure*) p);
146 	}
147 	
148 	/**
149 	 */
150 	
151 	/**
152 	 * Creates a new, empty GstStructure with the given name.
153 	 * See gst_structure_set_name() for constraints on the name parameter.
154 	 * Free-function: gst_structure_free
155 	 * Params:
156 	 * name = name of new structure
157 	 * Throws: ConstructionException GTK+ fails to create the object.
158 	 */
159 	public this (string name)
160 	{
161 		// GstStructure * gst_structure_new_empty (const gchar *name);
162 		auto p = gst_structure_new_empty(Str.toStringz(name));
163 		if(p is null)
164 		{
165 			throw new ConstructionException("null returned by gst_structure_new_empty(Str.toStringz(name))");
166 		}
167 		this(cast(GstStructure*) p);
168 	}
169 	
170 	/**
171 	 * Creates a new, empty GstStructure with the given name as a GQuark.
172 	 * Free-function: gst_structure_free
173 	 * Params:
174 	 * quark = name of new structure
175 	 * Throws: ConstructionException GTK+ fails to create the object.
176 	 */
177 	public this (GQuark quark)
178 	{
179 		// GstStructure * gst_structure_new_id_empty (GQuark quark);
180 		auto p = gst_structure_new_id_empty(quark);
181 		if(p is null)
182 		{
183 			throw new ConstructionException("null returned by gst_structure_new_id_empty(quark)");
184 		}
185 		this(cast(GstStructure*) p);
186 	}
187 	
188 	/**
189 	 * Creates a new GstStructure with the given name. Structure fields
190 	 * are set according to the varargs in a manner similar to
191 	 * gst_structure_new().
192 	 * See gst_structure_set_name() for constraints on the name parameter.
193 	 * Free-function: gst_structure_free
194 	 * Params:
195 	 * name = name of new structure
196 	 * firstfield = name of first field to set
197 	 * varargs = variable argument list
198 	 * Throws: ConstructionException GTK+ fails to create the object.
199 	 */
200 	public this (string name, string firstfield, void* varargs)
201 	{
202 		// GstStructure * gst_structure_new_valist (const gchar *name,  const gchar *firstfield,  va_list varargs);
203 		auto p = gst_structure_new_valist(Str.toStringz(name), Str.toStringz(firstfield), varargs);
204 		if(p is null)
205 		{
206 			throw new ConstructionException("null returned by gst_structure_new_valist(Str.toStringz(name), Str.toStringz(firstfield), varargs)");
207 		}
208 		this(cast(GstStructure*) p);
209 	}
210 	
211 	/**
212 	 * Duplicates a GstStructure and all its fields and values.
213 	 * Free-function: gst_structure_free
214 	 * Returns: a new GstStructure. [transfer full]
215 	 */
216 	public Structure copy()
217 	{
218 		// GstStructure * gst_structure_copy (const GstStructure *structure);
219 		auto p = gst_structure_copy(gstStructure);
220 		
221 		if(p is null)
222 		{
223 			return null;
224 		}
225 		
226 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
227 	}
228 	
229 	/**
230 	 * Frees a GstStructure and all its fields and values. The structure must not
231 	 * have a parent when this function is called.
232 	 */
233 	public void free()
234 	{
235 		// void gst_structure_free (GstStructure *structure);
236 		gst_structure_free(gstStructure);
237 	}
238 	
239 	/**
240 	 * Get the name of structure as a string.
241 	 * Returns: the name of the structure.
242 	 */
243 	public string getName()
244 	{
245 		// const gchar * gst_structure_get_name (const GstStructure *structure);
246 		return Str.toString(gst_structure_get_name(gstStructure));
247 	}
248 	
249 	/**
250 	 * Checks if the structure has the given name
251 	 * Params:
252 	 * name = structure name to check for
253 	 * Returns: TRUE if name matches the name of the structure.
254 	 */
255 	public int hasName(string name)
256 	{
257 		// gboolean gst_structure_has_name (const GstStructure *structure,  const gchar *name);
258 		return gst_structure_has_name(gstStructure, Str.toStringz(name));
259 	}
260 	
261 	/**
262 	 * Sets the name of the structure to the given name. The string
263 	 * provided is copied before being used. It must not be empty, start with a
264 	 * letter and can be followed by letters, numbers and any of "/-_.:".
265 	 * Params:
266 	 * name = the new name of the structure
267 	 */
268 	public void setName(string name)
269 	{
270 		// void gst_structure_set_name (GstStructure *structure,  const gchar *name);
271 		gst_structure_set_name(gstStructure, Str.toStringz(name));
272 	}
273 	
274 	/**
275 	 * Get the name of structure as a GQuark.
276 	 * Returns: the quark representing the name of the structure.
277 	 */
278 	public GQuark getNameId()
279 	{
280 		// GQuark gst_structure_get_name_id (const GstStructure *structure);
281 		return gst_structure_get_name_id(gstStructure);
282 	}
283 	
284 	/**
285 	 * Parses the variable arguments and reads fields from structure accordingly.
286 	 * valist-variant of gst_structure_id_get(). Look at the documentation of
287 	 * gst_structure_id_get() for more details.
288 	 * Params:
289 	 * firstFieldId = the quark of the first field to read
290 	 * args = variable arguments
291 	 * Returns: TRUE, or FALSE if there was a problem reading any of the fields
292 	 */
293 	public int idGetValist(GQuark firstFieldId, void* args)
294 	{
295 		// gboolean gst_structure_id_get_valist (const GstStructure *structure,  GQuark first_field_id,  va_list args);
296 		return gst_structure_id_get_valist(gstStructure, firstFieldId, args);
297 	}
298 	
299 	/**
300 	 * Get the value of the field with GQuark field.
301 	 * Params:
302 	 * field = the GQuark of the field to get
303 	 * Returns: the GValue corresponding to the field with the given name identifier.
304 	 */
305 	public Value idGetValue(GQuark field)
306 	{
307 		// const GValue * gst_structure_id_get_value (const GstStructure *structure,  GQuark field);
308 		auto p = gst_structure_id_get_value(gstStructure, field);
309 		
310 		if(p is null)
311 		{
312 			return null;
313 		}
314 		
315 		return ObjectG.getDObject!(Value)(cast(GValue*) p);
316 	}
317 	
318 	/**
319 	 * Sets the field with the given GQuark field to value. If the field
320 	 * does not exist, it is created. If the field exists, the previous
321 	 * value is replaced and freed.
322 	 * Params:
323 	 * field = a GQuark representing a field
324 	 * value = the new value of the field
325 	 */
326 	public void idSetValue(GQuark field, Value value)
327 	{
328 		// void gst_structure_id_set_value (GstStructure *structure,  GQuark field,  const GValue *value);
329 		gst_structure_id_set_value(gstStructure, field, (value is null) ? null : value.getValueStruct());
330 	}
331 	
332 	/**
333 	 * Sets the field with the given GQuark field to value. If the field
334 	 * does not exist, it is created. If the field exists, the previous
335 	 * value is replaced and freed.
336 	 * Params:
337 	 * field = a GQuark representing a field
338 	 * value = the new value of the field. [transfer full]
339 	 */
340 	public void idTakeValue(GQuark field, Value value)
341 	{
342 		// void gst_structure_id_take_value (GstStructure *structure,  GQuark field,  GValue *value);
343 		gst_structure_id_take_value(gstStructure, field, (value is null) ? null : value.getValueStruct());
344 	}
345 	
346 	/**
347 	 * Parses the variable arguments and reads fields from structure accordingly.
348 	 * valist-variant of gst_structure_get(). Look at the documentation of
349 	 * gst_structure_get() for more details.
350 	 * Params:
351 	 * firstFieldname = the name of the first field to read
352 	 * args = variable arguments
353 	 * Returns: TRUE, or FALSE if there was a problem reading any of the fields
354 	 */
355 	public int getValist(string firstFieldname, void* args)
356 	{
357 		// gboolean gst_structure_get_valist (const GstStructure *structure,  const char *first_fieldname,  va_list args);
358 		return gst_structure_get_valist(gstStructure, Str.toStringz(firstFieldname), args);
359 	}
360 	
361 	/**
362 	 * Get the value of the field with name fieldname.
363 	 * Params:
364 	 * fieldname = the name of the field to get
365 	 * Returns: the GValue corresponding to the field with the given name.
366 	 */
367 	public Value getValue(string fieldname)
368 	{
369 		// const GValue * gst_structure_get_value (const GstStructure *structure,  const gchar *fieldname);
370 		auto p = gst_structure_get_value(gstStructure, Str.toStringz(fieldname));
371 		
372 		if(p is null)
373 		{
374 			return null;
375 		}
376 		
377 		return ObjectG.getDObject!(Value)(cast(GValue*) p);
378 	}
379 	
380 	/**
381 	 * Sets the field with the given name field to value. If the field
382 	 * does not exist, it is created. If the field exists, the previous
383 	 * value is replaced and freed.
384 	 * Params:
385 	 * fieldname = the name of the field to set
386 	 * value = the new value of the field
387 	 */
388 	public void setValue(string fieldname, Value value)
389 	{
390 		// void gst_structure_set_value (GstStructure *structure,  const gchar *fieldname,  const GValue *value);
391 		gst_structure_set_value(gstStructure, Str.toStringz(fieldname), (value is null) ? null : value.getValueStruct());
392 	}
393 	
394 	/**
395 	 * Sets the field with the given name field to value. If the field
396 	 * does not exist, it is created. If the field exists, the previous
397 	 * value is replaced and freed. The function will take ownership of value.
398 	 * Params:
399 	 * fieldname = the name of the field to set
400 	 * value = the new value of the field. [transfer full]
401 	 */
402 	public void takeValue(string fieldname, Value value)
403 	{
404 		// void gst_structure_take_value (GstStructure *structure,  const gchar *fieldname,  GValue *value);
405 		gst_structure_take_value(gstStructure, Str.toStringz(fieldname), (value is null) ? null : value.getValueStruct());
406 	}
407 	
408 	/**
409 	 * va_list form of gst_structure_set().
410 	 * Params:
411 	 * fieldname = the name of the field to set
412 	 * varargs = variable arguments
413 	 */
414 	public void setValist(string fieldname, void* varargs)
415 	{
416 		// void gst_structure_set_valist (GstStructure *structure,  const gchar *fieldname,  va_list varargs);
417 		gst_structure_set_valist(gstStructure, Str.toStringz(fieldname), varargs);
418 	}
419 	
420 	/**
421 	 * va_list form of gst_structure_id_set().
422 	 * Params:
423 	 * fieldname = the name of the field to set
424 	 * varargs = variable arguments
425 	 */
426 	public void idSetValist(GQuark fieldname, void* varargs)
427 	{
428 		// void gst_structure_id_set_valist (GstStructure *structure,  GQuark fieldname,  va_list varargs);
429 		gst_structure_id_set_valist(gstStructure, fieldname, varargs);
430 	}
431 	
432 	/**
433 	 * Removes the field with the given name. If the field with the given
434 	 * name does not exist, the structure is unchanged.
435 	 * Params:
436 	 * fieldname = the name of the field to remove
437 	 */
438 	public void removeField(string fieldname)
439 	{
440 		// void gst_structure_remove_field (GstStructure *structure,  const gchar *fieldname);
441 		gst_structure_remove_field(gstStructure, Str.toStringz(fieldname));
442 	}
443 	
444 	/**
445 	 * va_list form of gst_structure_remove_fields().
446 	 * Params:
447 	 * fieldname = the name of the field to remove
448 	 * varargs = NULL-terminated list of more fieldnames to remove
449 	 */
450 	public void removeFieldsValist(string fieldname, void* varargs)
451 	{
452 		// void gst_structure_remove_fields_valist (GstStructure *structure,  const gchar *fieldname,  va_list varargs);
453 		gst_structure_remove_fields_valist(gstStructure, Str.toStringz(fieldname), varargs);
454 	}
455 	
456 	/**
457 	 * Removes all fields in a GstStructure.
458 	 */
459 	public void removeAllFields()
460 	{
461 		// void gst_structure_remove_all_fields (GstStructure *structure);
462 		gst_structure_remove_all_fields(gstStructure);
463 	}
464 	
465 	/**
466 	 * Finds the field with the given name, and returns the type of the
467 	 * value it contains. If the field is not found, G_TYPE_INVALID is
468 	 * returned.
469 	 * Params:
470 	 * fieldname = the name of the field
471 	 * Returns: the GValue of the field
472 	 */
473 	public GType getFieldType(string fieldname)
474 	{
475 		// GType gst_structure_get_field_type (const GstStructure *structure,  const gchar *fieldname);
476 		return gst_structure_get_field_type(gstStructure, Str.toStringz(fieldname));
477 	}
478 	
479 	/**
480 	 * Calls the provided function once for each field in the GstStructure. The
481 	 * function must not modify the fields. Also see gst_structure_map_in_place().
482 	 * Params:
483 	 * func = a function to call for each field. [scope call]
484 	 * userData = private data. [closure]
485 	 * Returns: TRUE if the supplied function returns TRUE For each of the fields, FALSE otherwise.
486 	 */
487 	public int foreac(GstStructureForeachFunc func, void* userData)
488 	{
489 		// gboolean gst_structure_foreach (const GstStructure *structure,  GstStructureForeachFunc func,  gpointer user_data);
490 		return gst_structure_foreach(gstStructure, func, userData);
491 	}
492 	
493 	/**
494 	 * Get the number of fields in the structure.
495 	 * Returns: the number of fields in the structure
496 	 */
497 	public int nFields()
498 	{
499 		// gint gst_structure_n_fields (const GstStructure *structure);
500 		return gst_structure_n_fields(gstStructure);
501 	}
502 	
503 	/**
504 	 * Check if structure contains a field named fieldname.
505 	 * Params:
506 	 * fieldname = the name of a field
507 	 * Returns: TRUE if the structure contains a field with the given name
508 	 */
509 	public int hasField(string fieldname)
510 	{
511 		// gboolean gst_structure_has_field (const GstStructure *structure,  const gchar *fieldname);
512 		return gst_structure_has_field(gstStructure, Str.toStringz(fieldname));
513 	}
514 	
515 	/**
516 	 * Check if structure contains a field named fieldname and with GType type.
517 	 * Params:
518 	 * fieldname = the name of a field
519 	 * type = the type of a value
520 	 * Returns: TRUE if the structure contains a field with the given name and type
521 	 */
522 	public int hasFieldTyped(string fieldname, GType type)
523 	{
524 		// gboolean gst_structure_has_field_typed (const GstStructure *structure,  const gchar *fieldname,  GType type);
525 		return gst_structure_has_field_typed(gstStructure, Str.toStringz(fieldname), type);
526 	}
527 	
528 	/**
529 	 * Tests if the two GstStructure are equal.
530 	 * Params:
531 	 * structure2 = a GstStructure.
532 	 * Returns: TRUE if the two structures have the same name and field.
533 	 */
534 	public int isEqual(Structure structure2)
535 	{
536 		// gboolean gst_structure_is_equal (const GstStructure *structure1,  const GstStructure *structure2);
537 		return gst_structure_is_equal(gstStructure, (structure2 is null) ? null : structure2.getStructureStruct());
538 	}
539 	
540 	/**
541 	 * Checks if subset is a subset of superset, i.e. has the same
542 	 * structure name and for all fields that are existing in superset,
543 	 * subset has a value that is a subset of the value in superset.
544 	 * Params:
545 	 * superset = a potentially greater GstStructure
546 	 * Returns: TRUE if subset is a subset of superset
547 	 */
548 	public int isSubset(Structure superset)
549 	{
550 		// gboolean gst_structure_is_subset (const GstStructure *subset,  const GstStructure *superset);
551 		return gst_structure_is_subset(gstStructure, (superset is null) ? null : superset.getStructureStruct());
552 	}
553 	
554 	/**
555 	 * Tries intersecting struct1 and struct2 and reports whether the result
556 	 * would not be empty.
557 	 * Params:
558 	 * struct2 = a GstStructure
559 	 * Returns: TRUE if intersection would not be empty
560 	 */
561 	public int canIntersect(Structure struct2)
562 	{
563 		// gboolean gst_structure_can_intersect (const GstStructure *struct1,  const GstStructure *struct2);
564 		return gst_structure_can_intersect(gstStructure, (struct2 is null) ? null : struct2.getStructureStruct());
565 	}
566 	
567 	/**
568 	 * Interesects struct1 and struct2 and returns the intersection.
569 	 * Params:
570 	 * struct2 = a GstStructure
571 	 * Returns: Intersection of struct1 and struct2
572 	 */
573 	public Structure intersect(Structure struct2)
574 	{
575 		// GstStructure * gst_structure_intersect (const GstStructure *struct1,  const GstStructure *struct2);
576 		auto p = gst_structure_intersect(gstStructure, (struct2 is null) ? null : struct2.getStructureStruct());
577 		
578 		if(p is null)
579 		{
580 			return null;
581 		}
582 		
583 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
584 	}
585 	
586 	/**
587 	 * Check if structure contains a field named field.
588 	 * Params:
589 	 * field = GQuark of the field name
590 	 * Returns: TRUE if the structure contains a field with the given name
591 	 */
592 	public int idHasField(GQuark field)
593 	{
594 		// gboolean gst_structure_id_has_field (const GstStructure *structure,  GQuark field);
595 		return gst_structure_id_has_field(gstStructure, field);
596 	}
597 	
598 	/**
599 	 * Check if structure contains a field named field and with GType type.
600 	 * Params:
601 	 * field = GQuark of the field name
602 	 * type = the type of a value
603 	 * Returns: TRUE if the structure contains a field with the given name and type
604 	 */
605 	public int idHasFieldTyped(GQuark field, GType type)
606 	{
607 		// gboolean gst_structure_id_has_field_typed (const GstStructure *structure,  GQuark field,  GType type);
608 		return gst_structure_id_has_field_typed(gstStructure, field, type);
609 	}
610 	
611 	/**
612 	 * Sets the boolean pointed to by value corresponding to the value of the
613 	 * given field. Caller is responsible for making sure the field exists
614 	 * and has the correct type.
615 	 * Params:
616 	 * fieldname = the name of a field
617 	 * value = a pointer to a gboolean to set. [out]
618 	 * Returns: TRUE if the value could be set correctly. If there was no field with fieldname or the existing field did not contain a boolean, this function returns FALSE.
619 	 */
620 	public int getBoolean(string fieldname, out int value)
621 	{
622 		// gboolean gst_structure_get_boolean (const GstStructure *structure,  const gchar *fieldname,  gboolean *value);
623 		return gst_structure_get_boolean(gstStructure, Str.toStringz(fieldname), &value);
624 	}
625 	
626 	/**
627 	 * Sets the int pointed to by value corresponding to the value of the
628 	 * given field. Caller is responsible for making sure the field exists
629 	 * and has the correct type.
630 	 * Params:
631 	 * fieldname = the name of a field
632 	 * value = a pointer to an int to set. [out]
633 	 * Returns: TRUE if the value could be set correctly. If there was no field with fieldname or the existing field did not contain an int, this function returns FALSE.
634 	 */
635 	public int getInt(string fieldname, out int value)
636 	{
637 		// gboolean gst_structure_get_int (const GstStructure *structure,  const gchar *fieldname,  gint *value);
638 		return gst_structure_get_int(gstStructure, Str.toStringz(fieldname), &value);
639 	}
640 	
641 	/**
642 	 * Sets the uint pointed to by value corresponding to the value of the
643 	 * given field. Caller is responsible for making sure the field exists
644 	 * and has the correct type.
645 	 * Params:
646 	 * fieldname = the name of a field
647 	 * value = a pointer to a uint to set. [out]
648 	 * Returns: TRUE if the value could be set correctly. If there was no field with fieldname or the existing field did not contain a uint, this function returns FALSE.
649 	 */
650 	public int getUint(string fieldname, out uint value)
651 	{
652 		// gboolean gst_structure_get_uint (const GstStructure *structure,  const gchar *fieldname,  guint *value);
653 		return gst_structure_get_uint(gstStructure, Str.toStringz(fieldname), &value);
654 	}
655 	
656 	/**
657 	 * Sets the double pointed to by value corresponding to the value of the
658 	 * given field. Caller is responsible for making sure the field exists
659 	 * and has the correct type.
660 	 * Params:
661 	 * fieldname = the name of a field
662 	 * value = a pointer to a gdouble to set. [out]
663 	 * Returns: TRUE if the value could be set correctly. If there was no field with fieldname or the existing field did not contain a double, this function returns FALSE.
664 	 */
665 	public int getDouble(string fieldname, out double value)
666 	{
667 		// gboolean gst_structure_get_double (const GstStructure *structure,  const gchar *fieldname,  gdouble *value);
668 		return gst_structure_get_double(gstStructure, Str.toStringz(fieldname), &value);
669 	}
670 	
671 	/**
672 	 * Finds the field corresponding to fieldname, and returns the string
673 	 * contained in the field's value. Caller is responsible for making
674 	 * sure the field exists and has the correct type.
675 	 * The string should not be modified, and remains valid until the next
676 	 * call to a gst_structure_*() function with the given structure.
677 	 * Params:
678 	 * fieldname = the name of a field
679 	 * Returns: a pointer to the string or NULL when the field did not exist or did not contain a string.
680 	 */
681 	public string getString(string fieldname)
682 	{
683 		// const gchar * gst_structure_get_string (const GstStructure *structure,  const gchar *fieldname);
684 		return Str.toString(gst_structure_get_string(gstStructure, Str.toStringz(fieldname)));
685 	}
686 	
687 	/**
688 	 * Sets the date pointed to by value corresponding to the date of the
689 	 * given field. Caller is responsible for making sure the field exists
690 	 * and has the correct type.
691 	 * On success value will point to a newly-allocated copy of the date which
692 	 * should be freed with g_date_free() when no longer needed (note: this is
693 	 * inconsistent with e.g. gst_structure_get_string() which doesn't return a
694 	 * copy of the string).
695 	 * Params:
696 	 * fieldname = the name of a field
697 	 * value = a pointer to a GDate to set. [out callee-allocates]
698 	 * Returns: TRUE if the value could be set correctly. If there was no field with fieldname or the existing field did not contain a data, this function returns FALSE.
699 	 */
700 	public int getDate(string fieldname, out Date value)
701 	{
702 		// gboolean gst_structure_get_date (const GstStructure *structure,  const gchar *fieldname,  GDate **value);
703 		GDate* outvalue = null;
704 		
705 		auto p = gst_structure_get_date(gstStructure, Str.toStringz(fieldname), &outvalue);
706 		
707 		value = ObjectG.getDObject!(Date)(outvalue);
708 		return p;
709 	}
710 	
711 	/**
712 	 * Sets the datetime pointed to by value corresponding to the datetime of the
713 	 * given field. Caller is responsible for making sure the field exists
714 	 * and has the correct type.
715 	 * On success value will point to a reference of the datetime which
716 	 * should be unreffed with gst_date_time_unref() when no longer needed
717 	 * (note: this is inconsistent with e.g. gst_structure_get_string()
718 	 * which doesn't return a copy of the string).
719 	 * Params:
720 	 * fieldname = the name of a field
721 	 * value = a pointer to a GstDateTime to set. [out callee-allocates]
722 	 * Returns: TRUE if the value could be set correctly. If there was no field with fieldname or the existing field did not contain a data, this function returns FALSE.
723 	 */
724 	public int getDateTime(string fieldname, out DateTime value)
725 	{
726 		// gboolean gst_structure_get_date_time (const GstStructure *structure,  const gchar *fieldname,  GstDateTime **value);
727 		GstDateTime* outvalue = null;
728 		
729 		auto p = gst_structure_get_date_time(gstStructure, Str.toStringz(fieldname), &outvalue);
730 		
731 		value = ObjectG.getDObject!(DateTime)(outvalue);
732 		return p;
733 	}
734 	
735 	/**
736 	 * Sets the clock time pointed to by value corresponding to the clock time
737 	 * of the given field. Caller is responsible for making sure the field exists
738 	 * and has the correct type.
739 	 * Params:
740 	 * fieldname = the name of a field
741 	 * value = a pointer to a GstClockTime to set. [out]
742 	 * Returns: TRUE if the value could be set correctly. If there was no field with fieldname or the existing field did not contain a GstClockTime, this function returns FALSE.
743 	 */
744 	public int getClockTime(string fieldname, out GstClockTime value)
745 	{
746 		// gboolean gst_structure_get_clock_time (const GstStructure *structure,  const gchar *fieldname,  GstClockTime *value);
747 		return gst_structure_get_clock_time(gstStructure, Str.toStringz(fieldname), &value);
748 	}
749 	
750 	/**
751 	 * Sets the int pointed to by value corresponding to the value of the
752 	 * given field. Caller is responsible for making sure the field exists,
753 	 * has the correct type and that the enumtype is correct.
754 	 * Params:
755 	 * fieldname = the name of a field
756 	 * enumtype = the enum type of a field
757 	 * value = a pointer to an int to set. [out]
758 	 * Returns: TRUE if the value could be set correctly. If there was no field with fieldname or the existing field did not contain an enum of the given type, this function returns FALSE.
759 	 */
760 	public int getEnum(string fieldname, GType enumtype, out int value)
761 	{
762 		// gboolean gst_structure_get_enum (const GstStructure *structure,  const gchar *fieldname,  GType enumtype,  gint *value);
763 		return gst_structure_get_enum(gstStructure, Str.toStringz(fieldname), enumtype, &value);
764 	}
765 	
766 	/**
767 	 * Sets the integers pointed to by value_numerator and value_denominator
768 	 * corresponding to the value of the given field. Caller is responsible
769 	 * for making sure the field exists and has the correct type.
770 	 * Params:
771 	 * fieldname = the name of a field
772 	 * valueNumerator = a pointer to an int to set. [out]
773 	 * valueDenominator = a pointer to an int to set. [out]
774 	 * Returns: TRUE if the values could be set correctly. If there was no field with fieldname or the existing field did not contain a GstFraction, this function returns FALSE.
775 	 */
776 	public int getFraction(string fieldname, out int valueNumerator, out int valueDenominator)
777 	{
778 		// gboolean gst_structure_get_fraction (const GstStructure *structure,  const gchar *fieldname,  gint *value_numerator,  gint *value_denominator);
779 		return gst_structure_get_fraction(gstStructure, Str.toStringz(fieldname), &valueNumerator, &valueDenominator);
780 	}
781 	
782 	/**
783 	 * Calls the provided function once for each field in the GstStructure. In
784 	 * contrast to gst_structure_foreach(), the function may modify but not delete the
785 	 * fields. The structure must be mutable.
786 	 * Params:
787 	 * func = a function to call for each field. [scope call]
788 	 * userData = private data. [closure]
789 	 * Returns: TRUE if the supplied function returns TRUE For each of the fields, FALSE otherwise.
790 	 */
791 	public int mapInPlace(GstStructureMapFunc func, void* userData)
792 	{
793 		// gboolean gst_structure_map_in_place (GstStructure *structure,  GstStructureMapFunc func,  gpointer user_data);
794 		return gst_structure_map_in_place(gstStructure, func, userData);
795 	}
796 	
797 	/**
798 	 * Get the name of the given field number, counting from 0 onwards.
799 	 * Params:
800 	 * index = the index to get the name of
801 	 * Returns: the name of the given field number
802 	 */
803 	public string nthFieldName(uint index)
804 	{
805 		// const gchar * gst_structure_nth_field_name (const GstStructure *structure,  guint index);
806 		return Str.toString(gst_structure_nth_field_name(gstStructure, index));
807 	}
808 	
809 	/**
810 	 * Sets the parent_refcount field of GstStructure. This field is used to
811 	 * determine whether a structure is mutable or not. This function should only be
812 	 * called by code implementing parent objects of GstStructure, as described in
813 	 * the MT Refcounting section of the design documents.
814 	 * Params:
815 	 * refcount = a pointer to the parent's refcount. [in]
816 	 * Returns: TRUE if the parent refcount could be set.
817 	 */
818 	public int setParentRefcount(int* refcount)
819 	{
820 		// gboolean gst_structure_set_parent_refcount (GstStructure *structure,  gint *refcount);
821 		return gst_structure_set_parent_refcount(gstStructure, refcount);
822 	}
823 	
824 	/**
825 	 * Converts structure to a human-readable string representation.
826 	 * Returns: a pointer to string allocated by g_malloc(). g_free() after usage. [transfer full]
827 	 */
828 	public override string toString()
829 	{
830 		// gchar * gst_structure_to_string (const GstStructure *structure);
831 		return Str.toString(gst_structure_to_string(gstStructure));
832 	}
833 	
834 	/**
835 	 * Creates a GstStructure from a string representation.
836 	 * If end is not NULL, a pointer to the place inside the given string
837 	 * where parsing ended will be returned.
838 	 * Free-function: gst_structure_free
839 	 * Params:
840 	 * string = a string representation of a GstStructure.
841 	 * end = pointer to store the end of the string in. [out][allow-none][transfer none][skip]
842 	 * Returns: a new GstStructure or NULL when the string could not be parsed. Free with gst_structure_free() after use. [transfer full]
843 	 */
844 	public static Structure fromString(string string, out string end)
845 	{
846 		// GstStructure * gst_structure_from_string (const gchar *string,  gchar **end);
847 		char* outend = null;
848 		
849 		auto p = gst_structure_from_string(Str.toStringz(string), &outend);
850 		
851 		end = Str.toString(outend);
852 		
853 		if(p is null)
854 		{
855 			return null;
856 		}
857 		
858 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
859 	}
860 	
861 	/**
862 	 * Fixate all values in structure using gst_value_fixate().
863 	 * structure will be modified in-place and should be writable.
864 	 */
865 	public void fixate()
866 	{
867 		// void gst_structure_fixate (GstStructure *structure);
868 		gst_structure_fixate(gstStructure);
869 	}
870 	
871 	/**
872 	 * Fixates a GstStructure by changing the given field with its fixated value.
873 	 * Params:
874 	 * fieldName = a field in structure
875 	 * Returns: TRUE if the structure field could be fixated
876 	 */
877 	public int fixateField(string fieldName)
878 	{
879 		// gboolean gst_structure_fixate_field (GstStructure *structure,  const char *field_name);
880 		return gst_structure_fixate_field(gstStructure, Str.toStringz(fieldName));
881 	}
882 	
883 	/**
884 	 * Fixates a GstStructure by changing the given field to the nearest
885 	 * integer to target that is a subset of the existing field.
886 	 * Params:
887 	 * fieldName = a field in structure
888 	 * target = the target value of the fixation
889 	 * Returns: TRUE if the structure could be fixated
890 	 */
891 	public int fixateFieldNearestInt(string fieldName, int target)
892 	{
893 		// gboolean gst_structure_fixate_field_nearest_int  (GstStructure *structure,  const char *field_name,  int target);
894 		return gst_structure_fixate_field_nearest_int(gstStructure, Str.toStringz(fieldName), target);
895 	}
896 	
897 	/**
898 	 * Fixates a GstStructure by changing the given field to the nearest
899 	 * double to target that is a subset of the existing field.
900 	 * Params:
901 	 * fieldName = a field in structure
902 	 * target = the target value of the fixation
903 	 * Returns: TRUE if the structure could be fixated
904 	 */
905 	public int fixateFieldNearestDouble(string fieldName, double target)
906 	{
907 		// gboolean gst_structure_fixate_field_nearest_double  (GstStructure *structure,  const char *field_name,  double target);
908 		return gst_structure_fixate_field_nearest_double(gstStructure, Str.toStringz(fieldName), target);
909 	}
910 	
911 	/**
912 	 * Fixates a GstStructure by changing the given field to the nearest
913 	 * fraction to target_numerator/target_denominator that is a subset
914 	 * of the existing field.
915 	 * Params:
916 	 * fieldName = a field in structure
917 	 * targetNumerator = The numerator of the target value of the fixation
918 	 * targetDenominator = The denominator of the target value of the fixation
919 	 * Returns: TRUE if the structure could be fixated
920 	 */
921 	public int fixateFieldNearestFraction(string fieldName, int targetNumerator, int targetDenominator)
922 	{
923 		// gboolean gst_structure_fixate_field_nearest_fraction  (GstStructure *structure,  const char *field_name,  const gint target_numerator,  const gint target_denominator);
924 		return gst_structure_fixate_field_nearest_fraction(gstStructure, Str.toStringz(fieldName), targetNumerator, targetDenominator);
925 	}
926 	
927 	/**
928 	 * Fixates a GstStructure by changing the given field_name field to the given
929 	 * target boolean if that field is not fixed yet.
930 	 * Params:
931 	 * fieldName = a field in structure
932 	 * target = the target value of the fixation
933 	 * Returns: TRUE if the structure could be fixated
934 	 */
935 	public int fixateFieldBoolean(string fieldName, int target)
936 	{
937 		// gboolean gst_structure_fixate_field_boolean (GstStructure *structure,  const char *field_name,  gboolean target);
938 		return gst_structure_fixate_field_boolean(gstStructure, Str.toStringz(fieldName), target);
939 	}
940 	
941 	/**
942 	 * Fixates a GstStructure by changing the given field_name field to the given
943 	 * target string if that field is not fixed yet.
944 	 * Params:
945 	 * fieldName = a field in structure
946 	 * target = the target value of the fixation
947 	 * Returns: TRUE if the structure could be fixated
948 	 */
949 	public int fixateFieldString(string fieldName, string target)
950 	{
951 		// gboolean gst_structure_fixate_field_string (GstStructure *structure,  const char *field_name,  const gchar *target);
952 		return gst_structure_fixate_field_string(gstStructure, Str.toStringz(fieldName), Str.toStringz(target));
953 	}
954 }