From 63e7805dd7fcdf046046ab1315296444f30cd77f Mon Sep 17 00:00:00 2001 From: darkeye Date: Wed, 20 Feb 2002 11:51:27 +0000 Subject: [PATCH] added equality operators to compare with pointers --- darkice/trunk/src/Ref.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/darkice/trunk/src/Ref.h b/darkice/trunk/src/Ref.h index e32b723..2e0968d 100644 --- a/darkice/trunk/src/Ref.h +++ b/darkice/trunk/src/Ref.h @@ -192,7 +192,7 @@ class Ref * @exception Exception */ inline void - set ( T* newobj ) throw ( Exception ) + set ( T * newobj ) throw ( Exception ) { // If equal do nothing if ( newobj == object ) { @@ -232,6 +232,19 @@ class Ref return object; } + /** + * Equality operator. + * + * @param other the pointer to compare this with. + * @return true is this Ref refers to the same object as other, + * false otherwise. + */ + inline bool + operator== ( const T * other ) const throw () + { + return object == other; + } + /** * Equality operator. * @@ -245,6 +258,19 @@ class Ref return object == other.object; } + /** + * Unequality operator. + * + * @param other the pointer to compare this with. + * @return false is this Ref refers to a different object then other, + * true otherwise. + */ + inline bool + operator!= ( const T * other ) const throw () + { + return object != other; + } + /** * Unequality operator. * @@ -274,6 +300,9 @@ class Ref $Source$ $Log$ + Revision 1.4 2002/02/20 11:51:27 darkeye + added equality operators to compare with pointers + Revision 1.3 2000/11/11 14:55:31 darkeye minor bugfix