diff options
author | Tim Janik <timj@gtk.org> | 1998-09-05 06:54:20 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-09-05 06:54:20 +0000 |
commit | 78dbc1efdb39a1f70ea0782f1042187695a79bf7 (patch) | |
tree | c62984ec2a124d6911c1bb6d8af845add5316d59 /gtk/gtkobject.c | |
parent | 0f0d9509c061a1df2a6386e9ddc02ee4a921de26 (diff) | |
download | gtk+-78dbc1efdb39a1f70ea0782f1042187695a79bf7.tar.gz |
don't include any gdk headers. added structure definitions for
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
added structure definitions for GtkTypeObject and GtkTypeClass,
which cover the very basic fields of GtkObject and GtkObjectClass,
which are actually used by the type system.
* gtk/gtktypeutils.c: don't include gtkobject.h or gtkcontainer.h,
we only refer to our own structures. improved class inheritance
sanity checking a bit.
* gtk/gtkobject.h: placed appropriate comments at the beginnings
of the GtkObject and GtkObjectClass structures, which explain
their relationship to GtkTypeObject and GtkTypeClass.
* gtk/gtktypeutils.h:
* gtk/gtkobject.h:
moved GTK_STRUCT_OFFSET(), GTK_CHECK_CAST(), GTK_CHECK_CLASS_CAST(),
GTK_CHECK_TYPE() and GTK_CHECK_CLASS_TYPE() macro definitions from
gtkobject.h to gtktypeutils.h.
* gtk/gtkobject.h:
* gtk/gtkobject.c:
removed gtk_object_check_cast() and gtk_object_check_class_cast()
functions. to keep source compatibility, we can provide macro aliases
for the corresponding gtk_type_* functions. but then again, people
shouldn't have been using these functions anyways since they were part
of Gtk's internal API.
* gtk/gtktypeutils.h:
* gtk/gtktypeutils.c:
implemented gtk_type_check_object_cast() and gtk_type_check_class_cast()
functions to check GtkTypeObject and GtkTypeClass types.
Diffstat (limited to 'gtk/gtkobject.c')
-rw-r--r-- | gtk/gtkobject.c | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c index d65aeea23a..9a8014e4ee 100644 --- a/gtk/gtkobject.c +++ b/gtk/gtkobject.c @@ -917,85 +917,6 @@ gtk_object_query_args (GtkType class_type, return gtk_args_query (class_type, object_arg_info_ht, arg_flags, n_args); } -/******************************************************** - * GtkObject and GtkObjectClass cast checking functions - * - ********************************************************/ - -static gchar* -gtk_object_descriptive_type_name (GtkType type) -{ - gchar *name; - - name = gtk_type_name (type); - if (!name) - name = "(unknown)"; - - return name; -} - -GtkObject* -gtk_object_check_cast (GtkObject *obj, - GtkType cast_type) -{ - if (!obj) - { - g_warning ("invalid cast from (NULL) pointer to `%s'", - gtk_object_descriptive_type_name (cast_type)); - return obj; - } - if (!obj->klass) - { - g_warning ("invalid unclassed pointer in cast to `%s'", - gtk_object_descriptive_type_name (cast_type)); - return obj; - } - if (obj->klass->type < GTK_TYPE_OBJECT) - { - g_warning ("invalid class type `%s' in cast to `%s'", - gtk_object_descriptive_type_name (obj->klass->type), - gtk_object_descriptive_type_name (cast_type)); - return obj; - } - if (!gtk_type_is_a (obj->klass->type, cast_type)) - { - g_warning ("invalid cast from `%s' to `%s'", - gtk_object_descriptive_type_name (obj->klass->type), - gtk_object_descriptive_type_name (cast_type)); - return obj; - } - - return obj; -} - -GtkObjectClass* -gtk_object_check_class_cast (GtkObjectClass *klass, - GtkType cast_type) -{ - if (!klass) - { - g_warning ("invalid class cast from (NULL) pointer to `%s'", - gtk_object_descriptive_type_name (cast_type)); - return klass; - } - if (klass->type < GTK_TYPE_OBJECT) - { - g_warning ("invalid class type `%s' in class cast to `%s'", - gtk_object_descriptive_type_name (klass->type), - gtk_object_descriptive_type_name (cast_type)); - return klass; - } - if (!gtk_type_is_a (klass->type, cast_type)) - { - g_warning ("invalid class cast from `%s' to `%s'", - gtk_object_descriptive_type_name (klass->type), - gtk_object_descriptive_type_name (cast_type)); - return klass; - } - - return klass; -} - /***************************************** * GtkObject object_data mechanism * |