summaryrefslogtreecommitdiff
path: root/src/analysis/types/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/types/expr.c')
-rw-r--r--src/analysis/types/expr.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/analysis/types/expr.c b/src/analysis/types/expr.c
index 02005f4..1119ab6 100644
--- a/src/analysis/types/expr.c
+++ b/src/analysis/types/expr.c
@@ -61,6 +61,9 @@ static void g_expr_type_dispose(GExprType *);
/* Procède à la libération totale de la mémoire. */
static void g_expr_type_finalize(GExprType *);
+/* Calcule une empreinte pour un type de données. */
+static guint g_expr_type_hash(const GExprType *);
+
/* Crée un copie d'un type existant. */
static GDataType *g_expr_type_dup(const GExprType *);
@@ -97,6 +100,7 @@ static void g_expr_type_class_init(GExprTypeClass *klass)
type = G_DATA_TYPE_CLASS(klass);
+ type->hash = (type_hash_fc)g_expr_type_hash;
type->dup = (type_dup_fc)g_expr_type_dup;
type->to_string = (type_to_string_fc)g_expr_type_to_string;
@@ -190,6 +194,29 @@ GDataType *g_expr_type_new(const char *value)
/******************************************************************************
* *
+* Paramètres : type = type à consulter. *
+* *
+* Description : Calcule une empreinte pour un type de données. *
+* *
+* Retour : Valeur arbitraire sur 32 bits, idéalement unique par type. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static guint g_expr_type_hash(const GExprType *type)
+{
+ guint result; /* Empreinte à renvoyer */
+
+ result = g_str_hash(type->value);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : type = type à dupliquer. *
* *
* Description : Crée un copie d'un type existant. *