Dee.Serializable¶
- Implementations:
Methods¶
class |
|
class |
|
|
|
|
Virtual Methods¶
|
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class Dee.Serializable¶
- Bases:
- Structure:
- classmethod parse(data, type)¶
- Parameters:
data (
GLib.Variant
) – TheGLib.Variant
data to parse. If this is a floating reference it will be consumedtype (
GObject.GType
) – TheGObject.GType
of the class to instantiate from data
- Returns:
A newly constructed
GObject.Object
build from data orNone
in case no parser has been registered for the givenGObject.GType
or variant signature. Free withGObject.Object.unref
().- Return type:
Reconstruct a
Dee.Serializable
fromGLib.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 fromDee.Serializable.externalize
().Since a
Dee.SerializableParseFunc
is not allowed to fail - by contract - it can be guaranteed that this function only returnsNone
in case there is no known parser for type andGLib.Variant
signature of data.
- classmethod parse_external(data)¶
- Parameters:
data (
GLib.Variant
) – TheGLib.Variant
data to parse- Returns:
A newly constructed
GObject.Object
build from data orNone
in case no parser has been registered for the givenGObject.GType
or variant signature. Free withGObject.Object.unref
().- Return type:
Reconstruct a
Dee.Serializable
fromGLib.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 fromDee.Serializable.serialize
().Since a
Dee.SerializableParseFunc
is not allowed to fail - by contract - it can be guaranteed that this function only returnsNone
in case there is no known parser for theGObject.GType
orGLib.Variant
signature of data.
- externalize()¶
- Returns:
A floating reference to a
GLib.Variant
with the externalized data.- Return type:
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 usingGLib.Variant.unref
().- Return type:
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 correctGObject.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 usingGLib.Variant.unref
().- Return type:
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 correctGObject.GType
for the serialized instance.