[nemiver] Add IDebugger::Variable::operator==



commit 934d9eb7481033a6e98aa5cb9bb4ceff66208a2d
Author: Dodji Seketeli <dodji seketeli org>
Date:   Tue Feb 14 00:16:28 2012 +0100

    Add IDebugger::Variable::operator==
    
    	* src/dbgengine/nmv-i-debugger.h
    	(IDebugger::Variable::operator==): Make this public and implement
    	it.
    	(IDebugger::Variable::equals): New function.

 src/dbgengine/nmv-i-debugger.h |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index 39dc248..3bfcbd1 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -372,9 +372,6 @@ public:
         Variable (const Variable &);
         Variable& operator= (const Variable &);
 
-        bool operator == (Variable &a_other) const;
-        bool operator == (Variable &a_other);
-
         VariableList m_members;
         // If this variable was created with a backend counterpart
         // (e.g: backend side variable objects in GDB), then this
@@ -548,6 +545,23 @@ public:
             THROW ("fatal: should not be reached");
         }
 
+        bool operator == (const Variable &a_other) const
+        {
+            return equals (a_other);
+        }
+
+        // Tests if this variable equals another one, by first
+        // considering the variables' internal names, if they have
+        // any.  Otherwise, tests if they are equal by value, i.e,
+        // compare them memberwise.
+        bool equals (const Variable &a_other) const
+        {
+            if (!internal_name ().empty ()
+                && !a_other.internal_name ().empty ())
+                return internal_name () == a_other.internal_name ();
+            return equals_by_value (a_other);
+        }
+
         /// Tests value equality between two variables.
         /// Two variables are considered equal by value if their
         /// respective memebers have the same values and same type.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]