From 52479107a695162a4098e75571617c997b1ee269 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Wed, 20 Jun 2001 02:32:10 +0000 Subject: [PATCH] added debugging variants g_type_name_from_class(), Wed Jun 20 03:59:42 2001 Tim Janik * gtype.[hc]: added debugging variants g_type_name_from_class(), g_type_name_from_instance(). --- gobject/ChangeLog | 5 +++++ gobject/gtype.c | 18 ++++++++++++++++++ gobject/gtype.h | 5 +++++ 3 files changed, 28 insertions(+) diff --git a/gobject/ChangeLog b/gobject/ChangeLog index 1993ca34e..201752313 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,3 +1,8 @@ +Wed Jun 20 03:59:42 2001 Tim Janik + + * gtype.[hc]: added debugging variants g_type_name_from_class(), + g_type_name_from_instance(). + Mon Jun 11 17:07:06 2001 Tim Janik * gboxed.[hc]: remove left-over usages of an anonymous GBoxed typedef. diff --git a/gobject/gtype.c b/gobject/gtype.c index 664580be3..50edc4582 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -2737,6 +2737,24 @@ g_type_value_table_peek (GType type) return vtable; } +G_CONST_RETURN gchar* +g_type_name_from_instance (GTypeInstance *instance) +{ + if (!instance) + return ""; + else + return g_type_name_from_class (instance->g_class); +} + +G_CONST_RETURN gchar* +g_type_name_from_class (GTypeClass *g_class) +{ + if (!g_class) + return ""; + else + return g_type_name (g_class->g_type); +} + /* --- foreign prototypes --- */ extern void g_value_types_init (void); /* sync with gvaluetypes.c */ diff --git a/gobject/gtype.h b/gobject/gtype.h index 2bdb5c295..07daee580 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -350,6 +350,11 @@ gboolean g_type_check_value_holds (GValue *value, GTypeValueTable* g_type_value_table_peek (GType type); +/* --- debugging functions --- */ +G_CONST_RETURN gchar* g_type_name_from_instance (GTypeInstance *instance); +G_CONST_RETURN gchar* g_type_name_from_class (GTypeClass *g_class); + + /* --- implementation bits --- */ #ifndef G_DISABLE_CAST_CHECKS # define _G_TYPE_CIC(ip, gt, ct) \