NcmSerialize

NcmSerialize — Serialization, deserialization and duplication object.

Functions

NcmSerialize * ncm_serialize_new ()
NcmSerialize * ncm_serialize_ref ()
void ncm_serialize_free ()
void ncm_serialize_unref ()
void ncm_serialize_clear ()
void ncm_serialize_reset ()
void ncm_serialize_clear_instances ()
void ncm_serialize_log_stats ()
gboolean ncm_serialize_contain_instance ()
gboolean ncm_serialize_contain_name ()
guint ncm_serialize_count_instances ()
guint ncm_serialize_count_saved_serializations ()
gpointer ncm_serialize_peek_by_name ()
gpointer ncm_serialize_get_by_name ()
gchar * ncm_serialize_peek_name ()
void ncm_serialize_set ()
void ncm_serialize_unset ()
void ncm_serialize_remove_ser ()
gboolean ncm_serialize_is_named ()
void ncm_serialize_set_property ()
void ncm_serialize_set_property_from_key_file ()
GObject * ncm_serialize_from_variant ()
NcmObjArray * ncm_serialize_array_from_variant ()
NcmObjDictStr * ncm_serialize_dict_str_from_variant ()
NcmObjDictInt * ncm_serialize_dict_int_from_variant ()
NcmVarDict * ncm_serialize_var_dict_from_variant ()
GObject * ncm_serialize_from_name_params ()
GObject * ncm_serialize_from_string ()
GObject * ncm_serialize_from_yaml ()
NcmObjArray * ncm_serialize_array_from_yaml ()
NcmObjDictStr * ncm_serialize_dict_str_from_yaml ()
NcmObjDictInt * ncm_serialize_dict_int_from_yaml ()
NcmVarDict * ncm_serialize_var_dict_from_yaml ()
GObject * ncm_serialize_from_file ()
GObject * ncm_serialize_from_binfile ()
NcmVarDict * ncm_serialize_var_dict_from_variant_file ()
GObject * ncm_serialize_from_yaml_file ()
NcmObjArray * ncm_serialize_array_from_key_file ()
NcmObjArray * ncm_serialize_array_from_yaml_file ()
NcmObjDictStr * ncm_serialize_dict_str_from_yaml_file ()
NcmObjDictInt * ncm_serialize_dict_int_from_yaml_file ()
NcmVarDict * ncm_serialize_var_dict_from_yaml_file ()
GVariant * ncm_serialize_gvalue_to_gvariant ()
GVariant * ncm_serialize_to_variant ()
GVariant * ncm_serialize_array_to_variant ()
GVariant * ncm_serialize_dict_str_to_variant ()
GVariant * ncm_serialize_dict_int_to_variant ()
GVariant * ncm_serialize_var_dict_to_variant ()
gchar * ncm_serialize_to_string ()
gchar * ncm_serialize_to_yaml ()
gchar * ncm_serialize_array_to_yaml ()
gchar * ncm_serialize_dict_str_to_yaml ()
gchar * ncm_serialize_dict_int_to_yaml ()
gchar * ncm_serialize_var_dict_to_yaml ()
void ncm_serialize_to_file ()
void ncm_serialize_to_binfile ()
void ncm_serialize_var_dict_to_variant_file ()
void ncm_serialize_to_yaml_file ()
void ncm_serialize_array_to_key_file ()
void ncm_serialize_array_to_yaml_file ()
void ncm_serialize_dict_str_to_yaml_file ()
void ncm_serialize_dict_int_to_yaml_file ()
void ncm_serialize_var_dict_to_yaml_file ()
GObject * ncm_serialize_dup_obj ()
NcmObjArray * ncm_serialize_dup_array ()
gchar * ncm_serialize_variant_to_yaml ()
NcmSerialize * ncm_serialize_global ()
void ncm_serialize_global_reset ()
void ncm_serialize_global_clear_instances ()
void ncm_serialize_global_log_stats ()
gboolean ncm_serialize_global_contain_instance ()
gboolean ncm_serialize_global_contain_name ()
guint ncm_serialize_global_count_instances ()
guint ncm_serialize_global_count_saved_serializations ()
gpointer ncm_serialize_global_get_by_name ()
gchar * ncm_serialize_global_global_peek_name ()
void ncm_serialize_global_set ()
void ncm_serialize_global_unset ()
void ncm_serialize_global_remove_ser ()
gboolean ncm_serialize_global_is_named ()
void ncm_serialize_global_set_property ()
void ncm_serialize_global_set_property_from_key_file ()
GObject * ncm_serialize_global_from_variant ()
GObject * ncm_serialize_global_from_name_params ()
GObject * ncm_serialize_global_from_string ()
GObject * ncm_serialize_global_from_yaml ()
GObject * ncm_serialize_global_from_file ()
GObject * ncm_serialize_global_from_binfile ()
GObject * ncm_serialize_global_from_yaml_file ()
GVariant * ncm_serialize_global_gvalue_to_gvariant ()
GVariant * ncm_serialize_global_to_variant ()
gchar * ncm_serialize_global_to_string ()
gchar * ncm_serialize_global_to_yaml ()
void ncm_serialize_global_to_file ()
void ncm_serialize_global_to_binfile ()
void ncm_serialize_global_to_yaml_file ()
GObject * ncm_serialize_global_dup_obj ()
gchar * ncm_serialize_global_variant_to_yaml ()

