package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Gobject.ValueSource

Sourcetype t = g_value
Sourceval create : g_type -> t

Create and initialize a GValue with the given type

Sourceval create_empty : unit -> t

Create an uninitialized GValue

Sourceval init : t -> g_type -> unit

Initialize a GValue with a type

Sourceval reset : t -> unit

Reset a GValue (clear and reinitialize)

Sourceval get_type : t -> g_type

Get the type of a GValue

Type-specific getters/setters

Sourceval get_int : t -> int
Sourceval set_int : t -> int -> unit
Sourceval get_uint : t -> int
Sourceval set_uint : t -> int -> unit
Sourceval get_boolean : t -> bool
Sourceval set_boolean : t -> bool -> unit
Sourceval get_string : t -> string
Sourceval set_string : t -> string -> unit
Sourceval get_float : t -> float
Sourceval set_float : t -> float -> unit
Sourceval get_double : t -> float
Sourceval set_double : t -> float -> unit
Sourceval get_int64 : t -> int64

Get a 64-bit integer from a GValue of G_TYPE_INT64.

Sourceval set_int64 : t -> int64 -> unit

Set a 64-bit integer on a GValue of G_TYPE_INT64.

Sourceval get_variant : t -> Gvariant.t

Get a GVariant from a GValue of G_TYPE_VARIANT. The returned value is a new reference (ref-counted); the caller may use it freely and the OCaml GC will unref it when the value is collected.

Sourceval set_variant : t -> Gvariant.t -> unit

Set a GVariant on a GValue of G_TYPE_VARIANT. Transfer-none: the GValue takes its own reference.

Sourceval get_enum_int : t -> int

Get the raw integer value of a GValue holding an enum type. Raises Invalid_argument if the GValue does not hold an enum type.

Sourceval set_enum_int : t -> int -> unit

Set the raw integer value of a GValue holding an enum type. Raises Invalid_argument if the GValue does not hold an enum type.

Sourceval get_flags_int : t -> int

Get the raw integer bitmask of a GValue holding a flags type. Raises Invalid_argument if the GValue does not hold a flags type.

Sourceval set_flags_int : t -> int -> unit

Set the raw integer bitmask of a GValue holding a flags type. Raises Invalid_argument if the GValue does not hold a flags type.

Sourceval get_boxed : t -> 'a obj

Get a boxed GIR record from a GValue holding a boxed GType. Returns a gir_record custom block (ocgtk_gir_record_ops) carrying the GType and an owned copy of the boxed data (g_boxed_copy was called). The existing gir_record finalizer calls g_boxed_free when the block is collected. The caller must ascribe the correct record type at the call site, e.g. (Gobject.Value.get_boxed v : Gtk.Tree_iter.t). Raises Invalid_argument if the GValue does not hold a boxed type.

Sourceval set_boxed : t -> 'a obj -> unit

Set a boxed GIR record on a GValue holding a boxed GType. The argument must be a gir_record custom block created by the ocgtk GIR record infrastructure and backed by a registered boxed GType (i.e. G_TYPE_IS_BOXED(type) must be true for the record's GType). Passing a plain non-boxed GIR record yields type confusion at GValue finalization because g_value_set_boxed will call g_boxed_copy and g_boxed_free internally using the GType stored in the GValue, not the record's own type. Transfer-none: the GValue copies the data via g_boxed_copy internally. The caller must ascribe the correct record type at the call site.

Sourceval get_object : t -> 'a obj option
Sourceval set_object : t -> 'a obj option -> unit
Sourceval get_object_exn : t -> 'a obj

Get a GObject from a GValue, raising Failure if the value is NULL. Use this when the GIR declares the parameter non-nullable.

Sourceval set_object_exn : t -> 'a obj -> unit

Set a non-nullable GObject on a GValue.