[24:7] extends: object
An opaque structure used to hold different types of values. Before it can be
used, a GValue has to be initialized to a specific type by calling
[method@GObject.Value.init] on it. Many types which are stored within a
GValue need to allocate data on the heap, so [method@GObject.Value.unset]
must always be called on a GValue to free any such data once you’re
finished with the GValue, even if the GValue itself is stored on the
stack. The data within the structure has protected scope: it is accessible
only to functions within a [struct@GObject.TypeValueTable] structure, or
implementations of the g_value_*() API. That is, code which implements 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 [func@GObject.VALUE_TYPE] macro and related
macros.
GValue (Handle = null)
Creates a new
Valueby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.copy (object dest_value)
Copies the value of @src_value into @dest_value.
dest_value is an initialized [struct@GObject.Value] structure of the same type as @src_value.None.dup_boxed ()
Get the contents of a %G_TYPE_BOXED derived #GValue. Upon getting, the boxed value is duplicated and needs to be later freed with g_boxed_free(), e.g. like: g_boxed_free (G_VALUE_TYPE (@value), return_value);
boxed contents of @value.dup_object ()
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.
object content of @value, should be unreferenced when no longer needed..dup_param ()
Get the contents of a %G_TYPE_PARAM #GValue, increasing its reference count.
#GParamSpec content of @value, should be unreferenced when no longer needed..dup_string ()
Get a copy the contents of a %G_TYPE_STRING #GValue.
a newly allocated copy of the string content of @value.dup_variant ()
Get the contents of a variant #GValue, increasing its refcount. The returned #GVariant is never floating.
variant contents of @value (may be %NULL); should be unreffed using g_variant_unref() when no longer needed.fits_pointer ()
Determines if @value will fit inside the size of a pointer value. This is an internal function introduced mainly for C marshallers.
true if @value will fit inside a pointer value; false otherwise.get_boolean ()
Get the contents of a %G_TYPE_BOOLEAN #GValue.
boolean contents of @value.get_boxed ()
Get the contents of a %G_TYPE_BOXED derived #GValue.
boxed contents of @value.get_char ()
Do not use this function; it is broken on platforms where the %char type is unsigned, such as ARM and PowerPC. See g_value_get_schar(). Get the contents of a %G_TYPE_CHAR #GValue.
character contents of @value.get_double ()
Get the contents of a %G_TYPE_DOUBLE #GValue.
double contents of @value.get_enum ()
Get the contents of a %G_TYPE_ENUM #GValue.
enum contents of @value.get_flags ()
Get the contents of a %G_TYPE_FLAGS #GValue.
flags contents of @value.get_float ()
Get the contents of a %G_TYPE_FLOAT #GValue.
float contents of @value.get_gtype ()
Get the contents of a %G_TYPE_GTYPE #GValue.
the #GType stored in @value.get_int ()
Get the contents of a %G_TYPE_INT #GValue.
integer contents of @value.get_int64 ()
Get the contents of a %G_TYPE_INT64 #GValue.
64bit integer contents of @value.get_long ()
Get the contents of a %G_TYPE_LONG #GValue.
long integer contents of @value.get_object ()
Get the contents of a %G_TYPE_OBJECT derived #GValue.
object contents of @value.get_param ()
Get the contents of a %G_TYPE_PARAM #GValue.
#GParamSpec content of @value.get_pointer ()
Get the contents of a pointer #GValue.
pointer contents of @value.get_schar ()
Get the contents of a %G_TYPE_CHAR #GValue.
signed 8 bit integer contents of @value.get_string ()
Get the contents of a %G_TYPE_STRING #GValue.
string content of @value.get_uchar ()
Get the contents of a %G_TYPE_UCHAR #GValue.
unsigned character contents of @value.get_uint ()
Get the contents of a %G_TYPE_UINT #GValue.
unsigned integer contents of @value.get_uint64 ()
Get the contents of a %G_TYPE_UINT64 #GValue.
unsigned 64bit integer contents of @value.get_ulong ()
Get the contents of a %G_TYPE_ULONG #GValue.
unsigned long integer contents of @value.get_variant ()
Get the contents of a variant #GValue.
variant contents of @value (may be %NULL).init (int g_type)
Initializes @value to store values of the given @type, and sets its value to the initial value for @type. This must be called before any other methods on a [struct@GObject.Value], so the value knows what type it’s meant to store.
c GValue value = G_VALUE_INIT; g_value_init (&value, SOME_G_TYPE); … g_value_unset (&value);
g_type is type the [struct@GObject.Value] should hold values of.the [struct@GObject.Value] structure that has been passed in.init_from_instance (object instance)
Initializes and sets @value from an instantiatable type. This calls the [callback@GObject.TypeValueCollectFunc] function for the type the [struct@GObject.Value] contains. Note: The @value will be initialised with the exact type of @instance. If you wish to set the @value’s type to a different [type@GObject.Type] (such as a parent class type), you need to manually call [method@GObject.Value.init] and [method@GObject.Value.set_instance].
instance is the instance.None.peek_pointer ()
Returns the value contents as a pointer. This function asserts that [method@GObject.Value.fits_pointer] returned true for the passed in value. This is an internal function introduced mainly for C marshallers.
the value contents as a pointer.reset ()
Clears the current value in @value and resets it to the initial value (as if the value had just been initialized using [method@GObject.Value.init]).
the [struct@GObject.Value] structure that has been passed in.set_boolean (bool v_boolean)
Set the contents of a %G_TYPE_BOOLEAN #GValue to @v_boolean.
v_boolean is boolean value to be set.None.set_boxed (v_boxed)
Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed.
v_boxed is caller-owned boxed object to be duplicated for the #GValue.None.set_boxed_take_ownership (v_boxed)
This is an internal function introduced mainly for C marshallers.
v_boxed is duplicated unowned boxed value to be set.None.set_char (int v_char)
Set the contents of a %G_TYPE_CHAR #GValue to @v_char.
v_char is character value to be set.None.set_double (double v_double)
Set the contents of a %G_TYPE_DOUBLE #GValue to @v_double.
v_double is double value to be set.None.set_enum (int v_enum)
Set the contents of a %G_TYPE_ENUM #GValue to @v_enum.
v_enum is enum value to be set.None.set_flags (int v_flags)
Set the contents of a %G_TYPE_FLAGS #GValue to @v_flags.
v_flags is flags value to be set.None.set_float (double v_float)
Set the contents of a %G_TYPE_FLOAT #GValue to @v_float.
v_float is float value to be set.None.set_gtype (int v_gtype)
Set the contents of a %G_TYPE_GTYPE #GValue to @v_gtype.
v_gtype is #GType to be set.None.set_instance (instance)
Sets @value from an instantiatable type. This calls the [callback@GObject.TypeValueCollectFunc] function for the type the [struct@GObject.Value] contains.
instance is the instance.None.set_int (int v_int)
Set the contents of a %G_TYPE_INT #GValue to @v_int.
v_int is integer value to be set.None.set_int64 (int v_int64)
Set the contents of a %G_TYPE_INT64 #GValue to @v_int64.
v_int64 is 64bit integer value to be set.None.set_interned_string (string v_string)
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 g_intern_string()), and is thus not duplicated when setting the #GValue.
v_string is static string to be set.None.set_long (int v_long)
Set the contents of a %G_TYPE_LONG #GValue to @v_long.
v_long is long integer value to be set.None.set_object (object v_object)
Set the contents of a %G_TYPE_OBJECT derived #GValue to @v_object. g_value_set_object() increases the reference count of @v_object (the #GValue holds a reference to @v_object). If you do not wish to increase the reference count of the object (i.e. you wish to pass your current reference to the #GValue because you no longer need it), use g_value_take_object() instead. It is important that your #GValue holds a reference to @v_object (either its own, or one it has taken) to ensure that the object won't be destroyed while the #GValue still exists).
v_object is object value to be set.None.set_object_take_ownership (v_object)
This is an internal function introduced mainly for C marshallers.
v_object is object value to be set.None.set_param (object param)
Set the contents of a %G_TYPE_PARAM #GValue to @param.
param is the #GParamSpec to be set.None.set_param_take_ownership (object param)
This is an internal function introduced mainly for C marshallers.
param is the #GParamSpec to be set.None.set_pointer (v_pointer)
Set the contents of a pointer #GValue to @v_pointer.
v_pointer is pointer value to be set.None.set_schar (int v_char)
Set the contents of a %G_TYPE_CHAR #GValue to @v_char.
v_char is signed 8 bit integer to be set.None.set_static_boxed (v_boxed)
Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed. The boxed value is assumed to be static, and is thus not duplicated when setting the #GValue.
v_boxed is static boxed value to be set.None.set_static_string (string v_string)
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. If the the string is a canonical string, using g_value_set_interned_string() is more appropriate.
v_string is static string to be set.None.set_string (string v_string)
Set the contents of a %G_TYPE_STRING #GValue to a copy of @v_string.
v_string is caller-owned string to be duplicated for the #GValue.None.set_string_take_ownership (string v_string)
This is an internal function introduced mainly for C marshallers.
v_string is duplicated unowned string to be set.None.set_uchar (int v_uchar)
Set the contents of a %G_TYPE_UCHAR #GValue to @v_uchar.
v_uchar is unsigned character value to be set.None.set_uint (int v_uint)
Set the contents of a %G_TYPE_UINT #GValue to @v_uint.
v_uint is unsigned integer value to be set.None.set_uint64 (int v_uint64)
Set the contents of a %G_TYPE_UINT64 #GValue to @v_uint64.
v_uint64 is unsigned 64bit integer value to be set.None.set_ulong (int v_ulong)
Set the contents of a %G_TYPE_ULONG #GValue to @v_ulong.
v_ulong is unsigned long integer value to be set.None.set_variant (object variant)
Set the contents of a variant #GValue to @variant. If the variant is floating, it is consumed.
variant is a #GVariant, or %NULL.None.steal_string ()
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. The purpose of this call is to provide a way to avoid an extra copy when some object have been serialized into string through #GValue API. NOTE: for safety and compatibility purposes, if #GValue contains static string, or an interned one, this function will return a copy of the string. Otherwise the transfer notation would be ambiguous.
string content of @value; Should be freed with g_free() when no longer needed..take_boxed (v_boxed)
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.
v_boxed is duplicated unowned boxed value to be set.None.take_object (v_object)
Sets the contents of a %G_TYPE_OBJECT derived #GValue to @v_object and takes over the ownership of the caller’s reference to @v_object; the caller doesn’t have to unref it any more (i.e. the reference count of the object is not increased). If you want the #GValue to hold its own reference to @v_object, use g_value_set_object() instead.
v_object is object value to be set.None.take_param (object param)
Sets the contents of a %G_TYPE_PARAM #GValue to @param and takes over the ownership of the caller’s reference to @param; the caller doesn’t have to unref it any more.
param is the #GParamSpec to be set.None.take_string (string v_string)
Sets the contents of a %G_TYPE_STRING #GValue to @v_string.
v_string is string to take ownership of.None.take_variant (object 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). If @variant was floating then its floating reference is converted to a hard reference. If you want the #GValue to hold its own reference to @variant, use g_value_set_variant() instead. This is an internal function introduced mainly for C marshallers.
variant is a #GVariant, or %NULL.None.transform (object dest_value)
Tries to cast the contents of @src_value into a type appropriate to store in @dest_value. If a transformation is not possible, @dest_value is not modified. For example, this could transform a
G_TYPE_INTvalue into aG_TYPE_FLOATvalue. Performing transformations between value types might incur precision loss. Especially transformations into strings might reveal seemingly arbitrary results and the format of particular transformations to strings is not guaranteed over time.
dest_value is target value.true on success; false otherwise.unset ()
Clears the current value in @value (if any) and ‘unsets’ the type. This releases all resources associated with this [struct@GObject.Value]. An unset value is the same as a cleared (zero-filled) [struct@GObject.Value] structure set to
G_VALUE_INIT.
None.