Properties

NcmSerializeOpt options Read / Write / Construct

Types and Values

Object Hierarchy

    GFlags
    ╰── NcmSerializeOpt
    GObject
    ╰── NcmSerialize

Description

This object provides serialization, deserialization and duplication of objects. The serialization process is based on the GObject object system.

Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.

One support for serialized data GVariant. The GVariant is a type-safe, reference counted, immutable, and memory-efficient container for arbitrary data. It is a generic container that can hold any type of data, including basic types such as integers and floating point numbers, strings, and byte arrays, as well as more complex types such as tuples, dictionaries, and variants. The GVariant type system is designed to be extensible, so that new types can be added in the future. A serialized GVariant object can be stored in binary or text format.

Functions

ncm_serialize_new ()

NcmSerialize *
ncm_serialize_new (NcmSerializeOpt sopt);

Creates a new NcmSerialize object.

Parameters

sopt

a set of options from NcmSerializeOpt.

 

Returns

a new NcmSerialize.


ncm_serialize_ref ()

NcmSerialize *
ncm_serialize_ref (NcmSerialize *ser);

Increases the reference count of ser by one.

Parameters

ser

a NcmSerialize.

 

Returns

ser .

[transfer full]


ncm_serialize_free ()

void
ncm_serialize_free (NcmSerialize *ser);

Decreases the reference count of ser by one.

Parameters

ser

a NcmSerialize.

 

ncm_serialize_unref ()

void
ncm_serialize_unref (NcmSerialize *ser);

Same as ncm_serialize_free().

Parameters

ser

a NcmSerialize.

 

ncm_serialize_clear ()

void
ncm_serialize_clear (NcmSerialize **ser);

Decreases the reference count of *ser by one, and sets *ser to NULL.

Parameters

ser

a NcmSerialize.

 

ncm_serialize_reset ()

void
ncm_serialize_reset (NcmSerialize *ser,
                     gboolean autosave_only);

Releases all objects in ser and erase all serialized objects. If autosave_only is TRUE it will release only autosaved objects.

Parameters

ser

a NcmSerialize

 

autosave_only

a boolean

 

ncm_serialize_clear_instances ()

void
ncm_serialize_clear_instances (NcmSerialize *ser,
                               gboolean autosave_only);

Releases all objects in ser . If autosave_only is TRUE it will release only autosaved objects.

Parameters

ser

a NcmSerialize

 

autosave_only

a boolean

 

ncm_serialize_log_stats ()

void
ncm_serialize_log_stats (NcmSerialize *ser);

Releases all objects in ser .

Parameters

ser

a NcmSerialize.

 

ncm_serialize_contain_instance ()

gboolean
ncm_serialize_contain_instance (NcmSerialize *ser,
                                gpointer obj);

Checks if the GObject instance obj is contained in ser .

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

[type GObject]

Returns

if obj is already in ser .


ncm_serialize_contain_name ()

gboolean
ncm_serialize_contain_name (NcmSerialize *ser,
                            const gchar *name);

Checks if there is an instance named name in ser .

Parameters

ser

a NcmSerialize.

 

name

an instance name.

 

Returns

if there is instance named name in ser .


ncm_serialize_count_instances ()

guint
ncm_serialize_count_instances (NcmSerialize *ser);

Counts the number of instances registered in ser .

Parameters

ser

a NcmSerialize.

 

Returns

the number of instances in ser .


ncm_serialize_count_saved_serializations ()

guint
ncm_serialize_count_saved_serializations
                               (NcmSerialize *ser);

Counts the number of instances registered in ser .

Parameters

ser

a NcmSerialize.

 

Returns

the number of instances in ser .


ncm_serialize_peek_by_name ()

gpointer
ncm_serialize_peek_by_name (NcmSerialize *ser,
                            const gchar *name);

Peeks the instance name or null if there isn't a instance named name .

Parameters

ser

a NcmSerialize.

 

name

an instance name.

 

Returns

Gets the instance named name or NULL.

[transfer none][type GObject]


ncm_serialize_get_by_name ()

gpointer
ncm_serialize_get_by_name (NcmSerialize *ser,
                           const gchar *name);

Gets a new reference for the instance name or null if there isn't a instance named name .

Parameters

ser

a NcmSerialize.

 

name

an instance name.

 

Returns

Gets the instance named name or NULL.

[transfer full][type GObject]


ncm_serialize_peek_name ()

gchar *
ncm_serialize_peek_name (NcmSerialize *ser,
                         gpointer obj);

Gets the named associated to the instance obj , it is an error to call this function when the obj is not contained in ser .

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

[type GObject]

Returns

the name of obj .

[transfer none]


ncm_serialize_set ()

void
ncm_serialize_set (NcmSerialize *ser,
                   gpointer obj,
                   const gchar *name,
                   gboolean overwrite);

Adds the object obj to ser using name .

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

[type GObject]

name

the obj name.

 

overwrite

