summaryrefslogtreecommitdiff
path: root/src/analysis/contents/restricted.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/contents/restricted.c')
-rw-r--r--src/analysis/contents/restricted.c89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/analysis/contents/restricted.c b/src/analysis/contents/restricted.c
index ded96c7..3e9cbbb 100644
--- a/src/analysis/contents/restricted.c
+++ b/src/analysis/contents/restricted.c
@@ -29,6 +29,8 @@
#include "../content-int.h"
+#include "../db/misc/rlestr.h"
+#include "../storage/serialize-int.h"
@@ -57,6 +59,9 @@ static void g_restricted_content_class_init(GRestrictedContentClass *);
/* Initialise une instance de contenu de données binaires. */
static void g_restricted_content_init(GRestrictedContent *);
+/* Procède à l'initialisation de l'interface de sérialisation. */
+static void g_restricted_content_serializable_init(GSerializableObjectInterface *);
+
/* Procède à l'initialisation de l'interface de lecture. */
static void g_restricted_content_interface_init(GBinContentInterface *);
@@ -66,6 +71,12 @@ static void g_restricted_content_dispose(GRestrictedContent *);
/* Procède à la libération totale de la mémoire. */
static void g_restricted_content_finalize(GRestrictedContent *);
+/* Charge un contenu depuis une mémoire tampon. */
+static bool g_restricted_content_load(GRestrictedContent *, GObjectStorage *, packed_buffer_t *);
+
+/* Sauvegarde un contenu dans une mémoire tampon. */
+static bool g_restricted_content_store(const GRestrictedContent *, GObjectStorage *, packed_buffer_t *);
+
/* Donne l'origine d'un contenu binaire. */
static GBinContent *g_restricted_content_get_root(GRestrictedContent *);
@@ -115,6 +126,7 @@ static bool g_restricted_content_read_leb128(const GRestrictedContent *, vmpa2t
/* Indique le type défini par la GLib pour les contenus de données. */
G_DEFINE_TYPE_WITH_CODE(GRestrictedContent, g_restricted_content, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE(G_TYPE_SERIALIZABLE_OBJECT, g_restricted_content_serializable_init)
G_IMPLEMENT_INTERFACE(G_TYPE_BIN_CONTENT, g_restricted_content_interface_init));
@@ -170,6 +182,26 @@ static void g_restricted_content_init(GRestrictedContent *content)
* *
* Paramètres : iface = interface GLib à initialiser. *
* *
+* Description : Procède à l'initialisation de l'interface de sérialisation. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_restricted_content_serializable_init(GSerializableObjectInterface *iface)
+{
+ iface->load = (load_serializable_object_cb)g_restricted_content_load;
+ iface->store = (store_serializable_object_cb)g_restricted_content_store;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : iface = interface GLib à initialiser. *
+* *
* Description : Procède à l'initialisation de l'interface de lecture. *
* *
* Retour : - *
@@ -305,6 +337,63 @@ GBinContent *g_restricted_content_new_ro(const GBinContent *content, const mrang
/******************************************************************************
* *
+* Paramètres : content = élément GLib à constuire. *
+* storage = conservateur de données à manipuler ou NULL. *
+* pbuf = zone tampon à lire. *
+* *
+* Description : Charge un contenu depuis une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_restricted_content_load(GRestrictedContent *content, GObjectStorage *storage, packed_buffer_t *pbuf)
+{
+ bool result; /* Bilan à retourner */
+
+ content->internal = G_BIN_CONTENT(g_object_storage_unpack_object(storage, "contents", pbuf));
+ result = (content->internal != NULL);
+
+ if (result)
+ result = unpack_mrange(&content->range, pbuf);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : content = élément GLib à consulter. *
+* storage = conservateur de données à manipuler ou NULL. *
+* pbuf = zone tampon à remplir. *
+* *
+* Description : Sauvegarde un contenu dans une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_restricted_content_store(const GRestrictedContent *content, GObjectStorage *storage, packed_buffer_t *pbuf)
+{
+ bool result; /* Bilan à retourner */
+
+ result = g_object_storage_pack_object(storage, "contents", G_SERIALIZABLE_OBJECT(content->internal), pbuf);
+
+ if (result)
+ result = pack_mrange(&content->range, pbuf);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : content = contenu binaire à consulter. *
* *
* Description : Donne l'origine d'un contenu binaire. *