diff options
author | Colin Walters <walters@verbum.org> | 2009-02-19 21:48:51 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2009-03-03 17:26:37 -0500 |
commit | d5215b23315e7c9c22c6a32218bb6f8027a9dd4c (patch) | |
tree | e8d9e360099c756677ad23a1039f4d05533008b9 /giscanner/girwriter.py | |
parent | 2bdd2bf9303ae0e718c00ec84078336e722138f1 (diff) | |
download | gobject-introspection-d5215b23315e7c9c22c6a32218bb6f8027a9dd4c.tar.gz |
Bug 571548 - Generic attributes
We now support an extensible mechanism where arbitrary key-value
pairs may be associated with almost all items, including objects,
methods, and properties.
These attributes appear in both the .gir and the .typelib.
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r-- | giscanner/girwriter.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index df527090..88510b04 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -137,6 +137,10 @@ and/or use gtk-doc annotations. ''') if node.version: attrs.append(('version', node.version)) + def _write_attributes(self, node): + for key, value in node.attributes: + self.write_tag('attribute', [('name', key), ('value', value)]) + def _append_deprecated(self, node, attrs): if node.deprecated: attrs.append(('deprecated', node.deprecated)) @@ -163,6 +167,7 @@ and/or use gtk-doc annotations. ''') self._append_deprecated(func, attrs) self._append_throws(func, attrs) with self.tagcontext(tag_name, attrs): + self._write_attributes(func) self._write_return_type(func.retval) self._write_parameters(func.parameters) @@ -280,6 +285,7 @@ and/or use gtk-doc annotations. ''') attrs.append(('c:type', enum.symbol)) with self.tagcontext('enumeration', attrs): + self._write_attributes(enum) for member in enum.members: self._write_member(member) @@ -296,6 +302,7 @@ and/or use gtk-doc annotations. ''') else: attrs.append(('c:type', bitfield.symbol)) with self.tagcontext('bitfield', attrs): + self._write_attributes(bitfield) for member in bitfield.members: self._write_member(member) @@ -335,6 +342,7 @@ and/or use gtk-doc annotations. ''') if node.glib_type_struct: attrs.append(('glib:type-struct', node.glib_type_struct.name)) with self.tagcontext(tag_name, attrs): + self._write_attributes(node) if isinstance(node, GLibObject): for iface in node.interfaces: self.write_tag('implements', [('name', iface)]) @@ -362,6 +370,7 @@ and/or use gtk-doc annotations. ''') attrs.append(('doc', boxed.doc)) attrs.extend(self._boxed_attrs(boxed)) with self.tagcontext('glib:boxed', attrs): + self._write_attributes(boxed) for method in boxed.constructors: self._write_constructor(method) for method in boxed.methods: @@ -383,6 +392,7 @@ and/or use gtk-doc annotations. ''') if prop.doc: attrs.append(('doc', prop.doc)) with self.tagcontext('property', attrs): + self._write_attributes(prop) self._write_type(prop.type) def _write_callback(self, callback): @@ -394,6 +404,7 @@ and/or use gtk-doc annotations. ''') self._append_deprecated(callback, attrs) self._append_throws(callback, attrs) with self.tagcontext('callback', attrs): + self._write_attributes(callback) self._write_return_type(callback.retval) self._write_parameters(callback.parameters) @@ -420,6 +431,7 @@ and/or use gtk-doc annotations. ''') if isinstance(record, GLibBoxed): attrs.extend(self._boxed_attrs(record)) with self.tagcontext('record', attrs): + self._write_attributes(record) if record.fields: for field in record.fields: self._write_field(field) @@ -441,6 +453,7 @@ and/or use gtk-doc annotations. ''') if isinstance(union, GLibBoxed): attrs.extend(self._boxed_attrs(union)) with self.tagcontext('union', attrs): + self._write_attributes(union) if union.fields: for field in union.fields: self._write_field(field) @@ -471,6 +484,7 @@ and/or use gtk-doc annotations. ''') if field.bits: attrs.append(('bits', str(field.bits))) with self.tagcontext('field', attrs): + self._write_attributes(field) self._write_type(field.type) def _write_signal(self, signal): @@ -480,5 +494,6 @@ and/or use gtk-doc annotations. ''') self._append_version(signal, attrs) self._append_deprecated(signal, attrs) with self.tagcontext('glib:signal', attrs): + self._write_attributes(signal) self._write_return_type(signal.retval) self._write_parameters(signal.parameters) |