diff options
author | Shubham Goyal <22shubh22@gmail.com> | 2019-03-12 15:32:33 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-03-18 09:34:41 +0100 |
commit | d4c620ba7e9abccd8a82e2c64bd0d8cdf9538380 (patch) | |
tree | cee244cdf20c23ff3e9ab146050afa3ca5718993 /pyuno/source | |
parent | 27a092ded129c1773c62331fb8a206c0ccd97eb6 (diff) |
tdf#124011 Add __ne__ method to UNO types
Change-Id: I1dcb41b404d69e7437a2cc6f22d3391bb91f3acc
Reviewed-on: https://gerrit.libreoffice.org/69216
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'pyuno/source')
-rw-r--r-- | pyuno/source/module/pyuno_except.cxx | 3 | ||||
-rw-r--r-- | pyuno/source/module/uno.py | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/pyuno/source/module/pyuno_except.cxx b/pyuno/source/module/pyuno_except.cxx index 0d627dd2566e..ebe00ac6811b 100644 --- a/pyuno/source/module/pyuno_except.cxx +++ b/pyuno/source/module/pyuno_except.cxx @@ -162,6 +162,7 @@ static PyRef createClass( const OUString & name, const Runtime &runtime ) PyRef getter = getObjectFromUnoModule( runtime,"_uno_struct__getattr__" ); PyRef repr = getObjectFromUnoModule( runtime,"_uno_struct__repr__" ); PyRef eq = getObjectFromUnoModule( runtime,"_uno_struct__eq__" ); + PyRef ne = getObjectFromUnoModule( runtime,"_uno_struct__ne__" ); PyObject_SetAttrString( ret.get(), "__pyunostruct__", @@ -181,6 +182,8 @@ static PyRef createClass( const OUString & name, const Runtime &runtime ) ret.get(), "__str__", repr.get() ); PyObject_SetAttrString( ret.get(), "__eq__", eq.get() ); + PyObject_SetAttrString( + ret.get(), "__ne__", ne.get() ); } return ret; } diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py index bccf22d0f8ac..6d671e620f21 100644 --- a/pyuno/source/module/uno.py +++ b/pyuno/source/module/uno.py @@ -170,6 +170,9 @@ class Enum: return (self.typeName == that.typeName) and (self.value == that.value) + def __ne__(self,other): + return not self.__eq__(other) + class Type: """Represents a UNO type. @@ -194,6 +197,9 @@ class Type: return self.typeClass == that.typeClass and self.typeName == that.typeName + def __ne__(self,other): + return not self.__eq__(other) + def __hash__(self): return self.typeName.__hash__() @@ -259,6 +265,9 @@ class Char: return False + def __ne__(self,other): + return not self.__eq__(other) + class ByteSequence: """Represents a UNO ByteSequence value. @@ -527,6 +536,8 @@ def _uno_struct__str__(self): return str(self.__dict__["value"]) +def _uno_struct__ne__(self, other): + return not self.__eq__(other) def _uno_struct__eq__(self, that): """Compares two UNO structs. |