Json.Serializable

g GObject.GInterface GObject.GInterface Json.Serializable Json.Serializable GObject.GInterface->Json.Serializable

Implementations:
 None

Methods

  default_deserialize_property (property_name, value, pspec, property_node)
  default_serialize_property (property_name, value, pspec)
  deserialize_property (property_name, pspec, property_node)
  find_property (name)
  get_property (pspec)
  list_properties ()
  serialize_property (property_name, value, pspec)
  set_property (pspec, value)

Virtual Methods

  do_deserialize_property (property_name, pspec, property_node)
  do_find_property (name)
  do_get_property (pspec)
  do_serialize_property (property_name, value, pspec)
  do_set_property (pspec, value)

Properties

None

Signals

None

Fields

None

Class Details

class Json.Serializable
Bases:GObject.GInterface
Structure:Json.SerializableIface
default_deserialize_property(property_name, value, pspec, property_node)
Parameters:
Returns:

True if the property was successfully deserialized.

Return type:

bool

Calls the default implementation of the Json.Serializable deserialize_property() virtual function

This function can be used inside a custom implementation of the deserialize_property() virtual function in lieu of:

JsonSerializable *iface;
gboolean res;

iface = g_type_default_interface_peek (JSON_TYPE_SERIALIZABLE);
res = iface->deserialize_property (serializable, property_name,
                                   value,
                                   pspec,
                                   property_node);

New in version 0.10.

default_serialize_property(property_name, value, pspec)
Parameters:
Returns:

a Json.Node containing the serialized property, or None if it should be omitted.

Return type:

Json.Node or None

Calls the default implementation of the Json.Serializable Json.Serializable.do_serialize_property() virtual function.

This function can be used inside a custom implementation of the Json.Serializable.do_serialize_property() virtual function in lieu of calling the default implementation through GObject.type_default_interface_peek():

JsonSerializable *iface;
JsonNode *node;

iface = g_type_default_interface_peek (JSON_TYPE_SERIALIZABLE);
node = iface->serialize_property (serializable, property_name,
                                  value,
                                  pspec);

New in version 0.10.

deserialize_property(property_name, pspec, property_node)
Parameters:
Returns:

True if the property was successfully deserialized.

value:a pointer to an uninitialized GObject.Value

Return type:

(bool, value: GObject.Value)

Asks a Json.Serializable implementation to deserialize the property contained inside property_node into value.

The value can be:

  • an empty GObject.Value initialized by %G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since JSON-GLib 1.6)
  • a GObject.Value initialized with the expected type of the property
find_property(name)
Parameters:name (str) – the name of the property
Returns:the GObject.ParamSpec for the property or None if no property was found
Return type:GObject.ParamSpec or None

Calls the Json.Serializable.do_find_property() implementation on the self instance. *

New in version 0.14.

get_property(pspec)
Parameters:pspec (GObject.ParamSpec) – a GObject.ParamSpec
Returns:return location for the property value
Return type:value: GObject.Value

Calls the Json.Serializable.do_get_property() implementation on the self instance.

New in version 0.14.

list_properties()
Returns:an array of GObject.ParamSpec. Use GLib.free() to free the array when done.
Return type:[GObject.ParamSpec]

Calls the Json.Serializable.do_list_properties() implementation on the self instance.

New in version 0.14.

serialize_property(property_name, value, pspec)
Parameters:
Returns:

a Json.Node containing the serialized property

Return type:

Json.Node

Asks a Json.Serializable implementation to serialize a GObject.Object property into a Json.Node object.

set_property(pspec, value)
Parameters:

Calls the Json.Serializable.do_set_property() implementation on the self instance.

New in version 0.14.

do_deserialize_property(property_name, pspec, property_node) virtual
Parameters:
Returns:

True if the property was successfully deserialized.

value:a pointer to an uninitialized GObject.Value

Return type:

(bool, value: GObject.Value)

Asks a Json.Serializable implementation to deserialize the property contained inside property_node into value.

The value can be:

  • an empty GObject.Value initialized by %G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since JSON-GLib 1.6)
  • a GObject.Value initialized with the expected type of the property
do_find_property(name) virtual
Parameters:name (str) – the name of the property
Returns:the GObject.ParamSpec for the property or None if no property was found
Return type:GObject.ParamSpec or None

Calls the Json.Serializable.do_find_property() implementation on the serializable instance. *

New in version 0.14.

do_get_property(pspec) virtual
Parameters:pspec (GObject.ParamSpec) – a GObject.ParamSpec
Returns:return location for the property value
Return type:value: GObject.Value

Calls the Json.Serializable.do_get_property() implementation on the serializable instance.

New in version 0.14.

do_serialize_property(property_name, value, pspec) virtual
Parameters:
Returns:

a Json.Node containing the serialized property

Return type:

Json.Node

Asks a Json.Serializable implementation to serialize a GObject.Object property into a Json.Node object.

do_set_property(pspec, value) virtual
Parameters:

Calls the Json.Serializable.do_set_property() implementation on the serializable instance.

New in version 0.14.