[gobject-introspection/gir-docbook] [docbook] Print out element types of arrays, lists and hashtables.
- From: Laszlo Pandy <lpandy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/gir-docbook] [docbook] Print out element types of arrays, lists and hashtables.
- Date: Thu, 11 Aug 2011 15:19:41 +0000 (UTC)
commit 9765afc39dfa5e5b4f9ec90a0ab28bc96d2ab694
Author: Laszlo Pandy <lpandy src gnome org>
Date: Thu Aug 11 17:14:26 2011 +0200
[docbook] Print out element types of arrays, lists and hashtables.
giscanner/docbookwriter.py | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/docbookwriter.py b/giscanner/docbookwriter.py
index 3dc88c2..0de8b58 100644
--- a/giscanner/docbookwriter.py
+++ b/giscanner/docbookwriter.py
@@ -100,6 +100,19 @@ class DocBookFormatter(object):
return node.ctype
return node.gtype_name
+ def get_type_name(self, node):
+ if isinstance(node, ast.Array):
+ if node.array_type == ast.Array.C:
+ return str(node.element_type) + "[]"
+ else:
+ return "%s<%s>" % (node.array_type, str(node.element_type))
+ elif isinstance(node, ast.Map):
+ return "GHashTable<%s, %s>" % (str(node.key_type), str(node.value_type))
+ elif isinstance(node, ast.List):
+ return "GList<%s>" % str(node.element_type)
+ else:
+ return str(node)
+
def render_method(self, entity, link=False):
method = entity.get_ast()
self._writer.disable_whitespace()
@@ -137,6 +150,7 @@ class DocBookFormatter(object):
prop = entity.get_ast()
prop_name = '"%s"' % prop.name
+ prop_type = self.get_type_name(prop.type)
flags = []
if prop.readable:
@@ -148,7 +162,7 @@ class DocBookFormatter(object):
if prop.construct_only:
flags.append("Construct Only")
- self._render_prop_or_signal(prop_name, prop.type, flags)
+ self._render_prop_or_signal(prop_name, prop_type, flags)
def _render_prop_or_signal(self, name, type_, flags):
self._writer.disable_whitespace()
@@ -377,10 +391,10 @@ class DocBookWriter(object):
self._writer.pop_tag()
def _render_property(self, entity):
- pass
+ self._writer.write_line("Not implemented yet")
def _render_signal(self, entity):
- pass
+ self._writer.write_line("Not implemented yet")
def _render_page_object_hierarchy(self, page_node):
parent_chain = self._get_parent_chain(page_node)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]