whether to overwrite if there is already an object named name .

 

ncm_serialize_unset ()

void
ncm_serialize_unset (NcmSerialize *ser,
                     gpointer obj);

Removes the object obj to ser using name , it does nothing if the instance obj is not present in ser .

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

[type GObject]

ncm_serialize_remove_ser ()

void
ncm_serialize_remove_ser (NcmSerialize *ser,
                          gpointer obj);

Removes the object obj to ser using name , it does nothing if the instance obj is not present in ser .

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

[type GObject]

ncm_serialize_is_named ()

gboolean
ncm_serialize_is_named (NcmSerialize *ser,
                        const gchar *serobj,
                        gchar **name);

Checks if serobj is a named serialized object, if so sets its name in name and returns TRUE.

Parameters

ser

a NcmSerialize.

 

serobj

serialized object.

 

name

object name.

[allow-none][out][transfer full]

Returns

whether serobj is a named serialized object.


ncm_serialize_set_property ()

void
ncm_serialize_set_property (NcmSerialize *ser,
                            GObject *obj,
                            const gchar *prop_str);

Deserialize the set of object properties in params and sets the obj .

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

 

prop_str

a string containing the parameters to set.

 

ncm_serialize_set_property_from_key_file ()

void
ncm_serialize_set_property_from_key_file
                               (NcmSerialize *ser,
                                GObject *obj,
                                const gchar *prop_file);

Deserializes the set of object properties in prop_file and sets the obj .

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

 

prop_file

a GKeyFile file containing the parameters to set.

 

ncm_serialize_from_variant ()

GObject *
ncm_serialize_from_variant (NcmSerialize *ser,
                            GVariant *var_obj);

Deserialize and returns the newly created object.

Parameters

ser

a NcmSerialize.

 

var_obj

A GVariant containing the serialized version of the object.

 

Returns

A new GObject.

[transfer full]


ncm_serialize_array_from_variant ()

NcmObjArray *
ncm_serialize_array_from_variant (NcmSerialize *ser,
                                  GVariant *var);

Creates a new NcmObjArray from a GVariant.

Parameters

ser

a NcmSerialize.

 

var

a GVariant containing an array of objects.

 

Returns

a new NcmObjArray.

[transfer full]


ncm_serialize_dict_str_from_variant ()

NcmObjDictStr *
ncm_serialize_dict_str_from_variant (NcmSerialize *ser,
                                     GVariant *var);

Creates a new NcmObjDictStr from a GVariant.

Parameters

ser

a NcmSerialize

 

var

a GVariant containing a dictionary of string keys

 

Returns

a new NcmObjDictStr.

[transfer full]


ncm_serialize_dict_int_from_variant ()

NcmObjDictInt *
ncm_serialize_dict_int_from_variant (NcmSerialize *ser,
                                     GVariant *var);

Creates a new NcmObjDictInt from a GVariant.

Parameters

ser

a NcmSerialize

 

var

a GVariant containing a dictionary of integers keys

 

Returns

a new NcmObjDictInt.

[transfer full]


ncm_serialize_var_dict_from_variant ()

NcmVarDict *
ncm_serialize_var_dict_from_variant (NcmSerialize *ser,
                                     GVariant *var);

Creates a new NcmVarDict from a GVariant.

Parameters

ser

a NcmSerialize

 

var

a GVariant containing a dictionary of string and variants

 

Returns

a new NcmObjDictStr.

[transfer full]


ncm_serialize_from_name_params ()

GObject *
ncm_serialize_from_name_params (NcmSerialize *ser,
                                const gchar *obj_name,
                                GVariant *params);

Parses the serialized parameters and returns the newly created object using them.

Parameters

ser

a NcmSerialize.

 

obj_name

string containing the object name.

 

params

a GVariant containing the object parameters.

 

Returns

A new GObject.

[transfer full]


ncm_serialize_from_string ()

GObject *
ncm_serialize_from_string (NcmSerialize *ser,
                           const gchar *obj_ser);

Parses the serialized and returns the newly created object.

Parameters

ser

a NcmSerialize.

 

obj_ser

String containing the serialized version of the object.

 

Returns

A new GObject.

[transfer full]


ncm_serialize_from_yaml ()

GObject *
ncm_serialize_from_yaml (NcmSerialize *ser,
                         const gchar *yaml_obj);

Parses the serialized string in yaml_obj and returns the newly created object.

Parameters

ser

a NcmSerialize

 

yaml_obj

string containing the serialized version of the object in YAML format

 

Returns

A new GObject.

[transfer full]


ncm_serialize_array_from_yaml ()

NcmObjArray *
ncm_serialize_array_from_yaml (NcmSerialize *ser,
                               const gchar *yaml_obj);

Parses the serialized string in yaml_obj and returns an array of newly created objects.

Parameters

ser

a NcmSerialize

 

yaml_obj

string containing the serialized version of the object in YAML format

 

Returns

A new NcmObjArray.

[transfer full]


ncm_serialize_dict_str_from_yaml ()

NcmObjDictStr *
ncm_serialize_dict_str_from_yaml (NcmSerialize *ser,
                                  const gchar *yaml_obj);

