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 = gobject-Generic-values.html 27 * outPack = gobject 28 * outFile = Value 29 * strct = GValue 30 * realStrct= 31 * ctorStrct= 32 * clss = Value 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_value_ 41 * omit structs: 42 * - GValue 43 * omit prefixes: 44 * omit code: 45 * - g_value_init 46 * - g_value_reset 47 * omit signals: 48 * imports: 49 * - glib.Str 50 * - gobject.ParamSpec 51 * - gdk.Pixbuf 52 * - glib.Variant 53 * - glib.VariantType 54 * structWrap: 55 * - GParamSpec* -> ParamSpec 56 * - GValue* -> Value 57 * - GVariant* -> Variant 58 * - GVariantType* -> VariantType 59 * module aliases: 60 * local aliases: 61 * overrides: 62 */ 63 64 module gobject.Value; 65 66 public import gtkc.gobjecttypes; 67 68 private import gtkc.gobject; 69 private import glib.ConstructionException; 70 private import gobject.ObjectG; 71 72 73 private import glib.Str; 74 private import gobject.ParamSpec; 75 private import gdk.Pixbuf; 76 private import glib.Variant; 77 private import glib.VariantType; 78 79 80 81 82 /** 83 * The GValue structure is basically a variable container that consists 84 * of a type identifier and a specific value of that type. 85 * The type identifier within a GValue structure always determines the 86 * type of the associated value. 87 * To create a undefined GValue structure, simply create a zero-filled 88 * GValue structure. To initialize the GValue, use the g_value_init() 89 * function. A GValue cannot be used until it is initialized. 90 * The basic type operations (such as freeing and copying) are determined 91 * by the GTypeValueTable associated with the type ID stored in the GValue. 92 * Other GValue operations (such as converting values between types) are 93 * provided by this interface. 94 * 95 * The code in the example program below demonstrates GValue's 96 * features. 97 * 98 * $(DDOC_COMMENT example) 99 */ 100 public class Value 101 { 102 103 /** the main Gtk struct */ 104 protected GValue* gValue; 105 106 107 public GValue* getValueStruct() 108 { 109 return gValue; 110 } 111 112 113 /** the main Gtk struct as a void* */ 114 protected void* getStruct() 115 { 116 return cast(void*)gValue; 117 } 118 119 /** 120 * Sets our main struct and passes it to the parent class 121 */ 122 public this (GValue* gValue) 123 { 124 this.gValue = gValue; 125 } 126 127 /** */ 128 public this() 129 { 130 this(new GValue); 131 } 132 133 /** */ 134 this(Pixbuf pixbuf) 135 { 136 GValue* v = new GValue; 137 //v.g_type = DUIType.PIXBUF; 138 v.g_type = Pixbuf.getType(); 139 v.data1.v_pointer = cast(void*)(pixbuf.getPixbufStruct()); 140 this(v); 141 } 142 143 /** */ 144 this(string value) 145 { 146 this(); 147 init(GType.STRING); 148 setString(value); 149 } 150 151 /** */ 152 this(int value) 153 { 154 this(); 155 init(GType.INT); 156 setInt(value); 157 } 158 159 /** */ 160 this(float value) 161 { 162 this(); 163 init(GType.FLOAT); 164 setFloat(value); 165 } 166 167 /** */ 168 this(double value) 169 { 170 this(); 171 init(GType.DOUBLE); 172 setDouble(value); 173 } 174 175 /** 176 * Initializes value with the default value of type. 177 * Params: 178 * value = A zero-filled (uninitialized) GValue structure. 179 * g_type = Type the GValue should hold values of. 180 * Returns: 181 * the GValue structure that has been passed in 182 */ 183 public Value init(GType gType) 184 { 185 // GValue* g_value_init (GValue *value, GType g_type); 186 g_value_init(gValue, gType); 187 return this; 188 } 189 190 /** 191 * Clears the current value in value and resets it to the default value 192 * (as if the value had just been initialized). 193 * Params: 194 * value = An initialized GValue structure. 195 * Returns: 196 * the GValue structure that has been passed in 197 */ 198 public Value reset() 199 { 200 // GValue* g_value_reset (GValue *value); 201 g_value_reset(gValue); 202 return this; 203 } 204 205 206 207 /** 208 * GValue provides an abstract container structure which can be 209 * copied, transformed and compared while holding a value of any 210 * (derived) type, which is registered as a GType with a 211 * GTypeValueTable in its GTypeInfo structure. Parameter 212 * specifications for most value types can be created as GParamSpec 213 * derived instances, to implement e.g. GObject properties which 214 * operate on GValue containers. 215 * 216 * Parameter names need to start with a letter (a-z or A-Z). Subsequent 217 * characters can be letters, numbers or a '-'. 218 * All other characters are replaced by a '-' during construction. 219 */ 220 221 /** 222 * Copies the value of src_value into dest_value. 223 * Params: 224 * destValue = An initialized GValue structure of the same type as src_value. 225 */ 226 public void copy(Value destValue) 227 { 228 // void g_value_copy (const GValue *src_value, GValue *dest_value); 229 g_value_copy(gValue, (destValue is null) ? null : destValue.getValueStruct()); 230 } 231 232 /** 233 * Clears the current value in value and "unsets" the type, 234 * this releases all resources associated with this GValue. 235 * An unset value is the same as an uninitialized (zero-filled) 236 * GValue structure. 237 */ 238 public void unset() 239 { 240 // void g_value_unset (GValue *value); 241 g_value_unset(gValue); 242 } 243 244 /** 245 * Sets value from an instantiatable type via the 246 * value_table's collect_value() function. 247 */ 248 public void setInstance(void* instanc) 249 { 250 // void g_value_set_instance (GValue *value, gpointer instance); 251 g_value_set_instance(gValue, instanc); 252 } 253 254 /** 255 * Determines if value will fit inside the size of a pointer value. 256 * This is an internal function introduced mainly for C marshallers. 257 * Returns: TRUE if value will fit inside a pointer value. 258 */ 259 public int fitsPointer() 260 { 261 // gboolean g_value_fits_pointer (const GValue *value); 262 return g_value_fits_pointer(gValue); 263 } 264 265 /** 266 * Returns: the value contents as pointer. This function asserts that g_value_fits_pointer() returned TRUE for the passed in value. This is an internal function introduced mainly for C marshallers. [transfer none] 267 */ 268 public void* peekPointer() 269 { 270 // gpointer g_value_peek_pointer (const GValue *value); 271 return g_value_peek_pointer(gValue); 272 } 273 274 /** 275 * Returns whether a GValue of type src_type can be copied into 276 * a GValue of type dest_type. 277 * Params: 278 * srcType = source type to be copied. 279 * destType = destination type for copying. 280 * Returns: TRUE if g_value_copy() is possible with src_type and dest_type. 281 */ 282 public static int typeCompatible(GType srcType, GType destType) 283 { 284 // gboolean g_value_type_compatible (GType src_type, GType dest_type); 285 return g_value_type_compatible(srcType, destType); 286 } 287 288 /** 289 * Check whether g_value_transform() is able to transform values 290 * of type src_type into values of type dest_type. 291 * Params: 292 * srcType = Source type. 293 * destType = Target type. 294 * Returns: TRUE if the transformation is possible, FALSE otherwise. 295 */ 296 public static int typeTransformable(GType srcType, GType destType) 297 { 298 // gboolean g_value_type_transformable (GType src_type, GType dest_type); 299 return g_value_type_transformable(srcType, destType); 300 } 301 302 /** 303 * Tries to cast the contents of src_value into a type appropriate 304 * to store in dest_value, e.g. to transform a G_TYPE_INT value 305 * into a G_TYPE_FLOAT value. Performing transformations between 306 * value types might incur precision lossage. Especially 307 * transformations into strings might reveal seemingly arbitrary 308 * results and shouldn't be relied upon for production code (such 309 * as rcfile value or object property serialization). 310 * Params: 311 * destValue = Target value. 312 * Returns: Whether a transformation rule was found and could be applied. Upon failing transformations, dest_value is left untouched. 313 */ 314 public int transform(Value destValue) 315 { 316 // gboolean g_value_transform (const GValue *src_value, GValue *dest_value); 317 return g_value_transform(gValue, (destValue is null) ? null : destValue.getValueStruct()); 318 } 319 320 /** 321 * Registers a value transformation function for use in g_value_transform(). 322 * A previously registered transformation function for src_type and dest_type 323 * will be replaced. 324 * Params: 325 * srcType = Source type. 326 * destType = Target type. 327 * transformFunc = a function which transforms values of type src_type 328 * into value of type dest_type 329 */ 330 public static void registerTransformFunc(GType srcType, GType destType, GValueTransform transformFunc) 331 { 332 // void g_value_register_transform_func (GType src_type, GType dest_type, GValueTransform transform_func); 333 g_value_register_transform_func(srcType, destType, transformFunc); 334 } 335 336 /** 337 * Return a newly allocated string, which describes the contents of a 338 * GValue. The main purpose of this function is to describe GValue 339 * contents for debugging output, the way in which the contents are 340 * described may change between different GLib versions. 341 * Returns: Newly allocated string. 342 */ 343 public string gStrdupValueContents() 344 { 345 // gchar * g_strdup_value_contents (const GValue *value); 346 return Str.toString(g_strdup_value_contents(gValue)); 347 } 348 349 /** 350 * Creates a new GParamSpecBoolean instance specifying a G_TYPE_BOOLEAN 351 * property. 352 * See g_param_spec_internal() for details on property names. 353 * Params: 354 * name = canonical name of the property specified 355 * nick = nick name for the property specified 356 * blurb = description of the property specified 357 * defaultValue = default value for the property specified 358 * flags = flags for the property specified 359 * Returns: a newly created parameter specification. [transfer full] 360 */ 361 public static ParamSpec gParamSpecBoolean(string name, string nick, string blurb, int defaultValue, GParamFlags flags) 362 { 363 // GParamSpec * g_param_spec_boolean (const gchar *name, const gchar *nick, const gchar *blurb, gboolean default_value, GParamFlags flags); 364 auto p = g_param_spec_boolean(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), defaultValue, flags); 365 366 if(p is null) 367 { 368 return null; 369 } 370 371 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 372 } 373 374 /** 375 * Set the contents of a G_TYPE_BOOLEAN GValue to v_boolean. 376 * Params: 377 * vBoolean = boolean value to be set 378 */ 379 public void setBoolean(int vBoolean) 380 { 381 // void g_value_set_boolean (GValue *value, gboolean v_boolean); 382 g_value_set_boolean(gValue, vBoolean); 383 } 384 385 /** 386 * Get the contents of a G_TYPE_BOOLEAN GValue. 387 * Returns: boolean contents of value 388 */ 389 public int getBoolean() 390 { 391 // gboolean g_value_get_boolean (const GValue *value); 392 return g_value_get_boolean(gValue); 393 } 394 395 /** 396 * Creates a new GParamSpecChar instance specifying a G_TYPE_CHAR property. 397 * Params: 398 * name = canonical name of the property specified 399 * nick = nick name for the property specified 400 * blurb = description of the property specified 401 * minimum = minimum value for the property specified 402 * maximum = maximum value for the property specified 403 * defaultValue = default value for the property specified 404 * flags = flags for the property specified 405 * Returns: a newly created parameter specification. [transfer full] 406 */ 407 public static ParamSpec gParamSpecChar(string name, string nick, string blurb, byte minimum, byte maximum, byte defaultValue, GParamFlags flags) 408 { 409 // GParamSpec * g_param_spec_char (const gchar *name, const gchar *nick, const gchar *blurb, gint8 minimum, gint8 maximum, gint8 default_value, GParamFlags flags); 410 auto p = g_param_spec_char(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 411 412 if(p is null) 413 { 414 return null; 415 } 416 417 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 418 } 419 420 /** 421 * Warning 422 * g_value_set_char has been deprecated since version 2.32 and should not be used in newly-written code. This function's input type is broken, see g_value_set_schar() 423 * Set the contents of a G_TYPE_CHAR GValue to v_char. 424 * Params: 425 * vChar = character value to be set 426 */ 427 public void setChar(char vChar) 428 { 429 // void g_value_set_char (GValue *value, gchar v_char); 430 g_value_set_char(gValue, vChar); 431 } 432 433 /** 434 * Warning 435 * g_value_get_char has been deprecated since version 2.32 and should not be used in newly-written code. This function's return type is broken, see g_value_get_schar() 436 * Do not use this function; it is broken on platforms where the char 437 * type is unsigned, such as ARM and PowerPC. See g_value_get_schar(). 438 * Get the contents of a G_TYPE_CHAR GValue. 439 * Returns: character contents of value 440 */ 441 public char getChar() 442 { 443 // gchar g_value_get_char (const GValue *value); 444 return g_value_get_char(gValue); 445 } 446 447 /** 448 * Get the contents of a G_TYPE_CHAR GValue. 449 * Since 2.32 450 * Returns: signed 8 bit integer contents of value 451 */ 452 public byte getSchar() 453 { 454 // gint8 g_value_get_schar (const GValue *value); 455 return g_value_get_schar(gValue); 456 } 457 458 /** 459 * Set the contents of a G_TYPE_CHAR GValue to v_char. 460 * Since 2.32 461 * Params: 462 * vChar = signed 8 bit integer to be set 463 */ 464 public void setSchar(byte vChar) 465 { 466 // void g_value_set_schar (GValue *value, gint8 v_char); 467 g_value_set_schar(gValue, vChar); 468 } 469 470 /** 471 * Creates a new GParamSpecUChar instance specifying a G_TYPE_UCHAR property. 472 * Params: 473 * name = canonical name of the property specified 474 * nick = nick name for the property specified 475 * blurb = description of the property specified 476 * minimum = minimum value for the property specified 477 * maximum = maximum value for the property specified 478 * defaultValue = default value for the property specified 479 * flags = flags for the property specified 480 * Returns: a newly created parameter specification. [transfer full] 481 */ 482 public static ParamSpec gParamSpecUchar(string name, string nick, string blurb, ubyte minimum, ubyte maximum, ubyte defaultValue, GParamFlags flags) 483 { 484 // GParamSpec * g_param_spec_uchar (const gchar *name, const gchar *nick, const gchar *blurb, guint8 minimum, guint8 maximum, guint8 default_value, GParamFlags flags); 485 auto p = g_param_spec_uchar(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 486 487 if(p is null) 488 { 489 return null; 490 } 491 492 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 493 } 494 495 /** 496 * Set the contents of a G_TYPE_UCHAR GValue to v_uchar. 497 * Params: 498 * vUchar = unsigned character value to be set 499 */ 500 public void setUchar(char vUchar) 501 { 502 // void g_value_set_uchar (GValue *value, guchar v_uchar); 503 g_value_set_uchar(gValue, vUchar); 504 } 505 506 /** 507 * Get the contents of a G_TYPE_UCHAR GValue. 508 * Returns: unsigned character contents of value 509 */ 510 public char getUchar() 511 { 512 // guchar g_value_get_uchar (const GValue *value); 513 return g_value_get_uchar(gValue); 514 } 515 516 /** 517 * Creates a new GParamSpecInt instance specifying a G_TYPE_INT property. 518 * See g_param_spec_internal() for details on property names. 519 * Params: 520 * name = canonical name of the property specified 521 * nick = nick name for the property specified 522 * blurb = description of the property specified 523 * minimum = minimum value for the property specified 524 * maximum = maximum value for the property specified 525 * defaultValue = default value for the property specified 526 * flags = flags for the property specified 527 * Returns: a newly created parameter specification. [transfer full] 528 */ 529 public static ParamSpec gParamSpecInt(string name, string nick, string blurb, int minimum, int maximum, int defaultValue, GParamFlags flags) 530 { 531 // GParamSpec * g_param_spec_int (const gchar *name, const gchar *nick, const gchar *blurb, gint minimum, gint maximum, gint default_value, GParamFlags flags); 532 auto p = g_param_spec_int(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 533 534 if(p is null) 535 { 536 return null; 537 } 538 539 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 540 } 541 542 /** 543 * Set the contents of a G_TYPE_INT GValue to v_int. 544 * Params: 545 * vInt = integer value to be set 546 */ 547 public void setInt(int vInt) 548 { 549 // void g_value_set_int (GValue *value, gint v_int); 550 g_value_set_int(gValue, vInt); 551 } 552 553 /** 554 * Get the contents of a G_TYPE_INT GValue. 555 * Returns: integer contents of value 556 */ 557 public int getInt() 558 { 559 // gint g_value_get_int (const GValue *value); 560 return g_value_get_int(gValue); 561 } 562 563 /** 564 * Creates a new GParamSpecUInt instance specifying a G_TYPE_UINT property. 565 * See g_param_spec_internal() for details on property names. 566 * Params: 567 * name = canonical name of the property specified 568 * nick = nick name for the property specified 569 * blurb = description of the property specified 570 * minimum = minimum value for the property specified 571 * maximum = maximum value for the property specified 572 * defaultValue = default value for the property specified 573 * flags = flags for the property specified 574 * Returns: a newly created parameter specification. [transfer full] 575 */ 576 public static ParamSpec gParamSpecUint(string name, string nick, string blurb, uint minimum, uint maximum, uint defaultValue, GParamFlags flags) 577 { 578 // GParamSpec * g_param_spec_uint (const gchar *name, const gchar *nick, const gchar *blurb, guint minimum, guint maximum, guint default_value, GParamFlags flags); 579 auto p = g_param_spec_uint(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 580 581 if(p is null) 582 { 583 return null; 584 } 585 586 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 587 } 588 589 /** 590 * Set the contents of a G_TYPE_UINT GValue to v_uint. 591 * Params: 592 * vUint = unsigned integer value to be set 593 */ 594 public void setUint(uint vUint) 595 { 596 // void g_value_set_uint (GValue *value, guint v_uint); 597 g_value_set_uint(gValue, vUint); 598 } 599 600 /** 601 * Get the contents of a G_TYPE_UINT GValue. 602 * Returns: unsigned integer contents of value 603 */ 604 public uint getUint() 605 { 606 // guint g_value_get_uint (const GValue *value); 607 return g_value_get_uint(gValue); 608 } 609 610 /** 611 * Creates a new GParamSpecLong instance specifying a G_TYPE_LONG property. 612 * See g_param_spec_internal() for details on property names. 613 * Params: 614 * name = canonical name of the property specified 615 * nick = nick name for the property specified 616 * blurb = description of the property specified 617 * minimum = minimum value for the property specified 618 * maximum = maximum value for the property specified 619 * defaultValue = default value for the property specified 620 * flags = flags for the property specified 621 * Returns: a newly created parameter specification. [transfer full] 622 */ 623 public static ParamSpec gParamSpecLong(string name, string nick, string blurb, glong minimum, glong maximum, glong defaultValue, GParamFlags flags) 624 { 625 // GParamSpec * g_param_spec_long (const gchar *name, const gchar *nick, const gchar *blurb, glong minimum, glong maximum, glong default_value, GParamFlags flags); 626 auto p = g_param_spec_long(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 627 628 if(p is null) 629 { 630 return null; 631 } 632 633 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 634 } 635 636 /** 637 * Set the contents of a G_TYPE_LONG GValue to v_long. 638 * Params: 639 * vLong = long integer value to be set 640 */ 641 public void setLong(glong vLong) 642 { 643 // void g_value_set_long (GValue *value, glong v_long); 644 g_value_set_long(gValue, vLong); 645 } 646 647 /** 648 * Get the contents of a G_TYPE_LONG GValue. 649 * Returns: long integer contents of value 650 */ 651 public glong getLong() 652 { 653 // glong g_value_get_long (const GValue *value); 654 return g_value_get_long(gValue); 655 } 656 657 /** 658 * Creates a new GParamSpecULong instance specifying a G_TYPE_ULONG 659 * property. 660 * See g_param_spec_internal() for details on property names. 661 * Params: 662 * name = canonical name of the property specified 663 * nick = nick name for the property specified 664 * blurb = description of the property specified 665 * minimum = minimum value for the property specified 666 * maximum = maximum value for the property specified 667 * defaultValue = default value for the property specified 668 * flags = flags for the property specified 669 * Returns: a newly created parameter specification. [transfer full] 670 */ 671 public static ParamSpec gParamSpecUlong(string name, string nick, string blurb, gulong minimum, gulong maximum, gulong defaultValue, GParamFlags flags) 672 { 673 // GParamSpec * g_param_spec_ulong (const gchar *name, const gchar *nick, const gchar *blurb, gulong minimum, gulong maximum, gulong default_value, GParamFlags flags); 674 auto p = g_param_spec_ulong(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 675 676 if(p is null) 677 { 678 return null; 679 } 680 681 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 682 } 683 684 /** 685 * Set the contents of a G_TYPE_ULONG GValue to v_ulong. 686 * Params: 687 * vUlong = unsigned long integer value to be set 688 */ 689 public void setUlong(gulong vUlong) 690 { 691 // void g_value_set_ulong (GValue *value, gulong v_ulong); 692 g_value_set_ulong(gValue, vUlong); 693 } 694 695 /** 696 * Get the contents of a G_TYPE_ULONG GValue. 697 * Returns: unsigned long integer contents of value 698 */ 699 public gulong getUlong() 700 { 701 // gulong g_value_get_ulong (const GValue *value); 702 return g_value_get_ulong(gValue); 703 } 704 705 /** 706 * Creates a new GParamSpecInt64 instance specifying a G_TYPE_INT64 property. 707 * See g_param_spec_internal() for details on property names. 708 * Params: 709 * name = canonical name of the property specified 710 * nick = nick name for the property specified 711 * blurb = description of the property specified 712 * minimum = minimum value for the property specified 713 * maximum = maximum value for the property specified 714 * defaultValue = default value for the property specified 715 * flags = flags for the property specified 716 * Returns: a newly created parameter specification. [transfer full] 717 */ 718 public static ParamSpec gParamSpecInt64(string name, string nick, string blurb, long minimum, long maximum, long defaultValue, GParamFlags flags) 719 { 720 // GParamSpec * g_param_spec_int64 (const gchar *name, const gchar *nick, const gchar *blurb, gint64 minimum, gint64 maximum, gint64 default_value, GParamFlags flags); 721 auto p = g_param_spec_int64(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 722 723 if(p is null) 724 { 725 return null; 726 } 727 728 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 729 } 730 731 /** 732 * Set the contents of a G_TYPE_INT64 GValue to v_int64. 733 * Params: 734 * vInt64 = 64bit integer value to be set 735 */ 736 public void setInt64(long vInt64) 737 { 738 // void g_value_set_int64 (GValue *value, gint64 v_int64); 739 g_value_set_int64(gValue, vInt64); 740 } 741 742 /** 743 * Get the contents of a G_TYPE_INT64 GValue. 744 * Returns: 64bit integer contents of value 745 */ 746 public long getInt64() 747 { 748 // gint64 g_value_get_int64 (const GValue *value); 749 return g_value_get_int64(gValue); 750 } 751 752 /** 753 * Creates a new GParamSpecUInt64 instance specifying a G_TYPE_UINT64 754 * property. 755 * See g_param_spec_internal() for details on property names. 756 * Params: 757 * name = canonical name of the property specified 758 * nick = nick name for the property specified 759 * blurb = description of the property specified 760 * minimum = minimum value for the property specified 761 * maximum = maximum value for the property specified 762 * defaultValue = default value for the property specified 763 * flags = flags for the property specified 764 * Returns: a newly created parameter specification. [transfer full] 765 */ 766 public static ParamSpec gParamSpecUint64(string name, string nick, string blurb, ulong minimum, ulong maximum, ulong defaultValue, GParamFlags flags) 767 { 768 // GParamSpec * g_param_spec_uint64 (const gchar *name, const gchar *nick, const gchar *blurb, guint64 minimum, guint64 maximum, guint64 default_value, GParamFlags flags); 769 auto p = g_param_spec_uint64(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 770 771 if(p is null) 772 { 773 return null; 774 } 775 776 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 777 } 778 779 /** 780 * Set the contents of a G_TYPE_UINT64 GValue to v_uint64. 781 * Params: 782 * vUint64 = unsigned 64bit integer value to be set 783 */ 784 public void setUint64(ulong vUint64) 785 { 786 // void g_value_set_uint64 (GValue *value, guint64 v_uint64); 787 g_value_set_uint64(gValue, vUint64); 788 } 789 790 /** 791 * Get the contents of a G_TYPE_UINT64 GValue. 792 * Returns: unsigned 64bit integer contents of value 793 */ 794 public ulong getUint64() 795 { 796 // guint64 g_value_get_uint64 (const GValue *value); 797 return g_value_get_uint64(gValue); 798 } 799 800 /** 801 * Creates a new GParamSpecFloat instance specifying a G_TYPE_FLOAT property. 802 * See g_param_spec_internal() for details on property names. 803 * Params: 804 * name = canonical name of the property specified 805 * nick = nick name for the property specified 806 * blurb = description of the property specified 807 * minimum = minimum value for the property specified 808 * maximum = maximum value for the property specified 809 * defaultValue = default value for the property specified 810 * flags = flags for the property specified 811 * Returns: a newly created parameter specification. [transfer full] 812 */ 813 public static ParamSpec gParamSpecFloat(string name, string nick, string blurb, float minimum, float maximum, float defaultValue, GParamFlags flags) 814 { 815 // GParamSpec * g_param_spec_float (const gchar *name, const gchar *nick, const gchar *blurb, gfloat minimum, gfloat maximum, gfloat default_value, GParamFlags flags); 816 auto p = g_param_spec_float(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 817 818 if(p is null) 819 { 820 return null; 821 } 822 823 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 824 } 825 826 /** 827 * Set the contents of a G_TYPE_FLOAT GValue to v_float. 828 * Params: 829 * vFloat = float value to be set 830 */ 831 public void setFloat(float vFloat) 832 { 833 // void g_value_set_float (GValue *value, gfloat v_float); 834 g_value_set_float(gValue, vFloat); 835 } 836 837 /** 838 * Get the contents of a G_TYPE_FLOAT GValue. 839 * Returns: float contents of value 840 */ 841 public float getFloat() 842 { 843 // gfloat g_value_get_float (const GValue *value); 844 return g_value_get_float(gValue); 845 } 846 847 /** 848 * Creates a new GParamSpecDouble instance specifying a G_TYPE_DOUBLE 849 * property. 850 * See g_param_spec_internal() for details on property names. 851 * Params: 852 * name = canonical name of the property specified 853 * nick = nick name for the property specified 854 * blurb = description of the property specified 855 * minimum = minimum value for the property specified 856 * maximum = maximum value for the property specified 857 * defaultValue = default value for the property specified 858 * flags = flags for the property specified 859 * Returns: a newly created parameter specification. [transfer full] 860 */ 861 public static ParamSpec gParamSpecDouble(string name, string nick, string blurb, double minimum, double maximum, double defaultValue, GParamFlags flags) 862 { 863 // GParamSpec * g_param_spec_double (const gchar *name, const gchar *nick, const gchar *blurb, gdouble minimum, gdouble maximum, gdouble default_value, GParamFlags flags); 864 auto p = g_param_spec_double(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), minimum, maximum, defaultValue, flags); 865 866 if(p is null) 867 { 868 return null; 869 } 870 871 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 872 } 873 874 /** 875 * Set the contents of a G_TYPE_DOUBLE GValue to v_double. 876 * Params: 877 * vDouble = double value to be set 878 */ 879 public void setDouble(double vDouble) 880 { 881 // void g_value_set_double (GValue *value, gdouble v_double); 882 g_value_set_double(gValue, vDouble); 883 } 884 885 /** 886 * Get the contents of a G_TYPE_DOUBLE GValue. 887 * Returns: double contents of value 888 */ 889 public double getDouble() 890 { 891 // gdouble g_value_get_double (const GValue *value); 892 return g_value_get_double(gValue); 893 } 894 895 /** 896 * Creates a new GParamSpecEnum instance specifying a G_TYPE_ENUM 897 * property. 898 * See g_param_spec_internal() for details on property names. 899 * Params: 900 * name = canonical name of the property specified 901 * nick = nick name for the property specified 902 * blurb = description of the property specified 903 * enumType = a GType derived from G_TYPE_ENUM 904 * defaultValue = default value for the property specified 905 * flags = flags for the property specified 906 * Returns: a newly created parameter specification. [transfer full] 907 */ 908 public static ParamSpec gParamSpecEnum(string name, string nick, string blurb, GType enumType, int defaultValue, GParamFlags flags) 909 { 910 // GParamSpec * g_param_spec_enum (const gchar *name, const gchar *nick, const gchar *blurb, GType enum_type, gint default_value, GParamFlags flags); 911 auto p = g_param_spec_enum(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), enumType, defaultValue, flags); 912 913 if(p is null) 914 { 915 return null; 916 } 917 918 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 919 } 920 921 /** 922 * Set the contents of a G_TYPE_ENUM GValue to v_enum. 923 * Params: 924 * vEnum = enum value to be set 925 */ 926 public void setEnum(int vEnum) 927 { 928 // void g_value_set_enum (GValue *value, gint v_enum); 929 g_value_set_enum(gValue, vEnum); 930 } 931 932 /** 933 * Get the contents of a G_TYPE_ENUM GValue. 934 * Returns: enum contents of value 935 */ 936 public int getEnum() 937 { 938 // gint g_value_get_enum (const GValue *value); 939 return g_value_get_enum(gValue); 940 } 941 942 /** 943 * Creates a new GParamSpecFlags instance specifying a G_TYPE_FLAGS 944 * property. 945 * See g_param_spec_internal() for details on property names. 946 * Params: 947 * name = canonical name of the property specified 948 * nick = nick name for the property specified 949 * blurb = description of the property specified 950 * flagsType = a GType derived from G_TYPE_FLAGS 951 * defaultValue = default value for the property specified 952 * flags = flags for the property specified 953 * Returns: a newly created parameter specification. [transfer full] 954 */ 955 public static ParamSpec gParamSpecFlags(string name, string nick, string blurb, GType flagsType, uint defaultValue, GParamFlags flags) 956 { 957 // GParamSpec * g_param_spec_flags (const gchar *name, const gchar *nick, const gchar *blurb, GType flags_type, guint default_value, GParamFlags flags); 958 auto p = g_param_spec_flags(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), flagsType, defaultValue, flags); 959 960 if(p is null) 961 { 962 return null; 963 } 964 965 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 966 } 967 968 /** 969 * Set the contents of a G_TYPE_FLAGS GValue to v_flags. 970 * Params: 971 * vFlags = flags value to be set 972 */ 973 public void setFlags(uint vFlags) 974 { 975 // void g_value_set_flags (GValue *value, guint v_flags); 976 g_value_set_flags(gValue, vFlags); 977 } 978 979 /** 980 * Get the contents of a G_TYPE_FLAGS GValue. 981 * Returns: flags contents of value 982 */ 983 public uint getFlags() 984 { 985 // guint g_value_get_flags (const GValue *value); 986 return g_value_get_flags(gValue); 987 } 988 989 /** 990 * Creates a new GParamSpecString instance. 991 * See g_param_spec_internal() for details on property names. 992 * Params: 993 * name = canonical name of the property specified 994 * nick = nick name for the property specified 995 * blurb = description of the property specified 996 * defaultValue = default value for the property specified 997 * flags = flags for the property specified 998 * Returns: a newly created parameter specification. [transfer full] 999 */ 1000 public static ParamSpec gParamSpecString(string name, string nick, string blurb, string defaultValue, GParamFlags flags) 1001 { 1002 // GParamSpec * g_param_spec_string (const gchar *name, const gchar *nick, const gchar *blurb, const gchar *default_value, GParamFlags flags); 1003 auto p = g_param_spec_string(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), Str.toStringz(defaultValue), flags); 1004 1005 if(p is null) 1006 { 1007 return null; 1008 } 1009 1010 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1011 } 1012 1013 /** 1014 * Set the contents of a G_TYPE_STRING GValue to v_string. 1015 * Params: 1016 * vString = caller-owned string to be duplicated for the GValue. [allow-none] 1017 */ 1018 public void setString(string vString) 1019 { 1020 // void g_value_set_string (GValue *value, const gchar *v_string); 1021 g_value_set_string(gValue, Str.toStringz(vString)); 1022 } 1023 1024 /** 1025 * Set the contents of a G_TYPE_STRING GValue to v_string. 1026 * The string is assumed to be static, and is thus not duplicated 1027 * when setting the GValue. 1028 * Params: 1029 * vString = static string to be set. [allow-none] 1030 */ 1031 public void setStaticString(string vString) 1032 { 1033 // void g_value_set_static_string (GValue *value, const gchar *v_string); 1034 g_value_set_static_string(gValue, Str.toStringz(vString)); 1035 } 1036 1037 /** 1038 * Sets the contents of a G_TYPE_STRING GValue to v_string. 1039 * Since 2.4 1040 * Params: 1041 * vString = string to take ownership of. [allow-none] 1042 */ 1043 public void takeString(string vString) 1044 { 1045 // void g_value_take_string (GValue *value, gchar *v_string); 1046 g_value_take_string(gValue, Str.toStringz(vString)); 1047 } 1048 1049 /** 1050 * Warning 1051 * g_value_set_string_take_ownership has been deprecated since version 2.4 and should not be used in newly-written code. Use g_value_take_string() instead. 1052 * This is an internal function introduced mainly for C marshallers. 1053 * Params: 1054 * vString = duplicated unowned string to be set. [allow-none] 1055 */ 1056 public void setStringTakeOwnership(string vString) 1057 { 1058 // void g_value_set_string_take_ownership (GValue *value, gchar *v_string); 1059 g_value_set_string_take_ownership(gValue, Str.toStringz(vString)); 1060 } 1061 1062 /** 1063 * Get the contents of a G_TYPE_STRING GValue. 1064 * Returns: string content of value 1065 */ 1066 public string getString() 1067 { 1068 // const gchar * g_value_get_string (const GValue *value); 1069 return Str.toString(g_value_get_string(gValue)); 1070 } 1071 1072 /** 1073 * Get a copy the contents of a G_TYPE_STRING GValue. 1074 * Returns: a newly allocated copy of the string content of value 1075 */ 1076 public string dupString() 1077 { 1078 // gchar * g_value_dup_string (const GValue *value); 1079 return Str.toString(g_value_dup_string(gValue)); 1080 } 1081 1082 /** 1083 * Creates a new GParamSpecParam instance specifying a G_TYPE_PARAM 1084 * property. 1085 * See g_param_spec_internal() for details on property names. 1086 * Params: 1087 * name = canonical name of the property specified 1088 * nick = nick name for the property specified 1089 * blurb = description of the property specified 1090 * paramType = a GType derived from G_TYPE_PARAM 1091 * flags = flags for the property specified 1092 * Returns: a newly created parameter specification. [transfer full] 1093 */ 1094 public static ParamSpec gParamSpecParam(string name, string nick, string blurb, GType paramType, GParamFlags flags) 1095 { 1096 // GParamSpec * g_param_spec_param (const gchar *name, const gchar *nick, const gchar *blurb, GType param_type, GParamFlags flags); 1097 auto p = g_param_spec_param(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), paramType, flags); 1098 1099 if(p is null) 1100 { 1101 return null; 1102 } 1103 1104 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1105 } 1106 1107 /** 1108 * Set the contents of a G_TYPE_PARAM GValue to param. 1109 * Params: 1110 * param = the GParamSpec to be set. [allow-none] 1111 */ 1112 public void setParam(ParamSpec param) 1113 { 1114 // void g_value_set_param (GValue *value, GParamSpec *param); 1115 g_value_set_param(gValue, (param is null) ? null : param.getParamSpecStruct()); 1116 } 1117 1118 /** 1119 * Sets the contents of a G_TYPE_PARAM GValue to param and takes 1120 * over the ownership of the callers reference to param; the caller 1121 * doesn't have to unref it any more. 1122 * Since 2.4 1123 * Params: 1124 * param = the GParamSpec to be set. [allow-none] 1125 */ 1126 public void takeParam(ParamSpec param) 1127 { 1128 // void g_value_take_param (GValue *value, GParamSpec *param); 1129 g_value_take_param(gValue, (param is null) ? null : param.getParamSpecStruct()); 1130 } 1131 1132 /** 1133 * Warning 1134 * g_value_set_param_take_ownership has been deprecated since version 2.4 and should not be used in newly-written code. Use g_value_take_param() instead. 1135 * This is an internal function introduced mainly for C marshallers. 1136 * Params: 1137 * param = the GParamSpec to be set. [allow-none] 1138 */ 1139 public void setParamTakeOwnership(ParamSpec param) 1140 { 1141 // void g_value_set_param_take_ownership (GValue *value, GParamSpec *param); 1142 g_value_set_param_take_ownership(gValue, (param is null) ? null : param.getParamSpecStruct()); 1143 } 1144 1145 /** 1146 * Get the contents of a G_TYPE_PARAM GValue. 1147 * Returns: GParamSpec content of value. [transfer none] 1148 */ 1149 public ParamSpec getParam() 1150 { 1151 // GParamSpec * g_value_get_param (const GValue *value); 1152 auto p = g_value_get_param(gValue); 1153 1154 if(p is null) 1155 { 1156 return null; 1157 } 1158 1159 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1160 } 1161 1162 /** 1163 * Get the contents of a G_TYPE_PARAM GValue, increasing its 1164 * reference count. 1165 * Returns: GParamSpec content of value, should be unreferenced when no longer needed. 1166 */ 1167 public ParamSpec dupParam() 1168 { 1169 // GParamSpec * g_value_dup_param (const GValue *value); 1170 auto p = g_value_dup_param(gValue); 1171 1172 if(p is null) 1173 { 1174 return null; 1175 } 1176 1177 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1178 } 1179 1180 /** 1181 * Creates a new GParamSpecBoxed instance specifying a G_TYPE_BOXED 1182 * derived property. 1183 * See g_param_spec_internal() for details on property names. 1184 * Params: 1185 * name = canonical name of the property specified 1186 * nick = nick name for the property specified 1187 * blurb = description of the property specified 1188 * boxedType = G_TYPE_BOXED derived type of this property 1189 * flags = flags for the property specified 1190 * Returns: a newly created parameter specification. [transfer full] 1191 */ 1192 public static ParamSpec gParamSpecBoxed(string name, string nick, string blurb, GType boxedType, GParamFlags flags) 1193 { 1194 // GParamSpec * g_param_spec_boxed (const gchar *name, const gchar *nick, const gchar *blurb, GType boxed_type, GParamFlags flags); 1195 auto p = g_param_spec_boxed(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), boxedType, flags); 1196 1197 if(p is null) 1198 { 1199 return null; 1200 } 1201 1202 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1203 } 1204 1205 /** 1206 * Set the contents of a G_TYPE_BOXED derived GValue to v_boxed. 1207 * Params: 1208 * vBoxed = boxed value to be set. [allow-none] 1209 */ 1210 public void setBoxed(void* vBoxed) 1211 { 1212 // void g_value_set_boxed (GValue *value, gconstpointer v_boxed); 1213 g_value_set_boxed(gValue, vBoxed); 1214 } 1215 1216 /** 1217 * Set the contents of a G_TYPE_BOXED derived GValue to v_boxed. 1218 * The boxed value is assumed to be static, and is thus not duplicated 1219 * when setting the GValue. 1220 * Params: 1221 * vBoxed = static boxed value to be set. [allow-none] 1222 */ 1223 public void setStaticBoxed(void* vBoxed) 1224 { 1225 // void g_value_set_static_boxed (GValue *value, gconstpointer v_boxed); 1226 g_value_set_static_boxed(gValue, vBoxed); 1227 } 1228 1229 /** 1230 * Sets the contents of a G_TYPE_BOXED derived GValue to v_boxed 1231 * and takes over the ownership of the callers reference to v_boxed; 1232 * the caller doesn't have to unref it any more. 1233 * Since 2.4 1234 * Params: 1235 * vBoxed = duplicated unowned boxed value to be set. [allow-none] 1236 */ 1237 public void takeBoxed(void* vBoxed) 1238 { 1239 // void g_value_take_boxed (GValue *value, gconstpointer v_boxed); 1240 g_value_take_boxed(gValue, vBoxed); 1241 } 1242 1243 /** 1244 * Warning 1245 * g_value_set_boxed_take_ownership has been deprecated since version 2.4 and should not be used in newly-written code. Use g_value_take_boxed() instead. 1246 * This is an internal function introduced mainly for C marshallers. 1247 * Params: 1248 * vBoxed = duplicated unowned boxed value to be set. [allow-none] 1249 */ 1250 public void setBoxedTakeOwnership(void* vBoxed) 1251 { 1252 // void g_value_set_boxed_take_ownership (GValue *value, gconstpointer v_boxed); 1253 g_value_set_boxed_take_ownership(gValue, vBoxed); 1254 } 1255 1256 /** 1257 * Get the contents of a G_TYPE_BOXED derived GValue. 1258 * Returns: boxed contents of value. [transfer none] 1259 */ 1260 public void* getBoxed() 1261 { 1262 // gpointer g_value_get_boxed (const GValue *value); 1263 return g_value_get_boxed(gValue); 1264 } 1265 1266 /** 1267 * Get the contents of a G_TYPE_BOXED derived GValue. Upon getting, 1268 * the boxed value is duplicated and needs to be later freed with 1269 * g_boxed_free(), e.g. like: g_boxed_free (G_VALUE_TYPE (value), 1270 * return_value); 1271 * Returns: boxed contents of value 1272 */ 1273 public void* dupBoxed() 1274 { 1275 // gpointer g_value_dup_boxed (const GValue *value); 1276 return g_value_dup_boxed(gValue); 1277 } 1278 1279 /** 1280 * Creates a new GParamSpecPointer instance specifying a pointer property. 1281 * See g_param_spec_internal() for details on property names. 1282 * Params: 1283 * name = canonical name of the property specified 1284 * nick = nick name for the property specified 1285 * blurb = description of the property specified 1286 * flags = flags for the property specified 1287 * Returns: a newly created parameter specification. [transfer full] 1288 */ 1289 public static ParamSpec gParamSpecPointer(string name, string nick, string blurb, GParamFlags flags) 1290 { 1291 // GParamSpec * g_param_spec_pointer (const gchar *name, const gchar *nick, const gchar *blurb, GParamFlags flags); 1292 auto p = g_param_spec_pointer(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), flags); 1293 1294 if(p is null) 1295 { 1296 return null; 1297 } 1298 1299 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1300 } 1301 1302 /** 1303 * Set the contents of a pointer GValue to v_pointer. 1304 * Params: 1305 * vPointer = pointer value to be set 1306 */ 1307 public void setPointer(void* vPointer) 1308 { 1309 // void g_value_set_pointer (GValue *value, gpointer v_pointer); 1310 g_value_set_pointer(gValue, vPointer); 1311 } 1312 1313 /** 1314 * Get the contents of a pointer GValue. 1315 * Returns: pointer contents of value. [transfer none] 1316 */ 1317 public void* getPointer() 1318 { 1319 // gpointer g_value_get_pointer (const GValue *value); 1320 return g_value_get_pointer(gValue); 1321 } 1322 1323 /** 1324 * Creates a new GParamSpecBoxed instance specifying a G_TYPE_OBJECT 1325 * derived property. 1326 * See g_param_spec_internal() for details on property names. 1327 * Params: 1328 * name = canonical name of the property specified 1329 * nick = nick name for the property specified 1330 * blurb = description of the property specified 1331 * objectType = G_TYPE_OBJECT derived type of this property 1332 * flags = flags for the property specified 1333 * Returns: a newly created parameter specification. [transfer full] 1334 */ 1335 public static ParamSpec gParamSpecObject(string name, string nick, string blurb, GType objectType, GParamFlags flags) 1336 { 1337 // GParamSpec * g_param_spec_object (const gchar *name, const gchar *nick, const gchar *blurb, GType object_type, GParamFlags flags); 1338 auto p = g_param_spec_object(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), objectType, flags); 1339 1340 if(p is null) 1341 { 1342 return null; 1343 } 1344 1345 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1346 } 1347 1348 /** 1349 * Set the contents of a G_TYPE_OBJECT derived GValue to v_object. 1350 * g_value_set_object() increases the reference count of v_object 1351 * (the GValue holds a reference to v_object). If you do not wish 1352 * to increase the reference count of the object (i.e. you wish to 1353 * pass your current reference to the GValue because you no longer 1354 * need it), use g_value_take_object() instead. 1355 * It is important that your GValue holds a reference to v_object (either its 1356 * own, or one it has taken) to ensure that the object won't be destroyed while 1357 * the GValue still exists). 1358 * Params: 1359 * vObject = object value to be set. [type GObject.Object][allow-none] 1360 */ 1361 public void setObject(void* vObject) 1362 { 1363 // void g_value_set_object (GValue *value, gpointer v_object); 1364 g_value_set_object(gValue, vObject); 1365 } 1366 1367 /** 1368 * Sets the contents of a G_TYPE_OBJECT derived GValue to v_object 1369 * and takes over the ownership of the callers reference to v_object; 1370 * the caller doesn't have to unref it any more (i.e. the reference 1371 * count of the object is not increased). 1372 * If you want the GValue to hold its own reference to v_object, use 1373 * g_value_set_object() instead. 1374 * Since 2.4 1375 * Params: 1376 * vObject = object value to be set. [allow-none] 1377 */ 1378 public void takeObject(void* vObject) 1379 { 1380 // void g_value_take_object (GValue *value, gpointer v_object); 1381 g_value_take_object(gValue, vObject); 1382 } 1383 1384 /** 1385 * Warning 1386 * g_value_set_object_take_ownership has been deprecated since version 2.4 and should not be used in newly-written code. Use g_value_take_object() instead. 1387 * This is an internal function introduced mainly for C marshallers. 1388 * Params: 1389 * vObject = object value to be set. [allow-none] 1390 */ 1391 public void setObjectTakeOwnership(void* vObject) 1392 { 1393 // void g_value_set_object_take_ownership (GValue *value, gpointer v_object); 1394 g_value_set_object_take_ownership(gValue, vObject); 1395 } 1396 1397 /** 1398 * Get the contents of a G_TYPE_OBJECT derived GValue. 1399 * Returns: object contents of value. [type GObject.Object][transfer none] 1400 */ 1401 public void* getObject() 1402 { 1403 // gpointer g_value_get_object (const GValue *value); 1404 return g_value_get_object(gValue); 1405 } 1406 1407 /** 1408 * Get the contents of a G_TYPE_OBJECT derived GValue, increasing 1409 * its reference count. If the contents of the GValue are NULL, then 1410 * NULL will be returned. 1411 * Returns: object content of value, should be unreferenced when no longer needed. [type GObject.Object][transfer full] 1412 */ 1413 public void* dupObject() 1414 { 1415 // gpointer g_value_dup_object (const GValue *value); 1416 return g_value_dup_object(gValue); 1417 } 1418 1419 /** 1420 * Creates a new GParamSpecUnichar instance specifying a G_TYPE_UINT 1421 * property. GValue structures for this property can be accessed with 1422 * g_value_set_uint() and g_value_get_uint(). 1423 * See g_param_spec_internal() for details on property names. 1424 * Params: 1425 * name = canonical name of the property specified 1426 * nick = nick name for the property specified 1427 * blurb = description of the property specified 1428 * defaultValue = default value for the property specified 1429 * flags = flags for the property specified 1430 * Returns: a newly created parameter specification. [transfer full] 1431 */ 1432 public static ParamSpec gParamSpecUnichar(string name, string nick, string blurb, gunichar defaultValue, GParamFlags flags) 1433 { 1434 // GParamSpec * g_param_spec_unichar (const gchar *name, const gchar *nick, const gchar *blurb, gunichar default_value, GParamFlags flags); 1435 auto p = g_param_spec_unichar(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), defaultValue, flags); 1436 1437 if(p is null) 1438 { 1439 return null; 1440 } 1441 1442 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1443 } 1444 1445 /** 1446 * Creates a new GParamSpecValueArray instance specifying a 1447 * G_TYPE_VALUE_ARRAY property. G_TYPE_VALUE_ARRAY is a 1448 * G_TYPE_BOXED type, as such, GValue structures for this property 1449 * can be accessed with g_value_set_boxed() and g_value_get_boxed(). 1450 * See g_param_spec_internal() for details on property names. 1451 * Params: 1452 * name = canonical name of the property specified 1453 * nick = nick name for the property specified 1454 * blurb = description of the property specified 1455 * elementSpec = a GParamSpec describing the elements contained in 1456 * arrays of this property, may be NULL 1457 * flags = flags for the property specified 1458 * Returns: a newly created parameter specification 1459 */ 1460 public static ParamSpec gParamSpecValueArray(string name, string nick, string blurb, ParamSpec elementSpec, GParamFlags flags) 1461 { 1462 // GParamSpec * g_param_spec_value_array (const gchar *name, const gchar *nick, const gchar *blurb, GParamSpec *element_spec, GParamFlags flags); 1463 auto p = g_param_spec_value_array(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), (elementSpec is null) ? null : elementSpec.getParamSpecStruct(), flags); 1464 1465 if(p is null) 1466 { 1467 return null; 1468 } 1469 1470 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1471 } 1472 1473 /** 1474 * Creates a new property of type GParamSpecOverride. This is used 1475 * to direct operations to another paramspec, and will not be directly 1476 * useful unless you are implementing a new base type similar to GObject. 1477 * Since 2.4 1478 * Params: 1479 * name = the name of the property. 1480 * overridden = The property that is being overridden 1481 * Returns: the newly created GParamSpec 1482 */ 1483 public static ParamSpec gParamSpecOverride(string name, ParamSpec overridden) 1484 { 1485 // GParamSpec * g_param_spec_override (const gchar *name, GParamSpec *overridden); 1486 auto p = g_param_spec_override(Str.toStringz(name), (overridden is null) ? null : overridden.getParamSpecStruct()); 1487 1488 if(p is null) 1489 { 1490 return null; 1491 } 1492 1493 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1494 } 1495 1496 /** 1497 * Creates a new GParamSpecGType instance specifying a 1498 * G_TYPE_GTYPE property. 1499 * See g_param_spec_internal() for details on property names. 1500 * Since 2.10 1501 * Params: 1502 * name = canonical name of the property specified 1503 * nick = nick name for the property specified 1504 * blurb = description of the property specified 1505 * isAType = a GType whose subtypes are allowed as values 1506 * of the property (use G_TYPE_NONE for any type) 1507 * flags = flags for the property specified 1508 * Returns: a newly created parameter specification. [transfer full] 1509 */ 1510 public static ParamSpec gParamSpecGtype(string name, string nick, string blurb, GType isAType, GParamFlags flags) 1511 { 1512 // GParamSpec * g_param_spec_gtype (const gchar *name, const gchar *nick, const gchar *blurb, GType is_a_type, GParamFlags flags); 1513 auto p = g_param_spec_gtype(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), isAType, flags); 1514 1515 if(p is null) 1516 { 1517 return null; 1518 } 1519 1520 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1521 } 1522 1523 /** 1524 * Get the contents of a G_TYPE_GTYPE GValue. 1525 * Since 2.12 1526 * Returns: the GType stored in value 1527 */ 1528 public GType getGtype() 1529 { 1530 // GType g_value_get_gtype (const GValue *value); 1531 return g_value_get_gtype(gValue); 1532 } 1533 1534 /** 1535 * Set the contents of a G_TYPE_GTYPE GValue to v_gtype. 1536 * Since 2.12 1537 * Params: 1538 * vGtype = GType to be set 1539 */ 1540 public void setGtype(GType vGtype) 1541 { 1542 // void g_value_set_gtype (GValue *value, GType v_gtype); 1543 g_value_set_gtype(gValue, vGtype); 1544 } 1545 1546 /** 1547 * Creates a new GParamSpecVariant instance specifying a GVariant 1548 * property. 1549 * If default_value is floating, it is consumed. 1550 * See g_param_spec_internal() for details on property names. 1551 * Since 2.26 1552 * Params: 1553 * name = canonical name of the property specified 1554 * nick = nick name for the property specified 1555 * blurb = description of the property specified 1556 * type = a GVariantType 1557 * defaultValue = a GVariant of type type to 1558 * use as the default value, or NULL. [allow-none][transfer full] 1559 * flags = flags for the property specified 1560 * Returns: the newly created GParamSpec. [transfer full] 1561 */ 1562 public static ParamSpec gParamSpecVariant(string name, string nick, string blurb, VariantType type, Variant defaultValue, GParamFlags flags) 1563 { 1564 // GParamSpec * g_param_spec_variant (const gchar *name, const gchar *nick, const gchar *blurb, const GVariantType *type, GVariant *default_value, GParamFlags flags); 1565 auto p = g_param_spec_variant(Str.toStringz(name), Str.toStringz(nick), Str.toStringz(blurb), (type is null) ? null : type.getVariantTypeStruct(), (defaultValue is null) ? null : defaultValue.getVariantStruct(), flags); 1566 1567 if(p is null) 1568 { 1569 return null; 1570 } 1571 1572 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 1573 } 1574 1575 /** 1576 * Get the contents of a variant GValue. 1577 * Since 2.26 1578 * Returns: variant contents of value 1579 */ 1580 public Variant getVariant() 1581 { 1582 // GVariant * g_value_get_variant (const GValue *value); 1583 auto p = g_value_get_variant(gValue); 1584 1585 if(p is null) 1586 { 1587 return null; 1588 } 1589 1590 return ObjectG.getDObject!(Variant)(cast(GVariant*) p); 1591 } 1592 1593 /** 1594 * Get the contents of a variant GValue, increasing its refcount. 1595 * Since 2.26 1596 * Returns: variant contents of value, should be unrefed using g_variant_unref() when no longer needed 1597 */ 1598 public Variant dupVariant() 1599 { 1600 // GVariant * g_value_dup_variant (const GValue *value); 1601 auto p = g_value_dup_variant(gValue); 1602 1603 if(p is null) 1604 { 1605 return null; 1606 } 1607 1608 return ObjectG.getDObject!(Variant)(cast(GVariant*) p); 1609 } 1610 1611 /** 1612 * Set the contents of a variant GValue to variant. 1613 * If the variant is floating, it is consumed. 1614 * Since 2.26 1615 * Params: 1616 * variant = a GVariant, or NULL. [allow-none] 1617 */ 1618 public void setVariant(Variant variant) 1619 { 1620 // void g_value_set_variant (GValue *value, GVariant *variant); 1621 g_value_set_variant(gValue, (variant is null) ? null : variant.getVariantStruct()); 1622 } 1623 1624 /** 1625 * Set the contents of a variant GValue to variant, and takes over 1626 * the ownership of the caller's reference to variant; 1627 * the caller doesn't have to unref it any more (i.e. the reference 1628 * count of the variant is not increased). 1629 * If variant was floating then its floating reference is converted to 1630 * a hard reference. 1631 * If you want the GValue to hold its own reference to variant, use 1632 * g_value_set_variant() instead. 1633 * This is an internal function introduced mainly for C marshallers. 1634 * Since 2.26 1635 * Params: 1636 * variant = a GVariant, or NULL. [allow-none] 1637 */ 1638 public void takeVariant(Variant variant) 1639 { 1640 // void g_value_take_variant (GValue *value, GVariant *variant); 1641 g_value_take_variant(gValue, (variant is null) ? null : variant.getVariantStruct()); 1642 } 1643 }