From 2daea47ccf175c2959ee2fc08f18fb171f4e4bb7 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 23 Sep 2008 14:18:44 +0000 Subject: [PATCH] Added C++ constructors to API reference --- direct/src/directscripts/gendocs.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/direct/src/directscripts/gendocs.py b/direct/src/directscripts/gendocs.py index 7cf1c7a6f8..6016d46611 100644 --- a/direct/src/directscripts/gendocs.py +++ b/direct/src/directscripts/gendocs.py @@ -634,6 +634,18 @@ class CodeDatabase: else: return pathToModule(type.file) + def getClassConstructors(self, cn): + # Only detects C++ constructors, not Python constructors, since + # those are treated as ordinary methods. + type = self.types.get(cn) + result = [] + if (isinstance(type, InterrogateType)): + for constructor in type.constructors: + func = type.db.functions[constructor] + if (func.classindex == type.index): + result.append(type.scopedname+"."+func.pyname) + return result + def getClassMethods(self, cn): type = self.types.get(cn) result = [] @@ -811,8 +823,12 @@ def generate(pversion, indirlist, directdirlist, docdir, header, footer, urlpref for sclass in inheritance: methods = code.getClassMethods(sclass)[:] methods.sort(None, str.lower) - if (len(methods) > 0): + constructors = code.getClassConstructors(sclass) + if (len(methods) > 0 or len(constructors) > 0): body = body + "

Methods of "+sclass+":

\n" for sclass in inheritance: + constructors = code.getClassConstructors(sclass) + for constructor in constructors: + body = body + generateFunctionDocs(code, constructor) methods = code.getClassMethods(sclass)[:] methods.sort(None, str.lower) for method in methods: