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. gobject.Value 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 {
protected
bool ownedRef;
}

Constructors

this
this(GValue* gValue, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()
this
this(GOBJECT obj)
this
this(string value)
this
this(BOOL value)
this
this(CHAR value)
this
this(INT value)
this
this(FLOAT value)

Members

Functions

copy
void copy(Value destValue)

Copies the value of src_value into dest_value.

dupBoxed
void* dupBoxed()

Get the contents of a G_TYPE_BOXED derived gobject.Value 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);

dupObject
ObjectG dupObject()

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.

dupParam
ParamSpec dupParam()

Get the contents of a G_TYPE_PARAM gobject.Value, increasing its reference count.

dupString
string dupString()

Get a copy the contents of a G_TYPE_STRING gobject.Value

dupVariant
Variant dupVariant()

Get the contents of a variant gobject.Value, increasing its refcount. The returned glib.Variant 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
TYPE get()

Retrieves a TYPE from Value, the Value must contain the appropriate type.

getBoolean
bool getBoolean()

Get the contents of a G_TYPE_BOOLEAN gobject.Value

getBoxed
void* getBoxed()

Get the contents of a G_TYPE_BOXED derived gobject.Value

getChar
char getChar()

Do not use this function; it is broken on platforms where the char type is unsigned, such as ARM and PowerPC. See Value.getSchar.

getDouble
double getDouble()

Get the contents of a G_TYPE_DOUBLE gobject.Value

getEnum
int getEnum()

Get the contents of a G_TYPE_ENUM gobject.Value

getFlags
uint getFlags()

Get the contents of a G_TYPE_FLAGS gobject.Value

getFloat
float getFloat()

Get the contents of a G_TYPE_FLOAT gobject.Value

getGtype
GType getGtype()

Get the contents of a G_TYPE_GTYPE gobject.Value

getInt
int getInt()

Get the contents of a G_TYPE_INT gobject.Value

getInt64
long getInt64()

Get the contents of a G_TYPE_INT64 gobject.Value

getLong
glong getLong()

Get the contents of a G_TYPE_LONG gobject.Value

getObject
ObjectG getObject()

Get the contents of a G_TYPE_OBJECT derived gobject.Value

getParam
ParamSpec getParam()

Get the contents of a G_TYPE_PARAM gobject.Value

getPointer
void* getPointer()

Get the contents of a pointer gobject.Value

getSchar
byte getSchar()

Get the contents of a G_TYPE_CHAR gobject.Value

getString
string getString()

Get the contents of a G_TYPE_STRING gobject.Value

getStruct
void* getStruct()

the main Gtk struct as a void*

getUchar
char getUchar()

Get the contents of a G_TYPE_UCHAR gobject.Value

getUint
uint getUint()

Get the contents of a G_TYPE_UINT gobject.Value

getUint64
ulong getUint64()

Get the contents of a G_TYPE_UINT64 gobject.Value

getUlong
gulong getUlong()

Get the contents of a G_TYPE_ULONG gobject.Value

getValueStruct
GValue* getValueStruct(bool transferOwnership)

Get the main Gtk struct

getVariant
Variant getVariant()

Get the contents of a variant gobject.Value

init
Value init(GType gType)

Initializes value with the default value of type.

initFromInstance
void initFromInstance(TypeInstance instance_)

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

peekPointer
void* peekPointer()

Returns the value contents as pointer. This function asserts that Value.fitsPointer returned TRUE for the passed in value. This is an internal function introduced mainly for C marshallers.

reset
Value reset()

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

setBoolean
void setBoolean(bool vBoolean)

Set the contents of a G_TYPE_BOOLEAN gobject.Value to v_boolean.

setBoxed
void setBoxed(void* vBoxed)

Set the contents of a G_TYPE_BOXED derived gobject.Value to v_boxed.

setBoxedTakeOwnership
void setBoxedTakeOwnership(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 gobject.Value to v_char.

setDouble
void setDouble(double vDouble)

Set the contents of a G_TYPE_DOUBLE gobject.Value to v_double.

setEnum
void setEnum(int vEnum)

Set the contents of a G_TYPE_ENUM gobject.Value to v_enum.

setFlags
void setFlags(uint vFlags)

Set the contents of a G_TYPE_FLAGS gobject.Value to v_flags.

setFloat
void setFloat(float vFloat)

Set the contents of a G_TYPE_FLOAT gobject.Value to v_float.

setGtype
void setGtype(GType vGtype)

Set the contents of a G_TYPE_GTYPE gobject.Value 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 gobject.Value to v_int.

setInt64
void setInt64(long vInt64)

Set the contents of a G_TYPE_INT64 gobject.Value to v_int64.

setLong
void setLong(glong vLong)

Set the contents of a G_TYPE_LONG gobject.Value to v_long.

setObject
void setObject(ObjectG vObject)

Set the contents of a G_TYPE_OBJECT derived gobject.Value to v_object.

setObjectTakeOwnership
void setObjectTakeOwnership(void* vObject)

This is an internal function introduced mainly for C marshallers.

setParam
void setParam(ParamSpec param)

Set the contents of a G_TYPE_PARAM gobject.Value to param.

setParamTakeOwnership
void setParamTakeOwnership(ParamSpec param)

This is an internal function introduced mainly for C marshallers.

setPointer
void setPointer(void* vPointer)

Set the contents of a pointer gobject.Value to v_pointer.

setSchar
void setSchar(byte vChar)

Set the contents of a G_TYPE_CHAR gobject.Value to v_char.

setStaticBoxed
void setStaticBoxed(void* vBoxed)

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

setStaticString
void setStaticString(string vString)

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

setString
void setString(string vString)

Set the contents of a G_TYPE_STRING gobject.Value to v_string.

setStringTakeOwnership
void setStringTakeOwnership(string vString)

This is an internal function introduced mainly for C marshallers.

setUchar
void setUchar(char vUchar)

Set the contents of a G_TYPE_UCHAR gobject.Value to v_uchar.

setUint
void setUint(uint vUint)

Set the contents of a G_TYPE_UINT gobject.Value to v_uint.

setUint64
void setUint64(ulong vUint64)

Set the contents of a G_TYPE_UINT64 gobject.Value to v_uint64.

setUlong
void setUlong(gulong vUlong)

Set the contents of a G_TYPE_ULONG gobject.Value to v_ulong.

setVariant
void setVariant(Variant variant)

Set the contents of a variant gobject.Value to variant. If the variant is floating, it is consumed.

takeBoxed
void takeBoxed(void* vBoxed)

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.

takeObject
void takeObject(void* vObject)

Sets the contents of a G_TYPE_OBJECT derived gobject.Value 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).

takeParam
void takeParam(ParamSpec param)

Sets the contents of a G_TYPE_PARAM gobject.Value to param and takes over the ownership of the caller’s reference to param; the caller doesn’t have to unref it any more.

takeString
void takeString(string vString)

Sets the contents of a G_TYPE_STRING gobject.Value to v_string.

takeVariant
void takeVariant(Variant variant)

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

transform
bool transform(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) gobject.Value structure.

Properties

gType
GType gType [@property getter]

The GType of the contianed value.

Static functions

getType
GType getType()
paramSpecBoolean
ParamSpec paramSpecBoolean(string name, string nick, string blurb, bool defaultValue, GParamFlags flags)

Creates a new GParamSpecBoolean instance specifying a G_TYPE_BOOLEAN property. In many cases, it may be more appropriate to use an enum with ParamSpec.enum, both to improve code clarity by using explicitly named values, and to allow for more values to be added in future without breaking API.

paramSpecBoxed
ParamSpec paramSpecBoxed(string name, string nick, string blurb, GType boxedType, GParamFlags flags)

Creates a new GParamSpecBoxed instance specifying a G_TYPE_BOXED derived property.

paramSpecChar
ParamSpec paramSpecChar(string name, string nick, string blurb, byte minimum, byte maximum, byte defaultValue, GParamFlags flags)

Creates a new GParamSpecChar instance specifying a G_TYPE_CHAR property.

paramSpecDouble
ParamSpec paramSpecDouble(string name, string nick, string blurb, double minimum, double maximum, double defaultValue, GParamFlags flags)

Creates a new GParamSpecDouble instance specifying a G_TYPE_DOUBLE property.

paramSpecEnum
ParamSpec paramSpecEnum(string name, string nick, string blurb, GType enumType, int defaultValue, GParamFlags flags)

Creates a new GParamSpecEnum instance specifying a G_TYPE_ENUM property.

paramSpecFlags
ParamSpec paramSpecFlags(string name, string nick, string blurb, GType flagsType, uint defaultValue, GParamFlags flags)

Creates a new GParamSpecFlags instance specifying a G_TYPE_FLAGS property.

paramSpecFloat
ParamSpec paramSpecFloat(string name, string nick, string blurb, float minimum, float maximum, float defaultValue, GParamFlags flags)

Creates a new GParamSpecFloat instance specifying a G_TYPE_FLOAT property.

paramSpecGtype
ParamSpec paramSpecGtype(string name, string nick, string blurb, GType isAType, GParamFlags flags)

Creates a new GParamSpecGType instance specifying a G_TYPE_GTYPE property.

