Skip to content

Commit

Permalink
Fix parsing of C++ doxygen entities
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Oct 29, 2024
1 parent 27504b7 commit 3a549b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion c/apidoc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ EXTRACT_ALL = NO
# be included in the documentation.
# The default value is: NO.

EXTRACT_PRIVATE = NO
EXTRACT_PRIVATE = YES

# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
# methods of a class will be included in the documentation.
Expand Down
22 changes: 16 additions & 6 deletions docs/source/ext/doxygen_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,19 @@ def scrape_links(item_id_to_url, root):
if kind == "dir":
# Ignore, this is generated for a directory
continue
elif kind in ("file", "group", "struct"):
elif kind in ("class", "file", "group", "struct"):
outer_domain = "c"
if kind == "file":
name = compounddef.find("compoundname").text
file_id = compounddef.attrib["id"]
yield ("std", name, "doc", "", f"{file_id}.html")
elif kind == "struct":
elif kind in {"class", "struct"}:
name = compounddef.find("compoundname").text
anchor = compounddef.attrib["id"]
url = item_id_to_url[anchor]
yield ("c", name, "struct", anchor, url)
if kind == "class" or "::" in name:
outer_domain = "cpp"
yield (outer_domain, name, kind, anchor, url)

for memberdef in compounddef.findall(".//memberdef"):
member_kind = memberdef.attrib.get("kind")
Expand All @@ -73,21 +76,27 @@ def scrape_links(item_id_to_url, root):
name = memberdef.find("name").text
typ = "macro"
elif member_kind == "function":
domain = "c"
name = memberdef.find("name").text
domain = outer_domain
qualified = memberdef.find("qualifiedname")
if qualified is not None:
name = qualified.text
else:
name = memberdef.find("name").text
typ = "function"
elif member_kind == "typedef":
domain = "c"
name = memberdef.find("name").text
typ = "type"
elif member_kind == "variable":
domain = "c"
domain = outer_domain
name = memberdef.find("qualifiedname").text
typ = "member"
elif member_kind == "enum":
domain = "c"
name = memberdef.find("name").text
typ = "enum"
elif member_kind == "friend":
continue
else:
raise NotImplementedError(
f"<memberdef kind=\"{memberdef.attrib['kind']}\"> not supported"
Expand Down Expand Up @@ -124,6 +133,7 @@ def make_fake_domains(
item_id_to_url = {}
html_name = re.compile(r'name="([^\"]+)"')
for index in html_root.rglob("*.html"):
item_id_to_url[index.stem] = str(index.relative_to(html_root))
with index.open() as source:
matches = html_name.findall(source.read())
for m in matches:
Expand Down

0 comments on commit 3a549b6

Please sign in to comment.