From f2e864234242217bdd7f7e5a68794c29ff7fa680 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 20 Apr 2024 01:36:20 +0100 Subject: [PATCH] source: fix missed defines --- src/main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 0622f90..1580685 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -277,6 +277,7 @@ void parseSource() { SOURCE += std::format(R"#(#define private public #include "{}.hpp" #undef private +#define F std::function )#", PROTO_DATA.fileName); @@ -506,7 +507,26 @@ void {}::onDestroyCalled() {{ )#", IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, IFACE_NAME + "_interface", IFACE_CLASS_NAME_CAMEL, IFACE_VTABLE_NAME, IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL); + + for (auto& rq : iface.requests) { + std::string args = ", "; + for (auto& arg : rq.args) { + args += arg.CType + ", "; + } + + args.pop_back(); + args.pop_back(); + + SOURCE += std::format(R"#( +void {}::{}(F handler) {{ + requests.{} = handler; +}} +)#", + IFACE_CLASS_NAME_CAMEL, camelize("set_" + rq.name), args, camelize(rq.name)); + } } + + SOURCE += "\n#undef F\n"; } int main(int argc, char** argv, char** envp) {