This commit is contained in:
Vaxry 2024-06-18 17:45:58 +02:00
parent 9a0f8aaee5
commit 88d37c9d2d

View file

@ -17,6 +17,7 @@ struct SRequestArgument {
std::string interface; std::string interface;
std::string enumName; std::string enumName;
std::string name; std::string name;
bool newType = false;
bool allowNull = false; bool allowNull = false;
}; };
@ -192,11 +193,10 @@ void parseXML(pugi::xml_document& doc) {
for (auto& arg : rq.children("arg")) { for (auto& arg : rq.children("arg")) {
SRequestArgument sargm; SRequestArgument sargm;
if (arg.attribute("type").as_string() == std::string{"new_id"} && clientCode) { if (arg.attribute("type").as_string() == std::string{"new_id"} && clientCode)
srq.newIdType = arg.attribute("interface").as_string(); srq.newIdType = arg.attribute("interface").as_string();
continue;
}
sargm.newType = arg.attribute("type").as_string() == std::string{"new_id"} && clientCode;
sargm.name = sanitize(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();
@ -384,6 +384,8 @@ class {} {{
std::string args = ", "; std::string args = ", ";
for (auto& arg : rq.args) { for (auto& arg : rq.args) {
if (arg.newType)
continue;
args += WPTypeToCType(arg, false) + ", "; args += WPTypeToCType(arg, false) + ", ";
} }
@ -400,6 +402,8 @@ class {} {{
for (auto& ev : (!clientCode ? iface.events : iface.requests)) { for (auto& ev : (!clientCode ? iface.events : iface.requests)) {
std::string args = ""; std::string args = "";
for (auto& arg : ev.args) { for (auto& arg : ev.args) {
if (arg.newType)
continue;
args += WPTypeToCType(arg, true) + ", "; args += WPTypeToCType(arg, true) + ", ";
} }
@ -416,6 +420,8 @@ class {} {{
for (auto& ev : (!clientCode ? iface.events : iface.requests)) { for (auto& ev : (!clientCode ? iface.events : iface.requests)) {
std::string args = ""; std::string args = "";
for (auto& arg : ev.args) { for (auto& arg : ev.args) {
if (arg.newType)
continue;
args += WPTypeToCType(arg, true, true) + ", "; args += WPTypeToCType(arg, true, true) + ", ";
} }
@ -440,6 +446,8 @@ class {} {{
std::string args = ", "; std::string args = ", ";
for (auto& arg : rq.args) { for (auto& arg : rq.args) {
if (arg.newType)
continue;
args += WPTypeToCType(arg, false) + ", "; args += WPTypeToCType(arg, false) + ", ";
} }
@ -561,6 +569,8 @@ static const wl_interface* dummyTypes[] = { nullptr };
std::string argsC = ", "; std::string argsC = ", ";
for (auto& arg : rq.args) { for (auto& arg : rq.args) {
if (arg.newType)
continue;
argsC += WPTypeToCType(arg, false) + " " + arg.name + ", "; argsC += WPTypeToCType(arg, false) + " " + arg.name + ", ";
} }
@ -633,6 +643,8 @@ static const void* {}[] = {{
std::string argsC = ""; std::string argsC = "";
for (auto& arg : ev.args) { for (auto& arg : ev.args) {
if (arg.newType)
continue;
argsC += WPTypeToCType(arg, true) + " " + arg.name + ", "; argsC += WPTypeToCType(arg, true) + " " + arg.name + ", ";
} }
@ -643,6 +655,8 @@ static const void* {}[] = {{
std::string argsN = ", "; std::string argsN = ", ";
for (auto& arg : ev.args) { for (auto& arg : ev.args) {
if (arg.newType)
continue;
if (!WPTypeToCType(arg, true).starts_with("C")) if (!WPTypeToCType(arg, true).starts_with("C"))
argsN += arg.name + ", "; argsN += arg.name + ", ";
else else
@ -689,6 +703,8 @@ void {}::{}({}) {{
std::string argsC = ""; std::string argsC = "";
for (auto& arg : ev.args) { for (auto& arg : ev.args) {
if (arg.newType)
continue;
argsC += WPTypeToCType(arg, true, true) + " " + arg.name + ", "; argsC += WPTypeToCType(arg, true, true) + " " + arg.name + ", ";
} }
@ -699,6 +715,8 @@ void {}::{}({}) {{
std::string argsN = ", "; std::string argsN = ", ";
for (auto& arg : ev.args) { for (auto& arg : ev.args) {
if (arg.newType)
continue;
argsN += arg.name + ", "; argsN += arg.name + ", ";
} }