Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
Parse Doxygen's <qualifiedname> XML tag and add qualifiedname to …
Browse files Browse the repository at this point in the history
…Doxybook's

JSON output. This gives us a way to get the correct qualified name of any
entity without any extra hassle.
  • Loading branch information
brycelelbach committed Dec 24, 2021
1 parent 187dc29 commit 3bb4cdf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/Doxybook/Node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ namespace Doxybook2 {
return refid;
}

const std::string& getQualifiedName() const {
return qualifiedName;
}

const std::string& getName() const {
return name;
}
Expand Down Expand Up @@ -238,6 +242,7 @@ namespace Doxybook2 {
std::string language;
std::string refid;
std::string name;
std::string qualifiedName;
std::string brief;
std::string summary;
std::string title;
Expand Down
5 changes: 5 additions & 0 deletions src/Doxybook/JsonConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ nlohmann::json Doxybook2::JsonConverter::convert(const Node& node) const {
} else {
json["name"] = node.getName();
json["title"] = node.getTitle();
if (node.getQualifiedName().empty()) {
json["qualifiedname"] = node.getName();
} else {
json["qualifiedname"] = node.getQualifiedName();
}
}
if (!node.isStructured() && node.getKind() != Kind::MODULE && node.getKind() != Kind::DEFINE &&
node.getKind() != Kind::FILE && node.getKind() != Kind::DIR) {
Expand Down
8 changes: 8 additions & 0 deletions src/Doxybook/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ Doxybook2::NodePtr Doxybook2::Node::parse(Xml::Element& memberdef, const std::st

auto ptr = std::make_shared<Node>(refid);
ptr->name = assertChild(memberdef, "name").getText();

auto childQualifiedName = memberdef.firstChildElement("qualifiedname");
if (childQualifiedName) {
ptr->qualifiedName = childQualifiedName.getText();
} else {
ptr->qualifiedName = ptr->name;
}

ptr->kind = toEnumKind(memberdef.getAttr("kind"));
ptr->empty = true;
ptr->parseBaseInfo(memberdef);
Expand Down

0 comments on commit 3bb4cdf

Please # to comment.