diff options
author | Colin Walters <walters@src.gnome.org> | 2009-02-06 18:37:13 +0000 |
---|---|---|
committer | Colin Walters <walters@src.gnome.org> | 2009-02-06 18:37:13 +0000 |
commit | d1bf6a23c6fa14e918aa93e346237b1c832fb2ea (patch) | |
tree | 715bf149bfa948eed8a1da945e2c0984ea81df73 /giscanner/girwriter.py | |
parent | 3ae9127e53032065df14be8539aba0cf50835386 (diff) | |
download | gobject-introspection-d1bf6a23c6fa14e918aa93e346237b1c832fb2ea.tar.gz |
Bug 551738 - Associate classes with their structs
Inside glibtransformer, we now look at structures ending in "Class" and
see if they have an associated GlibObject (i.e. a structure of the same
name without the "Class" suffix). If found, pair them up.
The .gir file for <class> gains an attribute denoting its associated
class struct. Any <record> many now have a glib:is-class-struct-for
annotation which tells which (if any) <class> for which it defines the
layout.
In the .typelib, we record the association between the class and
its structure. Generic structures however just have a boolean
saying whether they're a class struct. (Going from a generic class
struct to its class should not be necessary).
Finally, we expose GIRepository APIs to access both bits of information
from the .typelib.
svn path=/trunk/; revision=1088
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r-- | giscanner/girwriter.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index cd19e989..657063e6 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -298,6 +298,9 @@ and/or use gtk-doc annotations. ''') attrs.append(('glib:type-name', node.type_name)) if node.get_type: attrs.append(('glib:get-type', node.get_type)) + if isinstance(node, GLibObject): + if node.class_struct: + attrs.append(('glib:class-struct', node.class_struct.name)) with self.tagcontext(tag_name, attrs): if isinstance(node, GLibObject): for iface in node.interfaces: @@ -365,14 +368,17 @@ and/or use gtk-doc annotations. ''') return [('glib:type-name', boxed.type_name), ('glib:get-type', boxed.get_type)] - def _write_record(self, record): - attrs = [] + def _write_record(self, record, extra_attrs=[]): + attrs = list(extra_attrs) if record.name is not None: attrs.append(('name', record.name)) if record.symbol is not None: # the record might be anonymous attrs.append(('c:type', record.symbol)) if record.disguised: attrs.append(('disguised', '1')) + if record.is_gobject_struct_for: + attrs.append(('glib:is-class-struct-for', + record.is_gobject_struct_for)) if record.doc: attrs.append(('doc', record.doc)) self._append_version(record, attrs) |