Parses the serialized string in yaml_obj and returns a NcmObjDictStr containing the object names as keys and the serialized objects as values.

Parameters

ser

a NcmSerialize

 

yaml_obj

string containing the serialized version of the object in YAML format

 

Returns

A new NcmObjDictStr.

[transfer full]


ncm_serialize_dict_int_from_yaml ()

NcmObjDictInt *
ncm_serialize_dict_int_from_yaml (NcmSerialize *ser,
                                  const gchar *yaml_obj);

Parses the serialized string in yaml_obj and returns a NcmObjDictInt containing the object names as keys and the serialized objects as values.

Parameters

ser

a NcmSerialize

 

yaml_obj

string containing the serialized version of the object in YAML format

 

Returns

A new NcmObjDictInt.

[transfer full]


ncm_serialize_var_dict_from_yaml ()

NcmVarDict *
ncm_serialize_var_dict_from_yaml (NcmSerialize *ser,
                                  const gchar *yaml_obj);

Parses the serialized string in yaml_obj and returns a NcmVarDict containing the object names as keys and the serialized objects as values.

Parameters

ser

a NcmSerialize

 

yaml_obj

string containing the serialized version of the NcmVarDict in YAML format

 

Returns

A new NcmVarDict.

[transfer full]


ncm_serialize_from_file ()

GObject *
ncm_serialize_from_file (NcmSerialize *ser,
                         const gchar *filename);

Parses the serialized string in filename and returns the newly created object.

Parameters

ser

a NcmSerialize

 

filename

File containing the serialized version of the object

 

Returns

A new GObject.

[transfer full]


ncm_serialize_from_binfile ()

GObject *
ncm_serialize_from_binfile (NcmSerialize *ser,
                            const gchar *filename);

Parses the serialized binary data in filename and returns the newly created object.

Parameters

ser

a NcmSerialize.

 

filename

File containing the binary serialized version of the object.

 

Returns

A new GObject.

[transfer full]


ncm_serialize_var_dict_from_variant_file ()

NcmVarDict *
ncm_serialize_var_dict_from_variant_file
                               (NcmSerialize *ser,
                                const gchar *filename,
                                gboolean binary);

Parses the serialized string in filename and returns a NcmVarDict containing the object names as keys and the serialized objects as values.

Parameters

ser

a NcmSerialize

 

filename

File containing the serialized version of the NcmVarDict

 

binary

Whether the file contains binary data or not

 

Returns

A new NcmVarDict.

[transfer full]


ncm_serialize_from_yaml_file ()

GObject *
ncm_serialize_from_yaml_file (NcmSerialize *ser,
                              const gchar *filename);

Parses the YAML in filename and returns the newly created object.

Parameters

ser

a NcmSerialize

 

filename

File containing the serialized version of the object in YAML format

 

Returns

A new GObject.

[transfer full]


ncm_serialize_array_from_key_file ()

NcmObjArray *
ncm_serialize_array_from_key_file (NcmSerialize *ser,
                                   const gchar *filename);

Loads a NcmObjArray from a file using a NcmSerialize and a GKeyFile.

Parameters

ser

a NcmSerialize

 

filename

oa filename

 

Returns

a new NcmObjArray.

[transfer full]


ncm_serialize_array_from_yaml_file ()

NcmObjArray *
ncm_serialize_array_from_yaml_file (NcmSerialize *ser,
                                    const gchar *filename);

Parses the YAML in filename and returns an array of newly created objects.

Parameters

ser

a NcmSerialize

 

filename

File containing the serialized version of the object in YAML format

 

Returns

A new NcmObjArray.

[transfer full]


ncm_serialize_dict_str_from_yaml_file ()

NcmObjDictStr *
ncm_serialize_dict_str_from_yaml_file (NcmSerialize *ser,
                                       const gchar *filename);

Parses the YAML in filename and returns a NcmObjDictStr containing

Parameters

ser

a NcmSerialize

 

filename

File containing the serialized version of the object in YAML format

 

Returns

A new NcmObjDictStr.

[transfer full]


ncm_serialize_dict_int_from_yaml_file ()

NcmObjDictInt *
ncm_serialize_dict_int_from_yaml_file (NcmSerialize *ser,
                                       const gchar *filename);

Parses the YAML in filename and returns a NcmObjDictInt containing

Parameters

ser

a NcmSerialize

 

filename

File containing the serialized version of the object in YAML format

 

Returns

A new NcmObjDictInt.

[transfer full]


ncm_serialize_var_dict_from_yaml_file ()

NcmVarDict *
ncm_serialize_var_dict_from_yaml_file (NcmSerialize *ser,
                                       const gchar *filename);

Parses the YAML in filename and returns a NcmVarDict containing the element names as keys and their values.

Parameters

ser

a NcmSerialize

 

filename

File containing the serialized version of the NcmVarDict in YAML format

 

Returns

A new NcmVarDict.

[transfer full]


ncm_serialize_gvalue_to_gvariant ()

GVariant *
ncm_serialize_gvalue_to_gvariant (NcmSerialize *ser,
                                  GValue *val);

Converts a GValue to a GVariant.

Parameters

