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