[vlc-devel] [PATCH 2/8] qt: medialib: define equality operator on MLItemId

Romain Vimont rom1v at videolabs.io
Thu Dec 3 12:12:06 CET 2020


For symmetry, define operator==() in addition to operator!=().
---
 modules/gui/qt/medialibrary/mlqmltypes.hpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/medialibrary/mlqmltypes.hpp b/modules/gui/qt/medialibrary/mlqmltypes.hpp
index af92ba34a1..7adcdb7d07 100644
--- a/modules/gui/qt/medialibrary/mlqmltypes.hpp
+++ b/modules/gui/qt/medialibrary/mlqmltypes.hpp
@@ -33,9 +33,13 @@ class MLItemId
 public:
     MLItemId() : id(0), type( VLC_ML_PARENT_UNKNOWN ) {}
     MLItemId( int64_t i, vlc_ml_parent_type t ) : id( i ), type( t ) {}
-    bool operator!=( const MLItemId& lhs )
+    bool operator==( const MLItemId& other )
     {
-        return id != lhs.id || type != lhs.type;
+        return id == other.id && type == other.type;
+    }
+    bool operator!=( const MLItemId& other )
+    {
+        return !(*this == other);
     }
     int64_t id;
     vlc_ml_parent_type type;
-- 
2.29.2



More information about the vlc-devel mailing list