Dee.Serializable

g Dee.Serializable Dee.Serializable GObject.GInterface GObject.GInterface GObject.GInterface->Dee.Serializable

Implementations:

Dee.SerializableModel

Methods

class

parse (data, type)

class

parse_external (data)

externalize ()

serialize ()

Virtual Methods

do_serialize ()

Properties

None

Signals

None

Fields

None

Class Details

class Dee.Serializable
Bases:

GObject.GInterface

Structure:

Dee.SerializableIface

classmethod parse(data, type)
Parameters:
Returns:

A newly constructed GObject.Object build from data or None in case no parser has been registered for the given GObject.GType or variant signature. Free with GObject.Object.unref().

Return type:

GObject.Object

Reconstruct a Dee.Serializable from GLib.Variant data. For this function to work you need to register a parser with dee_serializable_register_parser(). Any native Dee class will do so automatically.

This method only works on data created with Dee.Serializable.serialize() and not with data from Dee.Serializable.externalize().

Since a Dee.SerializableParseFunc is not allowed to fail - by contract - it can be guaranteed that this function only returns None in case there is no known parser for type and GLib.Variant signature of data.

classmethod parse_external(data)
Parameters:

data (GLib.Variant) – The GLib.Variant data to parse

Returns:

A newly constructed GObject.Object build from data or None in case no parser has been registered for the given GObject.GType or variant signature. Free with GObject.Object.unref().

Return type:

GObject.Object

Reconstruct a Dee.Serializable from GLib.Variant data. For this function to work you need to register a parser with dee_serializable_register_parser(). Any native Dee class will do so automatically.

This method only works on data created with Dee.Serializable.externalize() and not with data from Dee.Serializable.serialize().

Since a Dee.SerializableParseFunc is not allowed to fail - by contract - it can be guaranteed that this function only returns None in case there is no known parser for the GObject.GType or GLib.Variant signature of data.

externalize()
Returns:

A floating reference to a GLib.Variant with the externalized data.

Return type:

GLib.Variant

Build an externalized form of self which can be used together with Dee.Serializable.parse_external() to rebuild a copy of self.

It is important to note that the variant returned from this method does not have the same type signature as returned from a call to Dee.Serializable.serialize(). Externalization will wrap the serialized data in a container format with versioning information and headers with type information.

serialize()
Returns:

A reference to a GLib.Variant with the serialized data. The variants type signature is entirely dependent of the underlying implementation. Free using GLib.Variant.unref().

Return type:

GLib.Variant

Build a clean serialized representation of self. The signature of the returned variant is entirely determined by the underlying implementation. You can recreate a serialized instance by calling Dee.Serializable.parse() provided that you know the correct GObject.GType for the serialized instance.

do_serialize() virtual
Returns:

A reference to a GLib.Variant with the serialized data. The variants type signature is entirely dependent of the underlying implementation. Free using GLib.Variant.unref().

Return type:

GLib.Variant

Build a clean serialized representation of self. The signature of the returned variant is entirely determined by the underlying implementation. You can recreate a serialized instance by calling Dee.Serializable.parse() provided that you know the correct GObject.GType for the serialized instance.