Grl.RelatedKeys

g GObject.Object GObject.Object Grl.RelatedKeys Grl.RelatedKeys GObject.Object->Grl.RelatedKeys

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

dup ()

get (key)

get_binary (key)

get_boolean (key)

get_boxed (key)

get_float (key)

get_int (key)

get_int64 (key)

get_keys ()

get_string (key)

has_key (key)

remove (key)

set (key, value)

set_binary (key, buf, size)

set_boolean (key, booleanvalue)

set_boxed (key, boxed)

set_float (key, floatvalue)

set_for_id (key_name, value)

set_int (key, intvalue)

set_int64 (key, intvalue)

set_string (key, strvalue)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Grl.RelatedKeys(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Grl.RelatedKeysClass

classmethod new()
Returns:

a new object.

Return type:

Grl.RelatedKeys

Creates a new Grl.RelatedKeys instance that can be used to store related keys and their values.

New in version 0.1.10.

dup()
Returns:

a new Grl.RelatedKeys. Free it with GObject.Object.unref.

Return type:

Grl.RelatedKeys

Makes a deep copy of self and its contents.

New in version 0.1.10.

get(key)
Parameters:

key (int) – key to look up.

Returns:

a GObject.Value. This value should not be modified nor freed by user.

Return type:

GObject.Value

Get the value associated with key from self. If it does not contain any value, None will be returned.

New in version 0.1.10.

get_binary(key)
Parameters:

key (int) – key to use

Returns:

buffer location associated with key, or None in other case. If successful size will be set to the buffer size.

size:

location to store the buffer size

Return type:

(int, size: int)

Returns the value associated with key from self. If key has no value, or value is not a binary, or key is not in self, then 0 is returned.

New in version 0.1.10.

get_boolean(key)
Parameters:

key (int) – key to use

Returns:

float value associated with key, or False in other case.

Return type:

bool

Returns the value associated with key from self. If key has no value, or value is not a bool, or key is not in self, then False is returned.

New in version 0.2.3.

get_boxed(key)
Parameters:

key (int) – key to use

Returns:

the GObject.GBoxed value associated with key if possible, or None in other case. The caller should not change nor free the value.

Return type:

object or None

Returns the value associated with key from self. If key has no value, the value is not of a boxed type, or key is not in self, then None is returned.

New in version 0.2.0.

get_float(key)
Parameters:

key (int) – key to use

Returns:

float value associated with key, or 0 in other case.

Return type:

float

Returns the value associated with key from self. If key has no value, or value is not a float, or key is not in self, then 0 is returned.

New in version 0.1.10.

get_int(key)
Parameters:

key (int) – key to use

Returns:

int value associated with key, or 0 in other case.

Return type:

int

Returns the value associated with key from self. If key has no value, or value is not a int, or key is not in self, then 0 is returned.

New in version 0.1.10.

get_int64(key)
Parameters:

key (int) – key to use

Returns:

int64 value associated with key, or 0 in other case.

Return type:

int

Returns the value associated with key from self. If key has no value, or value is not a gint64, or key is not in self, then 0 is returned.

New in version 0.2.12.

get_keys()
Returns:

a list with the keys. The content of the list should not be modified or freed. Use g_list_free() when done using the list.

Return type:

[int]

Returns a list with keys contained in self.

New in version 0.1.13.

get_string(key)
Parameters:

key (int) – key to use

Returns:

string associated with key, or None in other case. Caller should not change nor free the value.

Return type:

str

Returns the value associated with key from self. If key has no value, or value is not string, or key is not in self, then None is returned.

New in version 0.1.10.

has_key(key)
Parameters:

key (int) – key to search

Returns:

True if key is in self, False in other case.

Return type:

bool

Checks if key is in self.

New in version 0.1.10.

remove(key)
Parameters:

key (int) – key to remove

Removes key from self set.

New in version 0.2.3.

set(key, value)
Parameters:

Sets the value associated with key into self. Old value is freed and the new one is set.

Also, checks that value is compliant with key specification, modifying it accordingly. For instance, if key requires a number between 0 and 10, but value is outside this range, it will be adapted accordingly.

New in version 0.1.10.

set_binary(key, buf, size)
Parameters:
  • key (int) – key to change or add

  • buf (int) – buffer holding the relkeys

  • size (int) – size of the buffer

Sets the value associated with key into self. key must have been registered as a binary-type key. Old value is replaced by the new one.

New in version 0.1.10.

set_boolean(key, booleanvalue)
Parameters:
  • key (int) – key to change or add

  • booleanvalue (bool) – the new value

Sets the value associated with key into self. key must have been registered as a boolean-type key. Old value is replaced by the new one.

New in version 0.2.3.

set_boxed(key, boxed)
Parameters:
  • key (int) – key to change or add

  • boxed (object or None) – the new value

Sets the value associated with key into self. key must have been registered as a boxed-type key. Old value is freed and the new one is set.

New in version 0.2.0.

set_float(key, floatvalue)
Parameters:
  • key (int) – key to change or add

  • floatvalue (float) – the new value

Sets the value associated with key into self. key must have been registered as a float-type key. Old value is replaced by the new one.

New in version 0.1.10.

set_for_id(key_name, value)
Parameters:
  • key_name (str) – name of the key to change or add

  • value (GObject.Value) – the new value

Returns:

True if value was set to key_name, False otherwise.

Return type:

bool

Sets the value associated with key_name in self. This key_name is used to create a new GObject.ParamSpec instance, which is further used to create and register a key using Grl.Registry.register_metadata_key(). If key_name already has a value, old value is replaced by the new one.

A property key_name consists of segments consisting of ASCII letters and digits, separated by either the ‘-’ or ‘_’ character. The first character of a property key_name must be a letter. Key_names which violate these rules lead to undefined behaviour.

New in version 0.3.13.

set_int(key, intvalue)
Parameters:
  • key (int) – key to change or add

  • intvalue (int) – the new value

Sets the value associated with key into self. key must have been registered as an int-type key. Old value is replaced by the new one.

New in version 0.1.10.

set_int64(key, intvalue)
Parameters:
  • key (int) – key to change or add

  • intvalue (int) – the new value

Sets the value associated with key into self. key must have been registered as a int64-type key. Old value is replaced by the new one.

New in version 0.2.12.

set_string(key, strvalue)
Parameters:
  • key (int) – key to change or add

  • strvalue (str) – the new value

Sets the value associated with key into self. key must have been registered as a strying-type key. Old value is freed and the new one is set.

New in version 0.1.10.