Value

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.

class Value : Boxed {}

Constructors

this
this(T val)

Template to create a new Value from a D type.

Members

Functions

copy
void copy(gobject.value.Value destValue)

Copies the value of src_value into dest_value.

dupObject
gobject.object.ObjectG dupObject()

Get 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.

dupString
string dupString()

Get a copy the contents of a G_TYPE_STRING #GValue.

dupVariant
glib.variant.VariantG dupVariant()

Get the contents of a variant #GValue, increasing its refcount. The returned #GVariant is never floating.

fitsPointer
bool fitsPointer()

Determines if value will fit inside the size of a pointer value. This is an internal function introduced mainly for C marshallers.

get
T get()

Template to get a Value of a specific type.

getBoolean
bool getBoolean()

Get the contents of a G_TYPE_BOOLEAN #GValue.

getBoxed
void* getBoxed()

Get the contents of a G_TYPE_BOXED derived #GValue.

getChar
char getChar()

Do 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.

getDouble
double getDouble()

Get the contents of a G_TYPE_DOUBLE #GValue.

getEnum
int getEnum()

Get the contents of a G_TYPE_ENUM #GValue.

getFlags
uint getFlags()

Get the contents of a G_TYPE_FLAGS #GValue.

getFloat
float getFloat()

Get the contents of a G_TYPE_FLOAT #GValue.

getGtype
gobject.types.GType getGtype()

Get the contents of a G_TYPE_GTYPE #GValue.

getInt
int getInt()

Get the contents of a G_TYPE_INT #GValue.

getInt64
long getInt64()

Get the contents of a G_TYPE_INT64 #GValue.

getLong
glong getLong()

Get the contents of a G_TYPE_LONG #GValue.

getObject
gobject.object.ObjectG getObject()

Get the contents of a G_TYPE_OBJECT derived #GValue.

getParam
gobject.param_spec.ParamSpec getParam()

Get the contents of a G_TYPE_PARAM #GValue.

getPointer
void* getPointer()

Get the contents of a pointer #GValue.

getSchar
byte getSchar()

Get the contents of a G_TYPE_CHAR #GValue.

getString
string getString()

Get the contents of a G_TYPE_STRING #GValue.

getUchar
ubyte getUchar()

Get the contents of a G_TYPE_UCHAR #GValue.

getUint
uint getUint()

Get the contents of a G_TYPE_UINT #GValue.

getUint64
ulong getUint64()

Get the contents of a G_TYPE_UINT64 #GValue.

getUlong
gulong getUlong()

Get the contents of a G_TYPE_ULONG #GValue.

getVariant
glib.variant.VariantG getVariant()

Get the contents of a variant #GValue.

initFromInstance
void initFromInstance(gobject.type_instance.TypeInstance instance)

Initializes and sets value from an instantiatable type via the value_table's collect_value() function.

init_
void init_()

Template to initialize a Value to a D type.

init_
gobject.value.Value init_(gobject.types.GType gType)

Initializes value with the default value of type.

peekPointer
void* peekPointer()

Returns 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 marshallers.

reset
gobject.value.Value reset()

Clears the current value in value and resets it to the default value (as if the value had just been initialized).

set
void set(T val)

Template to set a Value of a specific type.

setBoolean
void setBoolean(bool vBoolean)

Set the contents of a G_TYPE_BOOLEAN #GValue to v_boolean.

setBoxed
void setBoxed(const(void)* vBoxed)

Set the contents of a G_TYPE_BOXED derived #GValue to v_boxed.

setBoxedTakeOwnership
void setBoxedTakeOwnership(const(void)* vBoxed)

This is an internal function introduced mainly for C marshallers.

setChar
void setChar(char vChar)

Set the contents of a G_TYPE_CHAR #GValue to v_char.

setDouble
void setDouble(double vDouble)

Set the contents of a G_TYPE_DOUBLE #GValue to v_double.

setEnum
void setEnum(int vEnum)

Set the contents of a G_TYPE_ENUM #GValue to v_enum.

setFlags
void setFlags(uint vFlags)

Set the contents of a G_TYPE_FLAGS #GValue to v_flags.

setFloat
void setFloat(float vFloat)

Set the contents of a G_TYPE_FLOAT #GValue to v_float.

setGtype
void setGtype(gobject.types.GType vGtype)

Set the contents of a G_TYPE_GTYPE #GValue to v_gtype.

setInstance
void setInstance(void* instance)

Sets value from an instantiatable type via the value_table's collect_value() function.

setInt
void setInt(int vInt)

Set the contents of a G_TYPE_INT #GValue to v_int.

setInt64
void setInt64(long vInt64)

Set the contents of a G_TYPE_INT64 #GValue to v_int64.

setInternedString
void setInternedString(string vString)

Set 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 setting the #GValue.

setLong
void setLong(glong vLong)

Set the contents of a G_TYPE_LONG #GValue to v_long.

setObject
void setObject(gobject.object.ObjectG vObject)

Set the contents of a G_TYPE_OBJECT derived #GValue to v_object.

setParam
void setParam(gobject.param_spec.ParamSpec param)

Set the contents of a G_TYPE_PARAM #GValue to param.

setPointer
void setPointer(void* vPointer)

Set the contents of a pointer #GValue to v_pointer.

setSchar
void setSchar(byte vChar)

Set the contents of a G_TYPE_CHAR #GValue to v_char.

setStaticBoxed
void setStaticBoxed(const(void)* vBoxed)

Set the contents of a G_TYPE_BOXED derived #GValue to v_boxed.

setStaticString
void setStaticString(string vString)

Set 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.

setString
void setString(string vString)

Set the contents of a G_TYPE_STRING #GValue to a copy of v_string.

setStringTakeOwnership
void setStringTakeOwnership(string vString)

This is an internal function introduced mainly for C marshallers.

setUchar
void setUchar(ubyte vUchar)

Set the contents of a G_TYPE_UCHAR #GValue to v_uchar.

setUint
void setUint(uint vUint)

Set the contents of a G_TYPE_UINT #GValue to v_uint.

setUint64
void setUint64(ulong vUint64)

Set the contents of a G_TYPE_UINT64 #GValue to v_uint64.

setUlong
void setUlong(gulong vUlong)

Set the contents of a G_TYPE_ULONG #GValue to v_ulong.

setVariant
void setVariant(glib.variant.VariantG variant)

Set the contents of a variant #GValue to variant. If the variant is floating, it is consumed.

stealString
string stealString()

Steal ownership on contents of a G_TYPE_STRING #GValue. As a result of this operation the value's contents will be reset to null.

takeBoxed
void takeBoxed(const(void)* vBoxed)

Sets 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.

takeString
void takeString(string vString)

Sets the contents of a G_TYPE_STRING #GValue to v_string.

takeVariant
void takeVariant(glib.variant.VariantG variant)

Set 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 variant is not increased).

transform
bool transform(gobject.value.Value destValue)

Tries 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 types might incur precision lossage. Especially transformations into strings might reveal seemingly arbitrary results and shouldn't be relied upon for production code (such as rcfile value or object property serialization).

unset
void unset()

Clears 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 structure.

Static functions

typeCompatible
bool typeCompatible(gobject.types.GType srcType, gobject.types.GType destType)

Returns whether a #GValue of type src_type can be copied into a #GValue of type dest_type.

typeTransformable
bool typeTransformable(gobject.types.GType srcType, gobject.types.GType destType)

Check 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 transformation function must be registered.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.