core: fix usage of reserved C++ types

This commit is contained in:
Vaxry 2024-05-09 21:16:32 +01:00
parent 94e32ec37e
commit 232fa45d54

View file

@ -46,6 +46,18 @@ struct {
std::vector<SEnum> enums; std::vector<SEnum> enums;
} XMLDATA; } 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 argsToShort(std::vector<SRequestArgument>& args, const std::string& since) {
std::string shortt = since; std::string shortt = since;
for (auto& a : args) { for (auto& a : args) {
@ -174,7 +186,7 @@ void parseXML(pugi::xml_document& doc) {
for (auto& arg : rq.children("arg")) { for (auto& arg : rq.children("arg")) {
SRequestArgument sargm; 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.wlType = arg.attribute("type").as_string();
sargm.interface = arg.attribute("interface").as_string(); sargm.interface = arg.attribute("interface").as_string();
sargm.enumName = arg.attribute("enum").as_string(); sargm.enumName = arg.attribute("enum").as_string();
@ -193,7 +205,7 @@ void parseXML(pugi::xml_document& doc) {
for (auto& arg : ev.children("arg")) { for (auto& arg : ev.children("arg")) {
SRequestArgument sargm; 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.interface = arg.attribute("interface").as_string();
sargm.wlType = arg.attribute("type").as_string(); sargm.wlType = arg.attribute("type").as_string();
sargm.enumName = arg.attribute("enum").as_string(); sargm.enumName = arg.attribute("enum").as_string();