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.Variantdata to parse. If this is a floating reference it will be consumedtype (
GObject.GType) – TheGObject.GTypeof the class to instantiate from data
- Returns:
A newly constructed
GObject.Objectbuild from data orNonein case no parser has been registered for the givenGObject.GTypeor variant signature. Free withGObject.Object.unref().- Return type:
Reconstruct a
Dee.SerializablefromGLib.Variantdata. 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.SerializableParseFuncis not allowed to fail - by contract - it can be guaranteed that this function only returnsNonein case there is no known parser for type andGLib.Variantsignature of data.
- classmethod parse_external(data)¶
- Parameters:
data (
GLib.Variant) – TheGLib.Variantdata to parse- Returns:
A newly constructed
GObject.Objectbuild from data orNonein case no parser has been registered for the givenGObject.GTypeor variant signature. Free withGObject.Object.unref().- Return type:
Reconstruct a
Dee.SerializablefromGLib.Variantdata. 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.SerializableParseFuncis not allowed to fail - by contract - it can be guaranteed that this function only returnsNonein case there is no known parser for theGObject.GTypeorGLib.Variantsignature of data.
- externalize()¶
- Returns:
A floating reference to a
GLib.Variantwith 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.Variantwith 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.GTypefor the serialized instance.
- do_serialize() virtual¶
- Returns:
A reference to a
GLib.Variantwith 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.GTypefor the serialized instance.