sdbus++: fix enumeration property default values
Current generation emits for enumerations:
Enum property = EnumValue
Fix this to be:
Enum property = Enum::EnumValue
Change-Id: Iae1e8e4ad73bf8623ed9f3b2d3ec57803c7f18bd
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/tools/sdbusplus/property.py b/tools/sdbusplus/property.py
index bcb50d9..0297e79 100644
--- a/tools/sdbusplus/property.py
+++ b/tools/sdbusplus/property.py
@@ -11,11 +11,18 @@
super(Property, self).__init__(**kwargs)
+ def is_enum(self):
+ if not self.cppTypeName:
+ return False
+ if self.cppTypeName.startswith("enum<"):
+ return True
+ return False
+
""" Return a conversion of the cppTypeName valid as a function parameter.
Currently only 'enum' requires conversion.
"""
def cppTypeParam(self, interface, server=True):
- if self.cppTypeName.startswith("enum<"):
+ if self.is_enum():
# strip off 'enum<' and '>'
r = self.cppTypeName.split('>')[0].split('<')[1]
@@ -33,7 +40,7 @@
message. Currently only 'enum' requires conversion.
"""
def cppTypeMessage(self, interface):
- if self.cppTypeName.startswith("enum<"):
+ if self.is_enum():
return "std::string"
return self.cppTypeName