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