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)
GType _gType() @property
Value self()Returns `this`, for use in `with` statements.
void init_(T)()Template to initialize a Value to a D type. Params: T = The D type to initialize the Value to
GType valType() @propertyGet the GType of the data stored in the value. Returns: The GType of the value
T get(T)()Template 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)Template 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)Copies the value of srcvalue into destvalue.
gobject.object.ObjectWrap dupObject()Get the contents of a `GTYPEOBJECT` 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 be...
string dupString()Get a copy the contents of a `GTYPESTRING` #GValue. Returns: a newly allocated copy of the string content of value
glib.variant.Variant dupVariant()Get 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()Determines 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()Get the contents of a `GTYPEBOOLEAN` #GValue. Returns: boolean contents of value
void * getBoxed()Get the contents of a `GTYPEBOXED` derived #GValue. Returns: boxed contents of value
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].
double getDouble()Get the contents of a `GTYPEDOUBLE` #GValue. Returns: double contents of value
int getEnum()Get the contents of a `GTYPEENUM` #GValue. Returns: enum contents of value
uint getFlags()Get the contents of a `GTYPEFLAGS` #GValue. Returns: flags contents of value
float getFloat()Get the contents of a `GTYPEFLOAT` #GValue. Returns: float contents of value
gobject.types.GType getGtype()Get the contents of a `GTYPEGTYPE` #GValue. Returns: the #GType stored in value
int getInt()Get the contents of a `GTYPEINT` #GValue. Returns: integer contents of value
long getInt64()Get the contents of a `GTYPEINT64` #GValue. Returns: 64bit integer contents of value
glong getLong()Get the contents of a `GTYPELONG` #GValue. Returns: long integer contents of value
gobject.object.ObjectWrap getObject()Get the contents of a `GTYPEOBJECT` derived #GValue. Returns: object contents of value
gobject.param_spec.ParamSpec getParam()Get the contents of a `GTYPEPARAM` #GValue. Returns: #GParamSpec content of value
void * getPointer()Get the contents of a pointer #GValue. Returns: pointer contents of value
byte getSchar()Get the contents of a `GTYPECHAR` #GValue. Returns: signed 8 bit integer contents of value
string getString()Get the contents of a `GTYPESTRING` #GValue. Returns: string content of value
ubyte getUchar()Get the contents of a `GTYPEUCHAR` #GValue. Returns: unsigned character contents of value
uint getUint()Get the contents of a `GTYPEUINT` #GValue. Returns: unsigned integer contents of value
ulong getUint64()Get the contents of a `GTYPEUINT64` #GValue. Returns: unsigned 64bit integer contents of value
gulong getUlong()Get the contents of a `GTYPEULONG` #GValue. Returns: unsigned long integer contents of value
glib.variant.Variant getVariant()Get the contents of a variant #GValue. Returns: variant contents of value (may be null)
gobject.value.Value init_(gobject.types.GType gType)Initializes value with the default value of type.
void initFromInstance(gobject.type_instance.TypeInstance instance)Initializes and sets value from an instantiatable type via the valuetable's collectvalue() function.
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 marsh...
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). Returns: the #GValue structure that has been passed in
void setBoolean(bool vBoolean)Set the contents of a `GTYPEBOOLEAN` #GValue to v_boolean.
void setBoxed(const(void) * vBoxed = null)Set the contents of a `GTYPEBOXED` derived #GValue to v_boxed.
void setBoxedTakeOwnership(const(void) * vBoxed = null)This is an internal function introduced mainly for C marshallers.
void setChar(char vChar)Set the contents of a `GTYPECHAR` #GValue to v_char.
void setDouble(double vDouble)Set the contents of a `GTYPEDOUBLE` #GValue to v_double.
void setEnum(int vEnum)Set the contents of a `GTYPEENUM` #GValue to v_enum.
void setFlags(uint vFlags)Set the contents of a `GTYPEFLAGS` #GValue to v_flags.
void setFloat(float vFloat)Set the contents of a `GTYPEFLOAT` #GValue to v_float.
void setGtype(gobject.types.GType vGtype)Set the contents of a `GTYPEGTYPE` #GValue to v_gtype.
void setInstance(void * instance = null)Sets value from an instantiatable type via the valuetable's collectvalue() function.
void setInt(int vInt)Set the contents of a `GTYPEINT` #GValue to v_int.
void setInt64(long vInt64)Set the contents of a `GTYPEINT64` #GValue to v_int64.
void setInternedString(string vString = null)Set the contents of a `GTYPESTRING` #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 s...
void setLong(glong vLong)Set the contents of a `GTYPELONG` #GValue to v_long.
void setObject(gobject.object.ObjectWrap vObject = null)Set the contents of a `GTYPEOBJECT` derived #GValue to v_object.
void setParam(gobject.param_spec.ParamSpec param = null)Set the contents of a `GTYPEPARAM` #GValue to param.
void setPointer(void * vPointer = null)Set the contents of a pointer #GValue to v_pointer.
void setSchar(byte vChar)Set the contents of a `GTYPECHAR` #GValue to v_char.
void setStaticBoxed(const(void) * vBoxed = null)Set the contents of a `GTYPEBOXED` derived #GValue to v_boxed.
void setStaticString(string vString = null)Set the contents of a `GTYPESTRING` #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)Set the contents of a `GTYPESTRING` #GValue to a copy of v_string.
void setStringTakeOwnership(string vString = null)This is an internal function introduced mainly for C marshallers.
void setUchar(ubyte vUchar)Set the contents of a `GTYPEUCHAR` #GValue to v_uchar.
void setUint(uint vUint)Set the contents of a `GTYPEUINT` #GValue to v_uint.
void setUint64(ulong vUint64)Set the contents of a `GTYPEUINT64` #GValue to v_uint64.
void setUlong(gulong vUlong)Set the contents of a `GTYPEULONG` #GValue to v_ulong.
void setVariant(glib.variant.Variant variant = null)Set the contents of a variant #GValue to variant. If the variant is floating, it is consumed.
string stealString()Steal ownership on contents of a `GTYPESTRING` #GValue. As a result of this operation the value's contents will be reset to null.
void takeBoxed(const(void) * vBoxed = null)Sets the contents of a `GTYPEBOXED` derived #GValue to vboxed and takes over the ownership of the caller’s reference to vboxed; the caller doesn’t have to unref it any more.
void takeString(string vString = null)Sets the contents of a `GTYPESTRING` #GValue to v_string.
void takeVariant(glib.variant.Variant variant = null)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 va...
bool transform(gobject.value.Value destValue)Tries to cast the contents of srcvalue into a type appropriate to store in destvalue, e.g. to transform a `GTYPEINT` value into a `GTYPEFLOAT` value. Performing transformations between value types ...
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 struc...
bool typeCompatible(gobject.types.GType srcType, gobject.types.GType destType)Returns whether a #GValue of type srctype can be copied into a #GValue of type desttype.
bool typeTransformable(gobject.types.GType srcType, gobject.types.GType destType)Check whether [gobject.value.Value.transform] is able to transform values of type srctype into values of type desttype. Note that for the types to be transformable, they must be compatible or a tra...
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)Template 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)Template 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)Get 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)Template 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...