Allow property called 'name' in interface
Currently if a property named 'name' is added, it collides
with the parameter name. Rename the parameter to _name so
this won't happen.
Tested: Added a property named name to interface and
bitbake phosphor-dbus-interfaces
Change-Id: Iee685612276e1bf2515bcb32c41e21487f344471
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/tools/sdbusplus/templates/interface.mako.server.cpp.in b/tools/sdbusplus/templates/interface.mako.server.cpp.in
index 821f42a..7a2a798 100644
--- a/tools/sdbusplus/templates/interface.mako.server.cpp.in
+++ b/tools/sdbusplus/templates/interface.mako.server.cpp.in
@@ -146,11 +146,11 @@
% endfor
% if interface.properties:
-void ${classname}::setPropertyByName(const std::string& name,
+void ${classname}::setPropertyByName(const std::string& _name,
const PropertiesVariant& val)
{
% for p in interface.properties:
- if (name == "${p.name}")
+ if (_name == "${p.name}")
{
auto& v = message::variant_ns::get<${p.cppTypeParam(interface.name)}>(\
val);
@@ -160,11 +160,11 @@
% endfor
}
-auto ${classname}::getPropertyByName(const std::string& name) ->
+auto ${classname}::getPropertyByName(const std::string& _name) ->
PropertiesVariant
{
% for p in interface.properties:
- if (name == "${p.name}")
+ if (_name == "${p.name}")
{
return ${p.camelCase}();
}
diff --git a/tools/sdbusplus/templates/interface.mako.server.hpp b/tools/sdbusplus/templates/interface.mako.server.hpp
index d9fec9d..9ca67e0 100644
--- a/tools/sdbusplus/templates/interface.mako.server.hpp
+++ b/tools/sdbusplus/templates/interface.mako.server.hpp
@@ -86,17 +86,17 @@
% if interface.properties:
/** @brief Sets a property by name.
- * @param[in] name - A string representation of the property name.
+ * @param[in] _name - A string representation of the property name.
* @param[in] val - A variant containing the value to set.
*/
- void setPropertyByName(const std::string& name,
+ void setPropertyByName(const std::string& _name,
const PropertiesVariant& val);
/** @brief Gets a property by name.
- * @param[in] name - A string representation of the property name.
+ * @param[in] _name - A string representation of the property name.
* @return - A variant containing the value of the property.
*/
- PropertiesVariant getPropertyByName(const std::string& name);
+ PropertiesVariant getPropertyByName(const std::string& _name);
% endif
% for e in interface.enums: