gobject.value
Module for [Value] class
class Value
Types 1
Abstract class used as the base for GObject boxed types. An opaque structure used to hold different types of values.
The data within the structure has protected scope: it is accessible only to functions within a #GTypeValueTable structure, or implementations of the g_value_*() API. That is, code portions which implement new fundamental types.
#GValue users cannot make any assumptions about how data is stored within the 2 element @data union, and the @g_type member should only be accessed through the G_VALUE_TYPE() macro.
Methods
void init_(T)() nothrowTemplate to initialize a Value to a D type. Params: T = The D type to initialize the Value toGType valType() @property nothrowGet the GType of the data stored in the value. Returns: The GType of the valueT get(T)() nothrowTemplate to get a Value of a specific type. Params: T = The D type of the value to get (must match the type of the Value) Returns: The valuevoid set(T)(T val) nothrowTemplate to set a Value of a specific type. Params: T = The D type of the value to set (must match the type of the Value) val = The value to assigngobject.object.ObjectWrap dupObject() nothrowGet the contents of a `G_TYPE_OBJECT` derived #GValue, increasing its reference count. If the contents of the #GValue are null, then null will be returned. Returns: object content of value, should ...string dupString() nothrowGet a copy the contents of a `G_TYPE_STRING` #GValue. Returns: a newly allocated copy of the string content of valueglib.variant.Variant dupVariant() nothrowGet the contents of a variant #GValue, increasing its refcount. The returned #GVariant is never floating. Returns: variant contents of value (may be null); should be unreffed using [glib.variant.Va...bool fitsPointer() nothrowDetermines if value will fit inside the size of a pointer value. This is an internal function introduced mainly for C marshallers. Returns: true if value will fit inside a pointer value.bool getBoolean() nothrowGet the contents of a `G_TYPE_BOOLEAN` #GValue. Returns: boolean contents of valuevoid * getBoxed() nothrowGet the contents of a `G_TYPE_BOXED` derived #GValue. Returns: boxed contents of valuechar getChar() nothrowDo not use this function; it is broken on platforms where the [glib.types.char] type is unsigned, such as ARM and PowerPC. See [gobject.value.Value.getSchar].double getDouble() nothrowGet the contents of a `G_TYPE_DOUBLE` #GValue. Returns: double contents of valueuint getFlags() nothrowGet the contents of a `G_TYPE_FLAGS` #GValue. Returns: flags contents of valuefloat getFloat() nothrowGet the contents of a `G_TYPE_FLOAT` #GValue. Returns: float contents of valuegobject.types.GType getGtype() nothrowGet the contents of a `G_TYPE_GTYPE` #GValue. Returns: the #GType stored in valuelong getInt64() nothrowGet the contents of a `G_TYPE_INT64` #GValue. Returns: 64bit integer contents of valueglong getLong() nothrowGet the contents of a `G_TYPE_LONG` #GValue. Returns: long integer contents of valuegobject.object.ObjectWrap getObject() nothrowGet the contents of a `G_TYPE_OBJECT` derived #GValue. Returns: object contents of valuegobject.param_spec.ParamSpec getParam() nothrowGet the contents of a `G_TYPE_PARAM` #GValue. Returns: #GParamSpec content of valuevoid * getPointer() nothrowGet the contents of a pointer #GValue. Returns: pointer contents of valuebyte getSchar() nothrowGet the contents of a `G_TYPE_CHAR` #GValue. Returns: signed 8 bit integer contents of valuestring getString() nothrowGet the contents of a `G_TYPE_STRING` #GValue. Returns: string content of valueubyte getUchar() nothrowGet the contents of a `G_TYPE_UCHAR` #GValue. Returns: unsigned character contents of valueuint getUint() nothrowGet the contents of a `G_TYPE_UINT` #GValue. Returns: unsigned integer contents of valueulong getUint64() nothrowGet the contents of a `G_TYPE_UINT64` #GValue. Returns: unsigned 64bit integer contents of valuegulong getUlong() nothrowGet the contents of a `G_TYPE_ULONG` #GValue. Returns: unsigned long integer contents of valueglib.variant.Variant getVariant() nothrowGet the contents of a variant #GValue. Returns: variant contents of value (may be null)gobject.value.Value init_(gobject.types.GType gType) nothrowInitializes value with the default value of type.void initFromInstance(gobject.type_instance.TypeInstance instance) nothrowInitializes and sets value from an instantiatable type via the value_table's collect_value() function.void * peekPointer() nothrowReturns the value contents as pointer. This function asserts that [gobject.value.Value.fitsPointer] returned true for the passed in value. This is an internal function introduced mainly for C marsh...gobject.value.Value reset() nothrowClears the current value in value and resets it to the default value (as if the value had just been initialized). Returns: the #GValue structure that has been passed invoid setBoxed(const(void) * vBoxed = null) nothrowSet the contents of a `G_TYPE_BOXED` derived #GValue to v_boxed.void setBoxedTakeOwnership(const(void) * vBoxed = null) nothrowThis is an internal function introduced mainly for C marshallers.void setGtype(gobject.types.GType vGtype) nothrowSet the contents of a `G_TYPE_GTYPE` #GValue to v_gtype.void setInstance(void * instance = null) nothrowSets value from an instantiatable type via the value_table's collect_value() function.void setInternedString(string vString = null) nothrowSet the contents of a `G_TYPE_STRING` #GValue to v_string. The string is assumed to be static and interned (canonical, for example from [glib.global.internString]), and is thus not duplicated when...void setObject(gobject.object.ObjectWrap vObject = null) nothrowSet the contents of a `G_TYPE_OBJECT` derived #GValue to v_object.void setParam(gobject.param_spec.ParamSpec param = null) nothrowSet the contents of a `G_TYPE_PARAM` #GValue to param.void setStaticBoxed(const(void) * vBoxed = null) nothrowSet the contents of a `G_TYPE_BOXED` derived #GValue to v_boxed.void setStaticString(string vString = null) nothrowSet the contents of a `G_TYPE_STRING` #GValue to v_string. The string is assumed to be static, and is thus not duplicated when setting the #GValue.void setString(string vString = null) nothrowSet the contents of a `G_TYPE_STRING` #GValue to a copy of v_string.void setStringTakeOwnership(string vString = null) nothrowThis is an internal function introduced mainly for C marshallers.void setVariant(glib.variant.Variant variant = null) nothrowSet the contents of a variant #GValue to variant. If the variant is floating, it is consumed.string stealString() nothrowSteal ownership on contents of a `G_TYPE_STRING` #GValue. As a result of this operation the value's contents will be reset to null.void takeBoxed(const(void) * vBoxed = null) nothrowSets the contents of a `G_TYPE_BOXED` derived #GValue to v_boxed and takes over the ownership of the caller’s reference to v_boxed; the caller doesn’t have to unref it any more.void takeString(string vString = null) nothrowSets the contents of a `G_TYPE_STRING` #GValue to v_string.void takeVariant(glib.variant.Variant variant = null) nothrowSet the contents of a variant #GValue to variant, and takes over the ownership of the caller's reference to variant; the caller doesn't have to unref it any more (i.e. the reference count of the va...bool transform(gobject.value.Value destValue) nothrowTries to cast the contents of src_value into a type appropriate to store in dest_value, e.g. to transform a `G_TYPE_INT` value into a `G_TYPE_FLOAT` value. Performing transformations between value ...void unset() nothrowClears the current value in value (if any) and "unsets" the type, this releases all resources associated with this GValue. An unset value is the same as an uninitialized (zero-filled) #GValue struc...bool typeCompatible(gobject.types.GType srcType, gobject.types.GType destType) static nothrowReturns whether a #GValue of type src_type can be copied into a #GValue of type dest_type.bool typeTransformable(gobject.types.GType srcType, gobject.types.GType destType) static nothrowCheck whether [gobject.value.Value.transform] is able to transform values of type src_type into values of type dest_type. Note that for the types to be transformable, they must be compatible or a t...Functions 4
fn
void initVal(T)(GValue * gval) nothrowTemplate to initialize a C GValue structure. Params: T = The D type to initialize the GValue to gval = The C GValue structure pointerfn
T getVal(T)(const(GValue) * gval) nothrowTemplate to get a value from a GValue of a given D type (must contain the correct type) Params: T = D type which the C GValue structure contains gval = C GValue structure pointer Returns: The value...fn
string getStringWithLength(const(GValue) * gval, int length) nothrowGet a string from a GValue with a length. Params: gval = Value length = Length of string (-1 to use strlen) Returns: The D string