diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2024-05-20 15:15:25 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2024-05-20 15:15:25 (GMT) |
commit | 6decc8c40dfaf7cb04156f1ab233cd856ed06b37 (patch) | |
tree | 7a326fc66d2465bdedc978146faef55e53531652 /src/analysis | |
parent | 79662ede83b35ad9d91b942218cf09e856e48b4c (diff) |
Improve the DECLARE_GTYPE() macro and use it everywhere.
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/content.h | 17 | ||||
-rw-r--r-- | src/analysis/contents/encapsulated.h | 18 | ||||
-rw-r--r-- | src/analysis/contents/file.h | 18 | ||||
-rw-r--r-- | src/analysis/contents/memory.h | 18 | ||||
-rw-r--r-- | src/analysis/contents/restricted.h | 18 |
5 files changed, 15 insertions, 74 deletions
diff --git a/src/analysis/content.h b/src/analysis/content.h index ad50c02..ce6810f 100644 --- a/src/analysis/content.h +++ b/src/analysis/content.h @@ -32,26 +32,15 @@ //#include "cattribs.h" // FIXME #include "../arch/vmpa.h" #include "../common/leb128.h" +#include "../glibext/helpers.h" -#define G_TYPE_BIN_CONTENT g_binary_content_get_type() -#define G_BIN_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_BIN_CONTENT, GBinContent)) -#define G_IS_BIN_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_BIN_CONTENT)) -#define G_BIN_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BIN_CONTENT, GBinContentClass)) -#define G_IS_BIN_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BIN_CONTENT)) -#define G_BIN_CONTENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BIN_CONTENT, GBinContentClass)) +#define G_TYPE_BIN_CONTENT (g_binary_content_get_type()) +DECLARE_GTYPE(GBinContent, g_binary_content, G, BIN_CONTENT); -/* Accès à un contenu binaire quelconque (instance) */ -typedef struct _GBinContent GBinContent; -/* Accès à un contenu binaire quelconque (classe) */ -typedef struct _GBinContentClass GBinContentClass; - - -/* Détermine le type d'un contenu binaire à parcourir. */ -GType g_binary_content_get_type(void) G_GNUC_CONST; #if 0 // FIXME /* Associe un ensemble d'attributs au contenu binaire. */ void g_binary_content_set_attributes(GBinContent *, GContentAttributes *); diff --git a/src/analysis/contents/encapsulated.h b/src/analysis/contents/encapsulated.h index 9b74eac..bfd17e7 100644 --- a/src/analysis/contents/encapsulated.h +++ b/src/analysis/contents/encapsulated.h @@ -29,26 +29,14 @@ #include "../content.h" +#include "../../glibext/helpers.h" -#define G_TYPE_ENCAPS_CONTENT (g_encaps_content_get_type()) -#define G_ENCAPS_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_ENCAPS_CONTENT, GEncapsContent)) -#define G_IS_ENCAPS_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_ENCAPS_CONTENT)) -#define G_ENCAPS_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ENCAPS_CONTENT, GEncapsContentClass)) -#define G_IS_ENCAPS_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ENCAPS_CONTENT)) -#define G_ENCAPS_CONTENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ENCAPS_CONTENT, GEncapsContentClass)) +#define G_TYPE_ENCAPS_CONTENT (g_encaps_content_get_type()) +DECLARE_GTYPE(GEncapsContent, g_encaps_content, G, ENCAPS_CONTENT); -/* Contenu de issu d'un contenu plus global (instance) */ -typedef struct _GEncapsContent GEncapsContent; - -/* Contenu de issu d'un contenu plus global (classe) */ -typedef struct _GEncapsContentClass GEncapsContentClass; - - -/* Indique le type défini par la GLib pour les contenus encapsulés. */ -GType g_encaps_content_get_type(void); /* Charge en mémoire un contenu binaire encapsulé. */ GBinContent *g_encaps_content_new(GBinContent *, const char *, GBinContent *); diff --git a/src/analysis/contents/file.h b/src/analysis/contents/file.h index 5039f81..c54d890 100644 --- a/src/analysis/contents/file.h +++ b/src/analysis/contents/file.h @@ -29,26 +29,14 @@ #include "../content.h" +#include "../../glibext/helpers.h" -#define G_TYPE_FILE_CONTENT (g_file_content_get_type()) -#define G_FILE_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FILE_CONTENT, GFileContent)) -#define G_IS_FILE_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FILE_CONTENT)) -#define G_FILE_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FILE_CONTENT, GFileContentClass)) -#define G_IS_FILE_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FILE_CONTENT)) -#define G_FILE_CONTENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_FILE_CONTENT, GFileContentClass)) +#define G_TYPE_FILE_CONTENT (g_file_content_get_type()) +DECLARE_GTYPE(GFileContent, g_file_content, G, FILE_CONTENT); -/* Contenu de données binaires issues d'un fichier (instance) */ -typedef struct _GFileContent GFileContent; - -/* Contenu de données binaires issues d'un fichier (classe) */ -typedef struct _GFileContentClass GFileContentClass; - - -/* Indique le type défini par la GLib pour les contenus de données. */ -GType g_file_content_get_type(void); /* Charge en mémoire le contenu d'un fichier donné. */ GBinContent *g_file_content_new(const char *); diff --git a/src/analysis/contents/memory.h b/src/analysis/contents/memory.h index 1759e69..20e3d18 100644 --- a/src/analysis/contents/memory.h +++ b/src/analysis/contents/memory.h @@ -29,26 +29,14 @@ #include "../content.h" +#include "../../glibext/helpers.h" -#define G_TYPE_MEMORY_CONTENT (g_memory_content_get_type()) -#define G_MEMORY_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_MEMORY_CONTENT, GMemoryContent)) -#define G_IS_MEMORY_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_MEMORY_CONTENT)) -#define G_MEMORY_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_MEMORY_CONTENT, GMemoryContentClass)) -#define G_IS_MEMORY_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_MEMORY_CONTENT)) -#define G_MEMORY_CONTENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_MEMORY_CONTENT, GMemoryContentClass)) +#define G_TYPE_MEMORY_CONTENT (g_memory_content_get_type()) +DECLARE_GTYPE(GMemoryContent, g_memory_content, G, MEMORY_CONTENT); -/* Contenu de données binaires résidant en mémoire (instance) */ -typedef struct _GMemoryContent GMemoryContent; - -/* Contenu de données binaires résidant en mémoire (classe) */ -typedef struct _GMemoryContentClass GMemoryContentClass; - - -/* Indique le type défini par la GLib pour les contenus de données en mémoire. */ -GType g_memory_content_get_type(void); /* Charge en mémoire le contenu de données brutes. */ GBinContent *g_memory_content_new(const bin_t *, phys_t); diff --git a/src/analysis/contents/restricted.h b/src/analysis/contents/restricted.h index 1cea390..3925233 100644 --- a/src/analysis/contents/restricted.h +++ b/src/analysis/contents/restricted.h @@ -29,26 +29,14 @@ #include "../content.h" +#include "../../glibext/helpers.h" -#define G_TYPE_RESTRICTED_CONTENT (g_restricted_content_get_type()) -#define G_RESTRICTED_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_RESTRICTED_CONTENT, GRestrictedContent)) -#define G_IS_RESTRICTED_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_RESTRICTED_CONTENT)) -#define G_RESTRICTED_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_RESTRICTED_CONTENT, GRestrictedContentClass)) -#define G_IS_RESTRICTED_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_RESTRICTED_CONTENT)) -#define G_RESTRICTED_CONTENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_RESTRICTED_CONTENT, GRestrictedContentClass)) +#define G_TYPE_RESTRICTED_CONTENT (g_restricted_content_get_type()) +DECLARE_GTYPE(GRestrictedContent, g_restricted_content, G, RESTRICTED_CONTENT); -/* Contenu de données binaires issues d'un contenu restreint (instance) */ -typedef struct _GRestrictedContent GRestrictedContent; - -/* Contenu de données binaires issues d'un contenu restreint (classe) */ -typedef struct _GRestrictedContentClass GRestrictedContentClass; - - -/* Indique le type défini par la GLib pour les contenus de données. */ -GType g_restricted_content_get_type(void); /* Charge en mémoire le contenu d'un contenu restreint. */ GBinContent *g_restricted_content_new(GBinContent *, const mrange_t *); |