summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-08-16 21:32:41 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-08-16 21:32:41 +0000
commitccabc562208ef0bbd493b47583b78f2d4a475051 (patch)
treeebffd049bc6852ce05f831148453e50bbb72b992 /giscanner
parent78cb9ef13df87dcfed0a7b87ca35eda7c332fc8f (diff)
downloadgobject-introspection-ccabc562208ef0bbd493b47583b78f2d4a475051.tar.gz
Parse boxed types.
2008-08-16 Johan Dahlin <johan@gnome.org> * giscanner/girparser.py: Parse boxed types. svn path=/trunk/; revision=385
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/girparser.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 30ed9dba..0cb6c084 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -21,7 +21,7 @@
from xml.etree.cElementTree import parse
from .ast import Alias, Callback, Function, Parameter, Return, Struct, Type
-from .glibast import GLibInterface, GLibObject
+from .glibast import GLibBoxed, GLibInterface, GLibObject
CORE_NS = "http://www.gtk.org/introspection/core/1.0"
C_NS = "http://www.gtk.org/introspection/c/1.0"
@@ -84,10 +84,11 @@ class GIRParser(object):
struct = Struct(node.attrib['name'],
node.attrib[_cns('type')])
self._add_node(struct)
+ elif node.tag == _glibns('boxed'):
+ self._parse_boxed(node)
elif node.tag in [_corens('interface'),
_corens('enumeration'),
_corens('bitfield'),
- _glibns('boxed'),
]:
pass
@@ -134,3 +135,16 @@ class GIRParser(object):
raise ValueError("failed to find type")
return Type(typenode.attrib['name'],
typenode.attrib[_cns('type')])
+
+ def _parse_boxed(self, node):
+ obj = GLibBoxed(node.attrib[_glibns('name')],
+ node.attrib[_glibns('type-name')],
+ node.attrib[_glibns('get-type')])
+ for method in node.findall(_corens('method')):
+ obj.methods.append(self._parse_function(method, Function))
+ for ctor in node.findall(_corens('constructor')):
+ obj.constructors.append(self._parse_function(ctor, Function))
+ for callback in node.findall(_corens('callback')):
+ obj.fields.append(self._parse_function(callback, Callback))
+ self._add_node(obj)
+