From 2140729798ac2c52f96a00d092f831c3a944c61d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 18 Jan 2018 14:14:29 +0100 Subject: [PATCH] doxygen: list base and derived classes. --- doxygen/dox2html5.py | 44 +++++++++++++++ doxygen/templates/base-class-reference.html | 26 +++++++++ doxygen/templates/entry-class.html | 4 +- doxygen/test/cpp_derived/Doxyfile | 11 ++++ doxygen/test/cpp_derived/classA.html | 54 +++++++++++++++++++ .../test/cpp_derived/classPrivateBase.html | 31 +++++++++++ .../test/cpp_derived/classProtectedBase.html | 40 ++++++++++++++ .../test/cpp_derived/classVirtualBase.html | 40 ++++++++++++++ doxygen/test/cpp_derived/input.h | 22 ++++++++ doxygen/test/test_cpp.py | 11 ++++ 10 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 doxygen/test/cpp_derived/Doxyfile create mode 100644 doxygen/test/cpp_derived/classA.html create mode 100644 doxygen/test/cpp_derived/classPrivateBase.html create mode 100644 doxygen/test/cpp_derived/classProtectedBase.html create mode 100644 doxygen/test/cpp_derived/classVirtualBase.html create mode 100644 doxygen/test/cpp_derived/input.h diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 7fce3351..c65ba3cd 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -1298,6 +1298,8 @@ def parse_xml(state: State, xml: str): compound.files = [] compound.namespaces = [] compound.classes = [] + compound.base_classes = [] + compound.derived_classes = [] compound.enums = [] compound.typedefs = [] compound.funcs = [] @@ -1435,6 +1437,48 @@ def parse_xml(state: State, xml: str): assert compound.kind in ['namespace', 'file'] compound.classes += [class_] + # Base class (if it links to anywhere) + elif compounddef_child.tag == 'basecompoundref': + assert compound.kind in ['class', 'struct', 'union'] + + if 'refid' in compounddef_child.attrib: + id = compounddef_child.attrib['refid'] + + # Add it only if it's not private and we have documentation for it + if not compounddef_child.attrib['prot'] == 'private' and id in state.compounds and state.compounds[id].has_details: + symbol = state.compounds[id] + + class_ = Empty() + class_.kind = symbol.kind + class_.url = symbol.url + class_.name = symbol.leaf_name + class_.brief = symbol.brief + class_.templates = symbol.templates + class_.is_protected = compounddef_child.attrib['prot'] == 'protected' + class_.is_virtual = compounddef_child.attrib['virt'] == 'virtual' + + compound.base_classes += [class_] + + # Derived class (if it links to anywhere) + elif compounddef_child.tag == 'derivedcompoundref': + assert compound.kind in ['class', 'struct', 'union'] + + if 'refid' in compounddef_child.attrib: + id = compounddef_child.attrib['refid'] + + # Add it only if it's not private and we have documentation for it + if not compounddef_child.attrib['prot'] == 'private' and id in state.compounds and state.compounds[id].has_details: + symbol = state.compounds[id] + + class_ = Empty() + class_.kind = symbol.kind + class_.url = symbol.url + class_.name = symbol.leaf_name + class_.brief = symbol.brief + class_.templates = symbol.templates + + compound.derived_classes += [class_] + # Other, grouped in sections elif compounddef_child.tag == 'sectiondef': if compounddef_child.attrib['kind'] == 'enum': diff --git a/doxygen/templates/base-class-reference.html b/doxygen/templates/base-class-reference.html index 48d59247..3174bda2 100644 --- a/doxygen/templates/base-class-reference.html +++ b/doxygen/templates/base-class-reference.html @@ -60,6 +60,12 @@
  • Reference