ser

a NcmSerialize.

 

val

a GValue.

 

Returns

A GVariant convertion of val .

[transfer full]


ncm_serialize_to_variant ()

GVariant *
ncm_serialize_to_variant (NcmSerialize *ser,
                          GObject *obj);

Serialize the obj to a GVariant representation.

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

 

Returns

A GVariant dictionary describing the obj .

[transfer full]


ncm_serialize_array_to_variant ()

GVariant *
ncm_serialize_array_to_variant (NcmSerialize *ser,
                                NcmObjArray *oa);

Serializes a NcmObjArray to a GVariant.

Parameters

ser

a NcmSerialize

 

oa

a NcmObjArray

 

Returns

the serialized GVariant.

[transfer full]


ncm_serialize_dict_str_to_variant ()

GVariant *
ncm_serialize_dict_str_to_variant (NcmSerialize *ser,
                                   NcmObjDictStr *ods);

Serializes a NcmObjDictStr to a GVariant.

Parameters

ser

a NcmSerialize

 

ods

a NcmObjDictStr

 

Returns

the serialized GVariant.

[transfer full]


ncm_serialize_dict_int_to_variant ()

GVariant *
ncm_serialize_dict_int_to_variant (NcmSerialize *ser,
                                   NcmObjDictInt *odi);

Serializes a NcmObjDictInt to a GVariant.

Parameters

ser

a NcmSerialize

 

odi

a NcmObjDictInt

 

Returns

the serialized GVariant.

[transfer full]


ncm_serialize_var_dict_to_variant ()

GVariant *
ncm_serialize_var_dict_to_variant (NcmSerialize *ser,
                                   NcmVarDict *vd);

Serializes a NcmVarDict to a GVariant.

Parameters

ser

a NcmSerialize

 

vd

a NcmVarDict

 

Returns

the serialized GVariant.

[transfer full]


ncm_serialize_to_string ()

gchar *
ncm_serialize_to_string (NcmSerialize *ser,
                         GObject *obj,
                         gboolean valid_variant);

Serialize the object obj to a string.

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

 

valid_variant

whether to use a valid GVariant representation.

 

Returns

A string containing the serialized version of obj .

[transfer full]


ncm_serialize_to_yaml ()

gchar *
ncm_serialize_to_yaml (NcmSerialize *ser,
                       GObject *obj);

Serialize the object obj to a YAML string.

Parameters

ser

a NcmSerialize

 

obj

a GObject

 

Returns

A YAML string containing the serialized version of obj .

[transfer full]


ncm_serialize_array_to_yaml ()

gchar *
ncm_serialize_array_to_yaml (NcmSerialize *ser,
                             NcmObjArray *oa);

Serialize the NcmObjArray oa to a YAML string.

Parameters

ser

a NcmSerialize

 

oa

a NcmObjArray

 

Returns

A YAML string containing the serialized version of oa .

[transfer full]


ncm_serialize_dict_str_to_yaml ()

gchar *
ncm_serialize_dict_str_to_yaml (NcmSerialize *ser,
                                NcmObjDictStr *ods);

Serialize the NcmObjDictStr ods to a YAML string.

Parameters

ser

a NcmSerialize

 

ods

a NcmObjDictStr

 

Returns

A YAML string containing the serialized version of ods .

[transfer full]


ncm_serialize_dict_int_to_yaml ()

gchar *
ncm_serialize_dict_int_to_yaml (NcmSerialize *ser,
                                NcmObjDictInt *odi);

Serialize the NcmObjDictInt odi to a YAML string.

Parameters

ser

a NcmSerialize

 

odi

a NcmObjDictInt

 

Returns

A YAML string containing the serialized version of odi .

[transfer full]


ncm_serialize_var_dict_to_yaml ()

gchar *
ncm_serialize_var_dict_to_yaml (NcmSerialize *ser,
                                NcmVarDict *dict);

Serialize the NcmVarDict dict to a YAML string.

Parameters

ser

a NcmSerialize

 

dict

a NcmVarDict

 

Returns

A YAML string containing the serialized version of dict .

[transfer full]


ncm_serialize_to_file ()

void
ncm_serialize_to_file (NcmSerialize *ser,
                       GObject *obj,
                       const gchar *filename);

Serializes obj and saves the string in filename .

Parameters

ser

a NcmSerialize

 

obj

a GObject

 

filename

File where to save the serialized version of the object

 

ncm_serialize_to_binfile ()

void
ncm_serialize_to_binfile (NcmSerialize *ser,
                          GObject *obj,
                          const gchar *filename);

Serializes obj and saves the binary in filename .

Parameters

ser

a NcmSerialize

 

obj

a GObject

 

filename

File where to save the serialized version of the object

 

ncm_serialize_var_dict_to_variant_file ()

void
ncm_serialize_var_dict_to_variant_file
                               (NcmSerialize *ser,
                                NcmVarDict *vd,
                                const gchar *filename,
                                gboolean binary);

Serializes vd and saves the variant string in filename .

Parameters

ser

a NcmSerialize

 

vd

a NcmVarDict

 

filename

File where to save the serialized version of the object

 

binary

