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