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