gobject-introspection r177 - trunk/giscanner
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r177 - trunk/giscanner
- Date: Fri, 18 Apr 2008 21:47:40 +0100 (BST)
Author: johan
Date: Fri Apr 18 20:47:40 2008
New Revision: 177
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=177&view=rev
Log:
Add support for enums
Modified:
trunk/giscanner/gidlwriter.py
Modified: trunk/giscanner/gidlwriter.py
==============================================================================
--- trunk/giscanner/gidlwriter.py (original)
+++ trunk/giscanner/gidlwriter.py Fri Apr 18 20:47:40 2008
@@ -1,4 +1,4 @@
-from giscanner.treebuilder import Function
+from giscanner.treebuilder import Enum, Function
from giscanner.xmlwriter import XMLWriter
@@ -21,6 +21,8 @@
def _write_node(self, node):
if isinstance(node, Function):
self._write_function(node)
+ elif isinstance(node, Enum):
+ self._write_enum(node)
else:
print 'Unhandled node', node
@@ -46,3 +48,13 @@
def _write_parameter(self, parameter):
self.write_tag('parameter', [('name', parameter.name),
('type', parameter.type)])
+
+ def _write_enum(self, enum):
+ self.push_tag('enum', [('name', enum.name)])
+ for member in enum.members:
+ self._write_member(member)
+ self.pop_tag()
+
+ def _write_member(self, member):
+ self.write_tag('member', [('name', member.name),
+ ('value', str(member.value))])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]