From c3330c06c74f8fadaeca7c684622166b1aa2ebb4 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 20 Oct 2008 17:04:17 +0000 Subject: [PATCH] Bug 557011 - Add g_object_info_get_abstract svn path=/trunk/; revision=757 --- ginfo.c | 8 ++++++++ girepository.h | 1 + girnode.c | 1 + girnode.h | 1 + girparser.c | 6 +++++- gtypelib.h | 9 +++++---- 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ginfo.c b/ginfo.c index ccb1760a9..c165ade0a 100644 --- a/ginfo.c +++ b/ginfo.c @@ -1123,6 +1123,14 @@ g_object_info_get_parent (GIObjectInfo *info) return NULL; } +gboolean +g_object_info_get_abstract (GIObjectInfo *info) +{ + GIBaseInfo *base = (GIBaseInfo *)info; + ObjectBlob *blob = (ObjectBlob *)&base->typelib->data[base->offset]; + return blob->abstract != 0; +} + const gchar * g_object_info_get_type_name (GIObjectInfo *info) { diff --git a/girepository.h b/girepository.h index 42db8d33c..2e6c5c8d5 100644 --- a/girepository.h +++ b/girepository.h @@ -392,6 +392,7 @@ GIValueInfo * g_enum_info_get_value (GIEnumInfo *in const gchar * g_object_info_get_type_name (GIObjectInfo *info); const gchar * g_object_info_get_type_init (GIObjectInfo *info); +gboolean g_object_info_get_abstract (GIObjectInfo *info); GIObjectInfo * g_object_info_get_parent (GIObjectInfo *info); gint g_object_info_get_n_interfaces (GIObjectInfo *info); GIInterfaceInfo * g_object_info_get_interface (GIObjectInfo *info, diff --git a/girnode.c b/girnode.c index f4f337a7e..ee1af3b37 100644 --- a/girnode.c +++ b/girnode.c @@ -1872,6 +1872,7 @@ g_ir_node_build_typelib (GIrNode *node, GList *members; blob->blob_type = BLOB_TYPE_OBJECT; + blob->abstract = object->abstract; blob->deprecated = object->deprecated; blob->reserved = 0; blob->name = write_string (node->name, strings, data, offset2); diff --git a/girnode.h b/girnode.h index eba8c6b96..905bf90a1 100644 --- a/girnode.h +++ b/girnode.h @@ -212,6 +212,7 @@ struct _GIrNodeInterface { GIrNode node; + gboolean abstract; gboolean deprecated; gchar *gtype_name; diff --git a/girparser.c b/girparser.c index f5bd7ccab..539d68d2e 100644 --- a/girparser.c +++ b/girparser.c @@ -1362,12 +1362,14 @@ start_class (GMarkupParseContext *context, const gchar *typename; const gchar *typeinit; const gchar *deprecated; + const gchar *abstract; name = find_attribute ("name", attribute_names, attribute_values); parent = find_attribute ("parent", attribute_names, attribute_values); typename = find_attribute ("glib:type-name", attribute_names, attribute_values); typeinit = find_attribute ("glib:get-type", attribute_names, attribute_values); deprecated = find_attribute ("deprecated", attribute_names, attribute_values); + abstract = find_attribute ("abstract", attribute_names, attribute_values); if (name == NULL) MISSING_ATTRIBUTE (context, error, element_name, "name"); @@ -1388,7 +1390,9 @@ start_class (GMarkupParseContext *context, iface->deprecated = TRUE; else iface->deprecated = FALSE; - + + iface->abstract = abstract && strcmp (abstract, "1") == 0; + ctx->current_node = (GIrNode *) iface; ctx->current_module->entries = g_list_append (ctx->current_module->entries, iface); diff --git a/gtypelib.h b/gtypelib.h index 54bf0523c..443d34b6c 100644 --- a/gtypelib.h +++ b/gtypelib.h @@ -407,9 +407,10 @@ typedef struct typedef struct { guint16 blob_type; /* 7 */ - guint16 deprecated : 1; - guint16 reserved :15; - guint32 name; + guint16 deprecated : 1; + guint16 abstract : 1; + guint16 reserved :14; + guint32 name; guint32 gtype_name; guint32 gtype_init; @@ -440,7 +441,7 @@ typedef struct typedef struct { guint16 blob_type; - guint16 deprecated : 1; + guint16 deprecated : 1; guint16 reserved :15; guint32 name;