whether to save the variant in binary format

 

ncm_serialize_to_yaml_file ()

void
ncm_serialize_to_yaml_file (NcmSerialize *ser,
                            GObject *obj,
                            const gchar *filename);

Serializes obj and saves the YAML string in filename .

Parameters

ser

a NcmSerialize

 

obj

a GObject

 

filename

File where to save the serialized version of the object

 

ncm_serialize_array_to_key_file ()

void
ncm_serialize_array_to_key_file (NcmSerialize *ser,
                                 NcmObjArray *oa,
                                 const gchar *filename,
                                 gboolean save_comment);

Saves a NcmObjArray to a file using a NcmSerialize and a GKeyFile.

Parameters

ser

a NcmSerialize

 

oa

a NcmObjArray

 

filename

oa filename

 

save_comment

whether to save comments

 

ncm_serialize_array_to_yaml_file ()

void
ncm_serialize_array_to_yaml_file (NcmSerialize *ser,
                                  NcmObjArray *oa,
                                  const gchar *filename);

Saves a NcmObjArray to a file using a NcmSerialize and a YAML string.

Parameters

ser

a NcmSerialize

 

oa

a NcmObjArray

 

filename

oa filename

 

ncm_serialize_dict_str_to_yaml_file ()

void
ncm_serialize_dict_str_to_yaml_file (NcmSerialize *ser,
                                     NcmObjDictStr *ods,
                                     const gchar *filename);

Saves a NcmObjDictStr to a file using a NcmSerialize and a YAML string.

Parameters

ser

a NcmSerialize

 

ods

a NcmObjDictStr

 

filename

ods filename

 

ncm_serialize_dict_int_to_yaml_file ()

void
ncm_serialize_dict_int_to_yaml_file (NcmSerialize *ser,
                                     NcmObjDictInt *odi,
                                     const gchar *filename);

Saves a NcmObjDictInt to a file using a NcmSerialize and a YAML string.

Parameters

ser

a NcmSerialize

 

odi

a NcmObjDictInt

 

filename

odi filename

 

ncm_serialize_var_dict_to_yaml_file ()

void
ncm_serialize_var_dict_to_yaml_file (NcmSerialize *ser,
                                     NcmVarDict *vd,
                                     const gchar *filename);

Saves a NcmVarDict to a file using a NcmSerialize and a YAML string.

Parameters

ser

a NcmSerialize

 

vd

a NcmVarDict

 

filename

vd filename

 

ncm_serialize_dup_obj ()

GObject *
ncm_serialize_dup_obj (NcmSerialize *ser,
                       GObject *obj);

Duplicates obj by serializing and deserializing a new object.

Parameters

ser

a NcmSerialize.

 

obj

a GObject.

 

Returns

A duplicate of obj .

[transfer full]


ncm_serialize_dup_array ()

NcmObjArray *
ncm_serialize_dup_array (NcmSerialize *ser,
                         NcmObjArray *oa);

Duplicates a NcmObjArray, all objects are duplicated.

Parameters

ser

a NcmSerialize

 

oa

a NcmObjArray

 

Returns

a new NcmObjArray.

[transfer full]


ncm_serialize_variant_to_yaml ()

gchar *
ncm_serialize_variant_to_yaml (NcmSerialize *ser,
                               GVariant *var_obj);

Converts a GObject serialized to a GVariant to a YAML string.

Parameters

ser

a NcmSerialize

 

var_obj

a GObject serialized to a GVariant

 

Returns

A pointer to the YAML string representation of the var_obj .


ncm_serialize_global ()

NcmSerialize *
ncm_serialize_global (void);

Gets the global serialization object, instanciates it if necessary.

Returns

The global NcmSerialize.

[transfer full]


ncm_serialize_global_reset ()

void
ncm_serialize_global_reset (gboolean autosave_only);

Releases all objects in global NcmSerialize and erase all serialized objects.

Parameters

autosave_only

a boolean

 

ncm_serialize_global_clear_instances ()

void
ncm_serialize_global_clear_instances (gboolean autosave_only);

Releases all objects in global NcmSerialize.

Parameters

autosave_only

a boolean

 

ncm_serialize_global_log_stats ()

void
ncm_serialize_global_log_stats (void);

Releases all objects in global NcmSerialize.


ncm_serialize_global_contain_instance ()

gboolean
ncm_serialize_global_contain_instance (gpointer obj);

Global version of ncm_serialize_contain_instance().

Parameters

obj

a GObject.

[type GObject]

Returns

if obj is already in ser .


ncm_serialize_global_contain_name ()

gboolean
ncm_serialize_global_contain_name (const gchar *name);

Global version of ncm_serialize_contain_name().

Parameters

name

an instance name.

 

Returns

if there is instance named name in ser .


ncm_serialize_global_count_instances ()

guint
ncm_serialize_global_count_instances (void);

Global version of ncm_serialize_count_instances().

Returns

the number of instances in ser .


ncm_serialize_global_count_saved_serializations ()

guint
ncm_serialize_global_count_saved_serializations
                               (void);

Global version of ncm_serialize_count_saved_serializations().

Returns

the number of instances in ser .


