Gjsify LogoGjsify Logo

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.

record

Hierarchy

  • Value

Index

Constructors

Properties

name: string

Methods

  • copy(destValue: any): void
  • Copies the value of src_value into dest_value.

    Parameters

    • destValue: any

      An initialized #GValue structure of the same type as src_value.

    Returns void

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

    Returns GObject.Object

  • dupString(): string
  • fitsPointer(): boolean
  • Determines if value will fit inside the size of a pointer value. This is an internal function introduced mainly for C marshallers.

    Returns boolean

  • getBoolean(): boolean
  • getBoxed(): object
  • getChar(): number
  • 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.

    Returns number

  • getDouble(): number
  • getEnum(): number
  • getFlags(): number
  • getFloat(): number
  • getGtype(): GType<unknown>
  • getInt(): number
  • getInt64(): number
  • getLong(): number
  • getPointer(): object
  • getSchar(): number
  • getString(): string
  • getUchar(): number
  • getUint(): number
  • getUint64(): number
  • getUlong(): number
  • init(gType: GType<unknown>): any
  • Initializes value with the default value of type.

    Parameters

    • gType: GType<unknown>

      Type the #GValue should hold values of.

    Returns any

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

    Note: The value will be initialised with the exact type of instance. If you wish to set the value's type to a different GType (such as a parent class GType), you need to manually call g_value_init() and g_value_set_instance().

    Parameters

    Returns void

  • peekPointer(): object
  • Returns the value contents as pointer. This function asserts that g_value_fits_pointer() returned %TRUE for the passed in value. This is an internal function introduced mainly for C marshallers.

    Returns object

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

    Returns any

  • setBoolean(vBoolean: boolean): void
  • Set the contents of a %G_TYPE_BOOLEAN #GValue to v_boolean.

    Parameters

    • vBoolean: boolean

      boolean value to be set

    Returns void

  • setBoxed(vBoxed: object): void
  • Set the contents of a %G_TYPE_BOXED derived #GValue to v_boxed.

    Parameters

    • vBoxed: object

      boxed value to be set

    Returns void

  • setBoxedTakeOwnership(vBoxed: object): void
  • This is an internal function introduced mainly for C marshallers.

    Parameters

    • vBoxed: object

      duplicated unowned boxed value to be set

    Returns void

  • setChar(vChar: number): void
  • Set the contents of a %G_TYPE_CHAR #GValue to v_char.

    Parameters

    • vChar: number

      character value to be set

    Returns void

  • setDouble(vDouble: number): void
  • Set the contents of a %G_TYPE_DOUBLE #GValue to v_double.

    Parameters

    • vDouble: number

      double value to be set

    Returns void

  • setEnum(vEnum: number): void
  • Set the contents of a %G_TYPE_ENUM #GValue to v_enum.

    Parameters

    • vEnum: number

      enum value to be set

    Returns void

  • setFlags(vFlags: number): void
  • Set the contents of a %G_TYPE_FLAGS #GValue to v_flags.

    Parameters

    • vFlags: number

      flags value to be set

    Returns void

  • setFloat(vFloat: number): void
  • Set the contents of a %G_TYPE_FLOAT #GValue to v_float.

    Parameters

    • vFloat: number

      float value to be set

    Returns void

  • setGtype(vGtype: GType<unknown>): void
  • Set the contents of a %G_TYPE_GTYPE #GValue to v_gtype.

    Parameters

    • vGtype: GType<unknown>

      #GType to be set

    Returns void

  • setInstance(instance: object): void
  • Sets value from an instantiatable type via the value_table's collect_value() function.

    Parameters

    • instance: object

      the instance

    Returns void

  • setInt(vInt: number): void
  • Set the contents of a %G_TYPE_INT #GValue to v_int.

    Parameters

    • vInt: number

      integer value to be set

    Returns void

  • setInt64(vInt64: number): void
  • Set the contents of a %G_TYPE_INT64 #GValue to v_int64.

    Parameters

    • vInt64: number

      64bit integer value to be set

    Returns void

  • setInternedString(vString: string): void
  • 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.

    Parameters

    • vString: string

      static string to be set

    Returns void

  • setLong(vLong: number): void
  • Set the contents of a %G_TYPE_LONG #GValue to v_long.

    Parameters

    • vLong: number

      long integer value to be set

    Returns void

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

    Parameters

    Returns void

  • Set the contents of a %G_TYPE_PARAM #GValue to param.

    Parameters

    Returns void

  • setPointer(vPointer: object): void
  • Set the contents of a pointer #GValue to v_pointer.

    Parameters

    • vPointer: object

      pointer value to be set

    Returns void

  • setSchar(vChar: number): void
  • Set the contents of a %G_TYPE_CHAR #GValue to v_char.

    Parameters

    • vChar: number

      signed 8 bit integer to be set

    Returns void

  • setStaticBoxed(vBoxed: object): void
  • 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.

    Parameters

    • vBoxed: object

      static boxed value to be set

    Returns void

  • setStaticString(vString: string): void
  • 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.

    Parameters

    • vString: string

      static string to be set

    Returns void

  • setString(vString: string): void
  • Set the contents of a %G_TYPE_STRING #GValue to a copy of v_string.

    Parameters

    • vString: string

      caller-owned string to be duplicated for the #GValue

    Returns void

  • setStringTakeOwnership(vString: string): void
  • This is an internal function introduced mainly for C marshallers.

    Parameters

    • vString: string

      duplicated unowned string to be set

    Returns void

  • setUchar(vUchar: number): void
  • Set the contents of a %G_TYPE_UCHAR #GValue to v_uchar.

    Parameters

    • vUchar: number

      unsigned character value to be set

    Returns void

  • setUint(vUint: number): void
  • Set the contents of a %G_TYPE_UINT #GValue to v_uint.

    Parameters

    • vUint: number

      unsigned integer value to be set

    Returns void

  • setUint64(vUint64: number): void
  • Set the contents of a %G_TYPE_UINT64 #GValue to v_uint64.

    Parameters

    • vUint64: number

      unsigned 64bit integer value to be set

    Returns void

  • setUlong(vUlong: number): void
  • Set the contents of a %G_TYPE_ULONG #GValue to v_ulong.

    Parameters

    • vUlong: number

      unsigned long integer value to be set

    Returns void

  • Set the contents of a variant #GValue to variant. If the variant is floating, it is consumed.

    Parameters

    Returns void

  • takeBoxed(vBoxed: object): void
  • 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.

    Parameters

    • vBoxed: object

      duplicated unowned boxed value to be set

    Returns void

  • takeString(vString: string): void
  • Sets the contents of a %G_TYPE_STRING #GValue to v_string.

    Parameters

    • vString: string

      string to take ownership of

    Returns void

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

    Parameters

    Returns void

  • transform(destValue: any): boolean
  • 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).

    Parameters

    • destValue: any

      Target value.

    Returns boolean

  • unset(): void
  • 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 structure.

    Returns void

  • typeCompatible(srcType: GType<unknown>, destType: GType<unknown>): boolean
  • Returns whether a #GValue of type src_type can be copied into a #GValue of type dest_type.

    Parameters

    • srcType: GType<unknown>

      source type to be copied.

    • destType: GType<unknown>

      destination type for copying.

    Returns boolean

  • typeTransformable(srcType: GType<unknown>, destType: GType<unknown>): boolean
  • Check whether g_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.

    Parameters

    • srcType: GType<unknown>

      Source type.

    • destType: GType<unknown>

      Target type.

    Returns boolean

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method