Copies the value of src_value into dest_value.
an initialized GObject.Value structure of the same type as src_value
Get the contents of a G_TYPE_OBJECT derived GObject.Value, increasing
its reference count. If the contents of the GObject.Value are null, then
null will be returned.
object content of value, should be unreferenced when no longer needed.
Get a copy the contents of a G_TYPE_STRING GObject.Value.
a newly allocated copy of the string content of value
Get the contents of a variant GObject.Value, increasing its refcount. The returned GLib.Variant is never floating.
variant contents of value (may be null); should be unreffed using g_variant_unref() when no longer needed
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
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 GObject.Value.
character contents of value
Get the contents of a G_TYPE_OBJECT derived GObject.Value.
object contents of value
Get the contents of a G_TYPE_PARAM GObject.Value.
GObject.ParamSpec content of value
Get the contents of a G_TYPE_CHAR GObject.Value.
signed 8 bit integer contents of value
Get the contents of a G_TYPE_UCHAR GObject.Value.
unsigned character contents of value
Get the contents of a G_TYPE_UINT64 GObject.Value.
unsigned 64bit integer contents of value
Get the contents of a G_TYPE_ULONG GObject.Value.
unsigned long integer contents of value
Get the contents of a variant GObject.Value.
variant contents of value (may be null)
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 GObject.Value, so the value knows what type it’s meant to store.
GValue value = G_VALUE_INIT;
g_value_init (&value, SOME_G_TYPE);
…
g_value_unset (&value);
type the GObject.Value should hold values of
the GObject.Value structure that has been passed in
Initializes and sets value from an instantiatable type.
This calls the GObject.TypeValueCollectFunc function for the type the 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
GObject.Type (such as a parent class type), you need to manually call
GObject.Value.init and GObject.Value.set_instance.
the instance
Returns the value contents as a pointer.
This function asserts that 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
Clears the current value in value and resets it to the initial value
(as if the value had just been initialized using
GObject.Value.init).
the GObject.Value structure that has been passed in
Set the contents of a G_TYPE_BOOLEAN GObject.Value to v_boolean.
boolean value to be set
Set the contents of a G_TYPE_BOXED derived GObject.Value to v_boxed.
Optionalv_boxed: anycaller-owned boxed object to be duplicated for the GObject.Value
This is an internal function introduced mainly for C marshallers.
Optionalv_boxed: anyduplicated unowned boxed value to be set
Set the contents of a G_TYPE_CHAR GObject.Value to v_char.
character value to be set
Set the contents of a G_TYPE_DOUBLE GObject.Value to v_double.
double value to be set
Set the contents of a G_TYPE_ENUM GObject.Value to v_enum.
enum value to be set
Set the contents of a G_TYPE_FLAGS GObject.Value to v_flags.
flags value to be set
Set the contents of a G_TYPE_FLOAT GObject.Value to v_float.
float value to be set
Set the contents of a G_TYPE_GTYPE GObject.Value to v_gtype.
GObject.GType to be set
Sets value from an instantiatable type.
This calls the GObject.TypeValueCollectFunc function for the type the GObject.Value contains.
Optionalinstance: anythe instance
Set the contents of a G_TYPE_INT GObject.Value to v_int.
integer value to be set
Set the contents of a G_TYPE_INT64 GObject.Value to v_int64.
64bit integer value to be set
Set the contents of a G_TYPE_STRING GObject.Value 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 GObject.Value.
Optionalv_string: stringstatic string to be set
Set the contents of a G_TYPE_LONG GObject.Value to v_long.
long integer value to be set
Set the contents of a G_TYPE_OBJECT derived GObject.Value to v_object.
g_value_set_object() increases the reference count of v_object
(the GObject.Value 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 GObject.Value because you no longer
need it), use g_value_take_object() instead.
It is important that your GObject.Value 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 GObject.Value still exists).
Set the contents of a G_TYPE_PARAM GObject.Value to param.
Optionalparam: GObject.ParamSpec<unknown>the GObject.ParamSpec to be set
Set the contents of a pointer GObject.Value to v_pointer.
Optionalv_pointer: anypointer value to be set
Set the contents of a G_TYPE_CHAR GObject.Value to v_char.
signed 8 bit integer to be set
Set the contents of a G_TYPE_BOXED derived GObject.Value to v_boxed.
The boxed value is assumed to be static, and is thus not duplicated when setting the GObject.Value.
Optionalv_boxed: anystatic boxed value to be set
Set the contents of a G_TYPE_STRING GObject.Value to v_string.
The string is assumed to be static, and is thus not duplicated
when setting the GObject.Value.
If the the string is a canonical string, using g_value_set_interned_string()
is more appropriate.
Optionalv_string: stringstatic string to be set
Set the contents of a G_TYPE_STRING GObject.Value to a copy of v_string.
Optionalv_string: stringcaller-owned string to be duplicated for the GObject.Value
This is an internal function introduced mainly for C marshallers.
Optionalv_string: stringduplicated unowned string to be set
Set the contents of a G_TYPE_UCHAR GObject.Value to v_uchar.
unsigned character value to be set
Set the contents of a G_TYPE_UINT GObject.Value to v_uint.
unsigned integer value to be set
Set the contents of a G_TYPE_UINT64 GObject.Value to v_uint64.
unsigned 64bit integer value to be set
Set the contents of a G_TYPE_ULONG GObject.Value to v_ulong.
unsigned long integer value to be set
Set the contents of a variant GObject.Value to variant.
If the variant is floating, it is consumed.
Optionalvariant: GLib.Variant<any>a GLib.Variant, or null
Steal ownership on contents of a G_TYPE_STRING GObject.Value.
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 GObject.Value API.
NOTE: for safety and compatibility purposes, if GObject.Value 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.
Sets the contents of a G_TYPE_BOXED derived GObject.Value 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.
Optionalv_boxed: anyduplicated unowned boxed value to be set
Sets the contents of a G_TYPE_STRING GObject.Value to v_string.
Optionalv_string: stringstring to take ownership of
Set the contents of a variant GObject.Value 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 GObject.Value to hold its own reference to variant, use
g_value_set_variant() instead.
This is an internal function introduced mainly for C marshallers.
Optionalvariant: GLib.Variant<any>a GLib.Variant, or null
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_INT value into a G_TYPE_FLOAT
value.
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.
target value
true on success; false otherwise
Clears the current value in value (if any) and ‘unsets’ the type.
This releases all resources associated with this GObject.Value. An
unset value is the same as a cleared (zero-filled)
GObject.Value structure set to G_VALUE_INIT.
Statictype_Checks whether a GObject.Value.copy is able to copy values of type
src_type into values of type dest_type.
Statictype_Checks whether GObject.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 using GObject.Value.register_transform_func.
An opaque structure used to hold different types of values.
Before it can be used, a GObject.Value has to be initialized to a specific type by calling GObject.Value.init on it.
Many types which are stored within a GObject.Value need to allocate data on the heap, so GObject.Value.unset must always be called on a GObject.Value to free any such data once you’re finished with the GObject.Value, even if the GObject.Value itself is stored on the stack.
The data within the structure has protected scope: it is accessible only to functions within a GObject.TypeValueTable structure, or implementations of the
g_value_*()API. That is, code which implements new fundamental types.GObject.Value users cannot make any assumptions about how data is stored within the 2 element
dataunion, and theg_typemember should only be accessed through the GObject.VALUE_TYPE macro and related macros.