ncm_serialize_global_get_by_name ()

gpointer
ncm_serialize_global_get_by_name (const gchar *name);

Global version of ncm_serialize_get_by_name().

Parameters

name

an instance name.

 

Returns

Gets the instance named name or NULL.

[transfer full][type GObject]


ncm_serialize_global_global_peek_name ()

gchar *
ncm_serialize_global_global_peek_name (gpointer obj);

ncm_serialize_global_set ()

void
ncm_serialize_global_set (gpointer obj,
                          const gchar *name,
                          gboolean overwrite);

Global version of ncm_serialize_set().

Parameters

obj

a GObject.

[type GObject]

name

the obj name.

 

overwrite

whether to overwrite if there is already an object named name .

 

ncm_serialize_global_unset ()

void
ncm_serialize_global_unset (gpointer obj);

Global version of ncm_serialize_unset().

Parameters

obj

a GObject.

[type GObject]

ncm_serialize_global_remove_ser ()

void
ncm_serialize_global_remove_ser (gpointer obj);

Global version of ncm_serialize_remove_ser().

Parameters

obj

a GObject.

[type GObject]

ncm_serialize_global_is_named ()

gboolean
ncm_serialize_global_is_named (const gchar *serobj,
                               gchar **name);

Global version of ncm_serialize_is_named().

Parameters

serobj

serialized object.

 

name

object name.

[out][transfer full]

Returns

whether serobj is a named serialized object.


ncm_serialize_global_set_property ()

void
ncm_serialize_global_set_property (GObject *obj,
                                   const gchar *prop_str);

Global version of ncm_serialize_set_property().

Parameters

obj

a GObject.

 

prop_str

a string containing the parameters to set.

 

ncm_serialize_global_set_property_from_key_file ()

void
ncm_serialize_global_set_property_from_key_file
                               (GObject *obj,
                                const gchar *prop_file);

Global version of ncm_serialize_set_property().

Parameters

obj

a GObject.

 

prop_file

a GKeyFile containing the parameters to set.

 

ncm_serialize_global_from_variant ()

GObject *
ncm_serialize_global_from_variant (GVariant *var_obj);

Global version of ncm_serialize_from_variant().

Parameters

var_obj

A GVariant containing the serialized version of the object.

 

Returns

a new GObject deserialized from var_obj .

[transfer full]


ncm_serialize_global_from_name_params ()

GObject *
ncm_serialize_global_from_name_params (const gchar *obj_name,
                                       GVariant *params);

Global version of ncm_serialize_from_name_params().

Parameters

obj_name

string containing the object name.

 

params

a GVariant containing the object parameters.

 

Returns

A new GObject.

[transfer full]


ncm_serialize_global_from_string ()

GObject *
ncm_serialize_global_from_string (const gchar *obj_ser);

Global version of ncm_serialize_from_string().

Parameters

obj_ser

String containing the serialized version of the object.

 

Returns

A new GObject.

[transfer full]


ncm_serialize_global_from_yaml ()

GObject *
ncm_serialize_global_from_yaml (const gchar *yaml_obj);

Global version of ncm_serialize_from_yaml().

Parameters

yaml_obj

a string containing the serialized version of the object in YAML format

 

Returns

A new GObject.

[transfer full]


ncm_serialize_global_from_file ()

GObject *
ncm_serialize_global_from_file (const gchar *filename);

Global version of ncm_serialize_from_file().

Parameters

filename

File containing the serialized version of the object.

 

Returns

A new GObject.

[transfer full]


ncm_serialize_global_from_binfile ()

GObject *
ncm_serialize_global_from_binfile (const gchar *filename);

Global version of ncm_serialize_from_binfile().

Parameters

filename

File containing the serialized version of the object.

 

Returns

A new GObject.

[transfer full]


ncm_serialize_global_from_yaml_file ()

GObject *
ncm_serialize_global_from_yaml_file (const gchar *filename);

Global version of ncm_serialize_from_yaml_file().

Parameters

filename

File containing the serialized version of the object.

 

Returns

A new GObject.

[transfer full]


ncm_serialize_global_gvalue_to_gvariant ()

GVariant *
ncm_serialize_global_gvalue_to_gvariant
                               (GValue *val);

Global version of ncm_serialize_gvalue_to_gvariant().

Parameters

val

a GValue.

 

Returns

A GVariant convertion of val .

[transfer full]


ncm_serialize_global_to_variant ()

GVariant *
ncm_serialize_global_to_variant (GObject *obj);

Global version of ncm_serialize_to_variant().

Parameters

obj

a GObject.

 

Returns

A GVariant dictionary describing the obj .

[transfer full]


ncm_serialize_global_to_string ()

gchar *
ncm_serialize_global_to_string (GObject *obj,
                                gboolean valid_variant);

Global version of ncm_serialize_to_string().

Parameters

obj

a GObject.

 

valid_variant

whether to use a valid GVariant representation.

 

Returns

A string containing the serialized version of obj .

[transfer full]


ncm_serialize_global_to_yaml ()

gchar *
ncm_serialize_global_to_yaml (GObject *obj);

Global version of ncm_serialize_to_yaml().

Parameters

obj

