Skip to content

Commit

Permalink
core: fix usage of reserved C++ types
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed May 9, 2024
1 parent 94e32ec commit 232fa45
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ struct {
std::vector<SEnum> enums;
} XMLDATA;

std::string sanitize(const std::string& in) {
if (in == "namespace")
return "namespace_";
if (in == "class")
return "class_";
if (in == "delete")
return "delete_";
if (in == "new")
return "new_";
return in;
}

std::string argsToShort(std::vector<SRequestArgument>& args, const std::string& since) {
std::string shortt = since;
for (auto& a : args) {
Expand Down Expand Up @@ -174,7 +186,7 @@ void parseXML(pugi::xml_document& doc) {

for (auto& arg : rq.children("arg")) {
SRequestArgument sargm;
sargm.name = arg.attribute("name").as_string();
sargm.name = sanitize(arg.attribute("name").as_string());
sargm.wlType = arg.attribute("type").as_string();
sargm.interface = arg.attribute("interface").as_string();
sargm.enumName = arg.attribute("enum").as_string();
Expand All @@ -193,7 +205,7 @@ void parseXML(pugi::xml_document& doc) {

for (auto& arg : ev.children("arg")) {
SRequestArgument sargm;
sargm.name = arg.attribute("name").as_string();
sargm.name = sanitize(arg.attribute("name").as_string());
sargm.interface = arg.attribute("interface").as_string();
sargm.wlType = arg.attribute("type").as_string();
sargm.enumName = arg.attribute("enum").as_string();
Expand Down

0 comments on commit 232fa45

Please sign in to comment.