From fafe8487ff23e5aa69301e73b33ec6135b1c1e81 Mon Sep 17 00:00:00 2001 From: sgiurgiu Date: Thu, 2 Jan 2025 11:48:48 -0500 Subject: [PATCH] fix(codegen): generate correct annotation code (#473) Before the patch, generating an adaptor from https://gitlab.freedesktop.org/hadess/mpris-spec/-/blob/master/spec/org.mpris.MediaPlayer2.xml would produce incorrect code like this: ``` m_object.addVTable( sdbus::setInterfaceFlags().withPropertyUpdateBehavior(sdbus::Flags::EMITS_CHANGE_SIGNAL); , sdbus::registerMethod("Raise").implementedAs([this](){ return this->Raise(); }) , sdbus::registerMethod("Quit").implementedAs([this](){ return this->Quit(); }) ... ``` With this patch, the code produced is: ``` m_object.addVTable( sdbus::setInterfaceFlags().withPropertyUpdateBehavior(sdbus::Flags::EMITS_CHANGE_SIGNAL) , sdbus::registerMethod("Raise").implementedAs([this](){ return this->Raise(); }) , sdbus::registerMethod("Quit").implementedAs([this](){ return this->Quit(); }) ... ``` --- tools/xml2cpp-codegen/AdaptorGenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/xml2cpp-codegen/AdaptorGenerator.cpp b/tools/xml2cpp-codegen/AdaptorGenerator.cpp index db1ee04..dc480b9 100644 --- a/tools/xml2cpp-codegen/AdaptorGenerator.cpp +++ b/tools/xml2cpp-codegen/AdaptorGenerator.cpp @@ -121,7 +121,7 @@ std::string AdaptorGenerator::processInterface(Node& interface) const if(!annotationRegistration.empty()) { std::stringstream str; - str << "sdbus::setInterfaceFlags()" << annotationRegistration << ";"; + str << "sdbus::setInterfaceFlags()" << annotationRegistration; annotationRegistration = str.str(); }