From 03a7fe29fd5dddef5417aed55b4ce51ab1d6aa4f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 10 Jul 2014 11:11:52 +0200 Subject: [PATCH] Add attributes for classes in the XML file generated by the genapixml tool to tell whether a class is refcountable and/or destroyable. --- tools/genapixml.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/genapixml.py b/tools/genapixml.py index 9780e6957..92b503739 100755 --- a/tools/genapixml.py +++ b/tools/genapixml.py @@ -593,7 +593,30 @@ class Generator: functionNode.append(f.detailedDescription) def __generateClass(self, cclass, classesNode): - classNodeAttributes = { 'name' : cclass.name, 'cfunctionprefix' : cclass.cFunctionPrefix, 'deprecated' : str(cclass.deprecated).lower() } + has_ref_method = False + has_unref_method = False + has_destroy_method = False + for methodname in cclass.instanceMethods: + methodname_without_prefix = methodname.replace(cclass.cFunctionPrefix, '') + if methodname_without_prefix == 'ref': + has_ref_method = True + elif methodname_without_prefix == 'unref': + has_unref_method = True + elif methodname_without_prefix == 'destroy': + has_destroy_method = True + refcountable = False + destroyable = False + if has_ref_method and has_unref_method: + refcountable = True + if has_destroy_method: + destroyable = True + classNodeAttributes = { + 'name' : cclass.name, + 'cfunctionprefix' : cclass.cFunctionPrefix, + 'deprecated' : str(cclass.deprecated).lower(), + 'refcountable' : str(refcountable).lower(), + 'destroyable' : str(destroyable).lower() + } classNode = ET.SubElement(classesNode, 'class', classNodeAttributes) if len(cclass.events) > 0: eventsNode = ET.SubElement(classNode, 'events')