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