gobject.value

Module for [Value] class

Types 1

classValue : Boxed

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 * _cPtr(Flag!"Dup" dup = No.Dup) nothrow
GType _getGType() static nothrow
GType _gType() @property nothrow
Value self() nothrowReturns `this`, for use in `with` statements.
void init_(T)() nothrowTemplate to initialize a Value to a D type. Params: T = The D type to initialize the Value to
GType valType() @property nothrowGet the GType of the data stored in the value. Returns: The GType of the value
T 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 value
void 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 assign
void copy(gobject.value.Value destValue) nothrowCopies the value of src_value into dest_value.
gobject.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 value
glib.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 value
void * getBoxed() nothrowGet the contents of a `G_TYPE_BOXED` derived #GValue. Returns: boxed contents of value
char 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 value
int getEnum() nothrowGet the contents of a `G_TYPE_ENUM` #GValue. Returns: enum contents of value
uint getFlags() nothrowGet the contents of a `G_TYPE_FLAGS` #GValue. Returns: flags contents of value
float getFloat() nothrowGet the contents of a `G_TYPE_FLOAT` #GValue. Returns: float contents of value
gobject.types.GType getGtype() nothrowGet the contents of a `G_TYPE_GTYPE` #GValue. Returns: the #GType stored in value
int getInt() nothrowGet the contents of a `G_TYPE_INT` #GValue. Returns: integer contents of value
long getInt64() nothrowGet the contents of a `G_TYPE_INT64` #GValue. Returns: 64bit integer contents of value
glong getLong() nothrowGet the contents of a `G_TYPE_LONG` #GValue. Returns: long integer contents of value
gobject.object.ObjectWrap getObject() nothrowGet the contents of a `G_TYPE_OBJECT` derived #GValue. Returns: object contents of value
gobject.param_spec.ParamSpec getParam() nothrowGet the contents of a `G_TYPE_PARAM` #GValue. Returns: #GParamSpec content of value
void * getPointer() nothrowGet the contents of a pointer #GValue. Returns: pointer contents of value
byte getSchar() nothrowGet the contents of a `G_TYPE_CHAR` #GValue. Returns: signed 8 bit integer contents of value
string getString() nothrowGet the contents of a `G_TYPE_STRING` #GValue. Returns: string content of value
ubyte getUchar() nothrowGet the contents of a `G_TYPE_UCHAR` #GValue. Returns: unsigned character contents of value
uint getUint() nothrowGet the contents of a `G_TYPE_UINT` #GValue. Returns: unsigned integer contents of value
ulong getUint64() nothrowGet the contents of a `G_TYPE_UINT64` #GValue. Returns: unsigned 64bit integer contents of value
gulong getUlong() nothrowGet the contents of a `G_TYPE_ULONG` #GValue. Returns: unsigned long integer contents of value
glib.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 in
void setBoolean(bool vBoolean) nothrowSet the contents of a `G_TYPE_BOOLEAN` #GValue to v_boolean.
void 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 setChar(char vChar) nothrowSet the contents of a `G_TYPE_CHAR` #GValue to v_char.
void setDouble(double vDouble) nothrowSet the contents of a `G_TYPE_DOUBLE` #GValue to v_double.
void setEnum(int vEnum) nothrowSet the contents of a `G_TYPE_ENUM` #GValue to v_enum.
void setFlags(uint vFlags) nothrowSet the contents of a `G_TYPE_FLAGS` #GValue to v_flags.
void setFloat(float vFloat) nothrowSet the contents of a `G_TYPE_FLOAT` #GValue to v_float.
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 setInt(int vInt) nothrowSet the contents of a `G_TYPE_INT` #GValue to v_int.
void setInt64(long vInt64) nothrowSet the contents of a `G_TYPE_INT64` #GValue to v_int64.
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 setLong(glong vLong) nothrowSet the contents of a `G_TYPE_LONG` #GValue to v_long.
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 setPointer(void * vPointer = null) nothrowSet the contents of a pointer #GValue to v_pointer.
void setSchar(byte vChar) nothrowSet the contents of a `G_TYPE_CHAR` #GValue to v_char.
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 setUchar(ubyte vUchar) nothrowSet the contents of a `G_TYPE_UCHAR` #GValue to v_uchar.
void setUint(uint vUint) nothrowSet the contents of a `G_TYPE_UINT` #GValue to v_uint.
void setUint64(ulong vUint64) nothrowSet the contents of a `G_TYPE_UINT64` #GValue to v_uint64.
void setUlong(gulong vUlong) nothrowSet the contents of a `G_TYPE_ULONG` #GValue to v_ulong.
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...
Constructors
this()Create a `value.Value` boxed type.
this(void * ptr, Flag!"Take" take)
this(T val)Template to create a new Value from a D type. Params: T = The D type to initialize the value to val = The value to assign

Functions 4

fnvoid 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 pointer
fnT 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...
fnstring 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
fnvoid setVal(T)(GValue * gval, T v) nothrowTemplate to set a GValue to a given D type (must have been initialized to the proper type) Params: T = D type which the C GValue structure has been initialized to (except Boxed types which are init...