a GObject

 

Returns

A string containing the serialized version of obj .

[transfer full]


ncm_serialize_global_to_file ()

void
ncm_serialize_global_to_file (GObject *obj,
                              const gchar *filename);

Global version of ncm_serialize_to_file().

Parameters

obj

a GObject.

 

filename

File where to save the serialized version of the object

 

ncm_serialize_global_to_binfile ()

void
ncm_serialize_global_to_binfile (GObject *obj,
                                 const gchar *filename);

Global version of ncm_serialize_to_binfile().

Parameters

obj

a GObject.

 

filename

File where to save the serialized version of the object

 

ncm_serialize_global_to_yaml_file ()

void
ncm_serialize_global_to_yaml_file (GObject *obj,
                                   const gchar *filename);

Global version of ncm_serialize_to_yaml_file().

Parameters

obj

a GObject.

 

filename

File where to save the serialized version of the object

 

ncm_serialize_global_dup_obj ()

GObject *
ncm_serialize_global_dup_obj (GObject *obj);

Global version of ncm_serialize_dup_obj().

Parameters

obj

a GObject.

 

Returns

A duplicate of obj .

[transfer full]


ncm_serialize_global_variant_to_yaml ()

gchar *
ncm_serialize_global_variant_to_yaml (GVariant *var_obj);

Global version of ncm_serialize_variant_to_yaml(). Converts a GObject serialized to a GVariant to a YAML string.

Parameters

var_obj

a GObject serialized to a GVariant

 

Returns

A pointer to the YAML string representation of the var_obj .

Types and Values

NCM_TYPE_SERIALIZE

#define NCM_TYPE_SERIALIZE (ncm_serialize_get_type ())

enum NcmSerializeOpt

Options for serialization.

Members

NCM_SERIALIZE_OPT_NONE

Use default serialization.

 

NCM_SERIALIZE_OPT_AUTOSAVE_SER

Whether to automatically include named deserialized objects in the named instances.

 

NCM_SERIALIZE_OPT_AUTONAME_SER

Whether to automatically name objects on serialization.

 

NCM_SERIALIZE_OPT_CLEAN_DUP

Combination of NCM_SERIALIZE_OPT_AUTOSAVE_SER and NCM_SERIALIZE_OPT_AUTONAME_SER

 

NCM_SERIALIZE_PROPERTY_TYPE

#define NCM_SERIALIZE_PROPERTY_TYPE "{sv}"

NCM_SERIALIZE_PROPERTIES_TYPE

#define NCM_SERIALIZE_PROPERTIES_TYPE "a"NCM_SERIALIZE_PROPERTY_TYPE

NCM_SERIALIZE_OBJECT_TYPE

#define NCM_SERIALIZE_OBJECT_TYPE "(s"NCM_SERIALIZE_PROPERTIES_TYPE ")"

NCM_SERIALIZE_OBJECT_FORMAT

#define NCM_SERIALIZE_OBJECT_FORMAT "(s@"NCM_SERIALIZE_PROPERTIES_TYPE ")"

NCM_SERIALIZE_OBJECT_ARRAY_TYPE

#define NCM_SERIALIZE_OBJECT_ARRAY_TYPE "a"NCM_SERIALIZE_OBJECT_TYPE

NCM_SERIALIZE_OBJECT_ARRAY_POS_STR

#define NCM_SERIALIZE_OBJECT_ARRAY_POS_STR "ARRAY:ELEMENT"

NCM_SERIALIZE_OBJECT_ARRAY_OBJ_NAME_STR

#define NCM_SERIALIZE_OBJECT_ARRAY_OBJ_NAME_STR "OBJECT:NAME"

NCM_SERIALIZE_OBJECT_DICT_STR_TYPE

#define NCM_SERIALIZE_OBJECT_DICT_STR_TYPE "a{s"NCM_SERIALIZE_OBJECT_TYPE "}"

NCM_SERIALIZE_OBJECT_DICT_INT_TYPE

#define NCM_SERIALIZE_OBJECT_DICT_INT_TYPE "a{i"NCM_SERIALIZE_OBJECT_TYPE "}"

NCM_SERIALIZE_VAR_DICT_TYPE

#define NCM_SERIALIZE_VAR_DICT_TYPE "a{sv}"

NCM_SERIALIZE_VECTOR_TYPE

#define NCM_SERIALIZE_VECTOR_TYPE "ad"

NCM_SERIALIZE_MATRIX_TYPE

#define NCM_SERIALIZE_MATRIX_TYPE "aad"

NCM_SERIALIZE_STRV_TYPE

#define NCM_SERIALIZE_STRV_TYPE "as"

NCM_SERIALIZE_AUTOSAVE_NAME

#define NCM_SERIALIZE_AUTOSAVE_NAME "S"

NCM_SERIALIZE_AUTOSAVE_NFORMAT

#define NCM_SERIALIZE_AUTOSAVE_NFORMAT "%u"

NcmSerialize

typedef struct _NcmSerialize NcmSerialize;

Property Details

The “options” property

  “options”                  NcmSerializeOpt

Serialization options.

Owner: NcmSerialize

Flags: Read / Write / Construct