mirror of
https://github.com/hyprwm/hyprwayland-scanner.git
synced 2024-11-26 10:55:59 +01:00
core: add support for nullable objects
This commit is contained in:
parent
1cfe2d26a8
commit
4eb457b3f7
1 changed files with 6 additions and 3 deletions
|
@ -13,6 +13,7 @@ struct SRequestArgument {
|
||||||
std::string interface;
|
std::string interface;
|
||||||
std::string enumName;
|
std::string enumName;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
bool allowNull = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SRequest {
|
struct SRequest {
|
||||||
|
@ -59,7 +60,7 @@ std::string argsToShort(std::vector<SRequestArgument>& args) {
|
||||||
else if (a.wlType == "string")
|
else if (a.wlType == "string")
|
||||||
shortt += "s";
|
shortt += "s";
|
||||||
else if (a.wlType == "object")
|
else if (a.wlType == "object")
|
||||||
shortt += "o";
|
shortt += std::string(a.allowNull ? "?" : "") + "o";
|
||||||
else if (a.wlType == "array")
|
else if (a.wlType == "array")
|
||||||
shortt += "a";
|
shortt += "a";
|
||||||
else if (a.wlType == "fd")
|
else if (a.wlType == "fd")
|
||||||
|
@ -167,6 +168,7 @@ void parseXML(pugi::xml_document& doc) {
|
||||||
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();
|
||||||
|
sargm.allowNull = arg.attribute("allow-null").as_string() == std::string{"true"};
|
||||||
sargm.CType = WPTypeToCType(sargm, false);
|
sargm.CType = WPTypeToCType(sargm, false);
|
||||||
|
|
||||||
srq.args.push_back(sargm);
|
srq.args.push_back(sargm);
|
||||||
|
@ -185,6 +187,7 @@ void parseXML(pugi::xml_document& doc) {
|
||||||
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();
|
||||||
|
sargm.allowNull = arg.attribute("allow-null").as_string() == std::string{"true"};
|
||||||
sargm.CType = WPTypeToCType(sargm, true);
|
sargm.CType = WPTypeToCType(sargm, true);
|
||||||
|
|
||||||
sev.args.push_back(sargm);
|
sev.args.push_back(sargm);
|
||||||
|
|
Loading…
Reference in a new issue