diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2024-11-15 10:01:42 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2024-11-15 10:01:42 (GMT) |
commit | 671f61ec87f5e8d762ea890aabbc62c777e1c4f9 (patch) | |
tree | 1517f5fc5d00c8fd04872b35571556b021866f14 /src/format/known.c | |
parent | 3e21278480a25552401644cd0dc168e3588508dd (diff) |
Restore a skeleton of support for file formats.
Diffstat (limited to 'src/format/known.c')
-rw-r--r-- | src/format/known.c | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/src/format/known.c b/src/format/known.c index 7512ae1..c32a00b 100644 --- a/src/format/known.c +++ b/src/format/known.c @@ -28,8 +28,8 @@ #include "known-int.h" -#include "../analysis/storage/serialize-int.h" -#include "../plugins/pglist.h" +//#include "../analysis/storage/serialize-int.h" +//#include "../plugins/pglist.h" @@ -43,7 +43,7 @@ static void g_known_format_class_init(GKnownFormatClass *); static void g_known_format_init(GKnownFormat *); /* Procède à l'initialisation de l'interface de sérialisation. */ -static void g_known_format_serializable_init(GSerializableObjectInterface *); +//static void g_known_format_serializable_init(GSerializableObjectInterface *); /* Supprime toutes les références externes. */ static void g_known_format_dispose(GKnownFormat *); @@ -56,6 +56,7 @@ static void g_known_format_finalize(GKnownFormat *); /* -------------------- CONSERVATION ET RECHARGEMENT DES DONNEES -------------------- */ +#if 0 /* Charge un format depuis une mémoire tampon. */ static bool _g_known_format_load(GKnownFormat *, GObjectStorage *, packed_buffer_t *); @@ -67,7 +68,7 @@ static bool _g_known_format_store(GKnownFormat *, GObjectStorage *, packed_buffe /* Sauvegarde un format dans une mémoire tampon. */ static bool g_known_format_store(GKnownFormat *, GObjectStorage *, packed_buffer_t *); - +#endif /* ---------------------------------------------------------------------------------- */ @@ -76,8 +77,9 @@ static bool g_known_format_store(GKnownFormat *, GObjectStorage *, packed_buffer /* Indique le type défini pour un format binaire générique. */ -G_DEFINE_TYPE_WITH_CODE(GKnownFormat, g_known_format, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE(G_TYPE_SERIALIZABLE_OBJECT, g_known_format_serializable_init)); +//G_DEFINE_TYPE_WITH_CODE(GKnownFormat, g_known_format, G_TYPE_OBJECT, +// G_IMPLEMENT_INTERFACE(G_TYPE_SERIALIZABLE_OBJECT, g_known_format_serializable_init)); +G_DEFINE_TYPE(GKnownFormat, g_known_format, G_TYPE_OBJECT); /****************************************************************************** @@ -101,8 +103,10 @@ static void g_known_format_class_init(GKnownFormatClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_known_format_dispose; object->finalize = (GObjectFinalizeFunc)g_known_format_finalize; + /* klass->load = (load_known_fc)_g_known_format_load; klass->store = (store_known_fc)_g_known_format_store; + */ } @@ -126,6 +130,7 @@ static void g_known_format_init(GKnownFormat *format) } +#if 0 /****************************************************************************** * * * Paramètres : iface = interface GLib à initialiser. * @@ -144,6 +149,7 @@ static void g_known_format_serializable_init(GSerializableObjectInterface *iface iface->store = (store_serializable_object_cb)g_known_format_store; } +#endif /****************************************************************************** @@ -188,24 +194,27 @@ static void g_known_format_finalize(GKnownFormat *format) /****************************************************************************** * * -* Paramètres : format = description du format connu à consulter. * +* Paramètres : format = description du format connu à consulter. * * content = contenu binaire à parcourir. * * * -* Description : Définit le contenu binaire à analyser. * +* Description : Met en place un nouveau contenu binaire à analyser. * * * -* Retour : - * +* Retour : Bilan de l'opération. * * * * Remarques : - * * * ******************************************************************************/ -void g_known_format_set_content(GKnownFormat *format, GBinContent *content) +bool g_known_format_create(GKnownFormat *format, GBinContent *content) { - assert(format->content == NULL); + bool result; /* Bilan à retourner */ - g_object_ref_sink(G_OBJECT(content)); + result = true; format->content = content; + ref_object(content); + + return result; } @@ -251,8 +260,13 @@ GBinContent *g_known_format_get_content(const GKnownFormat *format) char *g_known_format_get_key(const GKnownFormat *format) { char *result; /* Désignation à retourner */ + GKnownFormatClass *class; /* Classe de l'instance */ + + class = G_KNOWN_FORMAT_GET_CLASS(format); + + result = class->get_key(format); - result = G_KNOWN_FORMAT_GET_CLASS(format)->get_key(format); + //assert(result != NULL); return result; @@ -274,14 +288,21 @@ char *g_known_format_get_key(const GKnownFormat *format) char *g_known_format_get_description(const GKnownFormat *format) { char *result; /* Description à retourner */ + GKnownFormatClass *class; /* Classe de l'instance */ + + class = G_KNOWN_FORMAT_GET_CLASS(format); - result = G_KNOWN_FORMAT_GET_CLASS(format)->get_desc(format); + result = class->get_desc(format); + + //assert(result != NULL); return result; } +#if 0 + /****************************************************************************** * * * Paramètres : format = format chargé dont l'analyse est lancée. * @@ -343,13 +364,15 @@ void g_known_format_complete_analysis(GKnownFormat *format, wgroup_id_t gid, Gtk } +#endif + /* ---------------------------------------------------------------------------------- */ /* CONSERVATION ET RECHARGEMENT DES DONNEES */ /* ---------------------------------------------------------------------------------- */ - +#if 0 /****************************************************************************** * * * Paramètres : operand = élément GLib à constuire. * @@ -468,3 +491,4 @@ static bool g_known_format_store(GKnownFormat *format, GObjectStorage *storage, return result; } +#endif |