From: stv Date: Tue, 29 Aug 2006 11:32:05 +0000 (+0000) Subject: Comparing mechanism for SUIT_DataOwner modified. X-Git-Tag: LAST_STABLE_VERSION_21_09_2006_ON_3_2_0~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d627802a745bd231f130758ae10530facbc0c567;p=modules%2Fgui.git Comparing mechanism for SUIT_DataOwner modified. --- diff --git a/src/SUIT/SUIT_DataOwner.cxx b/src/SUIT/SUIT_DataOwner.cxx index 826bd89bf..beb907d7a 100755 --- a/src/SUIT/SUIT_DataOwner.cxx +++ b/src/SUIT/SUIT_DataOwner.cxx @@ -36,7 +36,7 @@ SUIT_DataOwner::~SUIT_DataOwner() { } -/*! operator== : compares two owners*/ +/*! Operator == compares two owners*/ bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) { if ( !p1.isNull() && !p2.isNull() ) @@ -44,6 +44,20 @@ bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) return p1.isNull() && p2.isNull(); } + +/*! Operator < allows to order suit data owners for map */ +bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) +{ + if ( p1.isNull() && p2.isNull() ) + return false; + else if ( p1.isNull() ) + return true; + else if ( p2.isNull() ) + return false; + + return p1->isLess( *p2 ); +} + /*! \class SUIT_DataOwnerPtrList implements value list with unique items (uniqueness is @@ -126,12 +140,12 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list */ SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x ) { - if( mySkipEqual && myMap.contains( x ) ) //contains uses SUIT_DataOwnerPtr::operator== + if ( mySkipEqual && myMap.contains( x ) ) //contains uses SUIT_DataOwnerPtr::operator== return myMap[ x ]; iterator it = QValueList::append( x ); - if( mySkipEqual ) + if ( mySkipEqual ) myMap.insert( x, it ); return it; @@ -156,11 +170,3 @@ uint SUIT_DataOwnerPtrList::remove(const SUIT_DataOwnerPtr& x ) myMap.remove(x); return QValueList::remove( x ); } - -/*! - Operator < allows to order suit data owners for map -*/ -bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) -{ - return p1.get()