native_types: add != comparison for string_wrapper
If a 'type: path' is added to a sdbus++ interface YAML file, the
resulting code does not compile due to a missing != comparison
operator for string_wrapper. Add it and enhance the test case to
cover.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iaa661a15e58a99e4e816c391152926e9af1a8339
diff --git a/include/sdbusplus/message/native_types.hpp b/include/sdbusplus/message/native_types.hpp
index 5a0c6c2..7bf5fb9 100644
--- a/include/sdbusplus/message/native_types.hpp
+++ b/include/sdbusplus/message/native_types.hpp
@@ -43,6 +43,10 @@
{
return str == r.str;
}
+ bool operator!=(const string_wrapper<T>& r) const
+ {
+ return str != r.str;
+ }
bool operator<(const string_wrapper<T>& r) const
{
return str < r.str;
@@ -51,6 +55,10 @@
{
return str == r;
}
+ bool operator!=(const std::string& r) const
+ {
+ return str != r;
+ }
bool operator<(const std::string& r) const
{
return str < r;
@@ -60,6 +68,10 @@
{
return l == r.str;
}
+ friend bool operator!=(const std::string& l, const string_wrapper& r)
+ {
+ return l != r.str;
+ }
friend bool operator<(const std::string& l, const string_wrapper& r)
{
return l < r.str;
diff --git a/test/server/Test.interface.yaml b/test/server/Test.interface.yaml
index 2f86d70..2b6c9f5 100644
--- a/test/server/Test.interface.yaml
+++ b/test/server/Test.interface.yaml
@@ -14,3 +14,5 @@
- const
- name: Countable
type: size
+ - name: ObjectPath
+ type: path