paramSpecInt
ParamSpec paramSpecInt(string name, string nick, string blurb, int minimum, int maximum, int defaultValue, GParamFlags flags)

Creates a new GParamSpecInt instance specifying a G_TYPE_INT property.

paramSpecInt64
ParamSpec paramSpecInt64(string name, string nick, string blurb, long minimum, long maximum, long defaultValue, GParamFlags flags)

Creates a new GParamSpecInt64 instance specifying a G_TYPE_INT64 property.

paramSpecLong
ParamSpec paramSpecLong(string name, string nick, string blurb, glong minimum, glong maximum, glong defaultValue, GParamFlags flags)

Creates a new GParamSpecLong instance specifying a G_TYPE_LONG property.

paramSpecObject
ParamSpec paramSpecObject(string name, string nick, string blurb, GType objectType, GParamFlags flags)

Creates a new GParamSpecBoxed instance specifying a G_TYPE_OBJECT derived property.

paramSpecOverride
ParamSpec paramSpecOverride(string name, ParamSpec overridden)

Creates a new property of type GParamSpecOverride This is used to direct operations to another paramspec, and will not be directly useful unless you are implementing a new base type similar to GObject.

paramSpecParam
ParamSpec paramSpecParam(string name, string nick, string blurb, GType paramType, GParamFlags flags)

Creates a new GParamSpecParam instance specifying a G_TYPE_PARAM property.

paramSpecPointer
ParamSpec paramSpecPointer(string name, string nick, string blurb, GParamFlags flags)

Creates a new GParamSpecPointer instance specifying a pointer property. Where possible, it is better to use ParamSpec.object or ParamSpec.boxed to expose memory management information.

paramSpecString
ParamSpec paramSpecString(string name, string nick, string blurb, string defaultValue, GParamFlags flags)

Creates a new GParamSpecString instance.

paramSpecUchar
ParamSpec paramSpecUchar(string name, string nick, string blurb, ubyte minimum, ubyte maximum, ubyte defaultValue, GParamFlags flags)

Creates a new GParamSpecUChar instance specifying a G_TYPE_UCHAR property.

paramSpecUint
ParamSpec paramSpecUint(string name, string nick, string blurb, uint minimum, uint maximum, uint defaultValue, GParamFlags flags)

Creates a new GParamSpecUInt instance specifying a G_TYPE_UINT property.

paramSpecUint64
ParamSpec paramSpecUint64(string name, string nick, string blurb, ulong minimum, ulong maximum, ulong defaultValue, GParamFlags flags)

Creates a new GParamSpecUInt64 instance specifying a G_TYPE_UINT64 property.

paramSpecUlong
ParamSpec paramSpecUlong(string name, string nick, string blurb, gulong minimum, gulong maximum, gulong defaultValue, GParamFlags flags)

Creates a new GParamSpecULong instance specifying a G_TYPE_ULONG property.

paramSpecUnichar
ParamSpec paramSpecUnichar(string name, string nick, string blurb, dchar defaultValue, GParamFlags flags)

Creates a new GParamSpecUnichar instance specifying a G_TYPE_UINT property. gobject.Value structures for this property can be accessed with Value.setUint and Value.getUint.

paramSpecValueArray
ParamSpec paramSpecValueArray(string name, string nick, string blurb, ParamSpec elementSpec, GParamFlags flags)

Creates a new GParamSpecValueArray instance specifying a G_TYPE_VALUE_ARRAY property. G_TYPE_VALUE_ARRAY is a G_TYPE_BOXED type, as such, gobject.Value structures for this property can be accessed with Value.setBoxed and Value.getBoxed.

paramSpecVariant
ParamSpec paramSpecVariant(string name, string nick, string blurb, VariantType type, Variant defaultValue, GParamFlags flags)

Creates a new GParamSpecVariant instance specifying a glib.Variant property.

registerTransformFunc
void registerTransformFunc(GType srcType, GType destType, GValueTransform transformFunc)

Registers a value transformation function for use in Value.transform. A previously registered transformation function for src_type and dest_type will be replaced.

strdupValueContents
string strdupValueContents(Value value)

Return a newly allocated string, which describes the contents of a gobject.Value The main purpose of this function is to describe gobject.Value contents for debugging output, the way in which the contents are described may change between different GLib versions.

typeCompatible
bool typeCompatible(GType srcType, GType destType)

Returns whether a gobject.Value of type src_type can be copied into a gobject.Value of type dest_type.

typeTransformable
bool typeTransformable(GType srcType, GType destType)

Check whether 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.

Variables

gValue
GValue* gValue;

the main Gtk struct