Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / SUIT / SUIT_DataOwner.cxx
index a0aa525c4fd1eb614c9dae7b1f0bb0884da8452d..300a88e7c0295975a0e8b21a08c5fa57d3e25953 100755 (executable)
@@ -1,25 +1,27 @@
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
-// version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-// Lesser General Public License for more details.
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-
 #include "SUIT_DataOwner.h"
 
-#ifndef WNT
+#ifndef WIN32
 #include <typeinfo>
 #define _typeinfo std::type_info
 #else
@@ -45,9 +47,7 @@ bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 )
   return p1.isNull() && p2.isNull();
 }
 
-// *** jfa: The below function has been put here 14.02.2007 from branch BR_Dev_For_4_0
-// *** and also improved for better comparison of DataOwners with DataSubOwners.
-// *** This comment is to be removed after merging with BR_Dev_For_4_0.
+
 /*! Operator < allows to order suit data owners for map */
 bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 )
 {
@@ -60,7 +60,6 @@ bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 )
 
   return (p1->keyString() < p2->keyString());
 }
-// *** end
 
 /*!
   \class SUIT_DataOwnerPtrList 
@@ -72,8 +71,8 @@ bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 )
   Constructor (default)
 */
 SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList()
-  : QValueList<SUIT_DataOwnerPtr>(),
-    mySkipEqual( true )
+: QList<SUIT_DataOwnerPtr>(),
+mySkipEqual( true )
 {
 }
 
@@ -81,8 +80,8 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList()
   Constructor (default)
 */
 SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const bool skipAllEqual )
-  : QValueList<SUIT_DataOwnerPtr>(),
-    mySkipEqual( skipAllEqual )
+: QList<SUIT_DataOwnerPtr>(),
+mySkipEqual( skipAllEqual )
 {
 }
 
@@ -90,8 +89,8 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const bool skipAllEqual )
   Constructor (copy)
 */
 SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l )
-  : QValueList<SUIT_DataOwnerPtr>( l ),
-    mySkipEqual( true )
+: QList<SUIT_DataOwnerPtr>( l ),
+mySkipEqual( true )
 {
 }
 
@@ -99,8 +98,8 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l )
   Constructor (copy)
 */
 SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqual )
-  : QValueList<SUIT_DataOwnerPtr>(),
-    mySkipEqual( skipAllEqual )
+: QList<SUIT_DataOwnerPtr>(),
+mySkipEqual( skipAllEqual )
 {
   if ( skipAllEqual == l.mySkipEqual )
     operator =( l );
@@ -108,51 +107,23 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, co
   {
     SUIT_DataOwnerPtrList::const_iterator beginIt = l.begin();
     SUIT_DataOwnerPtrList::const_iterator endIt = l.end();
-    for( ; beginIt != endIt; ++beginIt )
+    for ( ; beginIt != endIt; ++beginIt )
       append( *beginIt );
   }
 }
 
-#ifndef QT_NO_STL
-/*!
-  Constructor (from stl)
-*/
-SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l )
-  : QValueList<SUIT_DataOwnerPtr>( l ),
-    mySkipEqual( true )
-{
-}
-#endif
-
-#ifndef QT_NO_STL
-/*!
-  Constructor (from stl)
-*/
-SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l, const bool skipAllEqual )
-  : QValueList<SUIT_DataOwnerPtr>(),
-    mySkipEqual( skipAllEqual )
-{
-  std::list<SUIT_DataOwnerPtr>::const_iterator beginIt = l.begin();
-  std::list<SUIT_DataOwnerPtr>::const_iterator endIt = l.begin();
-  for( ; beginIt != endIt; ++beginIt )
-    append( *beginIt );
-}
-#endif
-
 /*!
   Appends an item to the list
 */
-SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x )
+void SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x )
 {
   if ( mySkipEqual && myMap.contains( x ) ) //contains uses SUIT_DataOwnerPtr::operator==
-    return myMap[ x ];
-
-  iterator it = QValueList<SUIT_DataOwnerPtr>::append( x );
+    return;
 
-   if ( mySkipEqual )
-    myMap.insert( x, it );
+  QList<SUIT_DataOwnerPtr>::append( x );
 
-  return it;
+  if ( mySkipEqual )
+    myMap.insert( x, 0 );
 }
 
 /*!
@@ -160,9 +131,10 @@ SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOw
 */
 void SUIT_DataOwnerPtrList::clear()
 {
-  if( mySkipEqual )
+  if ( mySkipEqual )
     myMap.clear();
-  QValueList<SUIT_DataOwnerPtr>::clear();
+
+  QList<SUIT_DataOwnerPtr>::clear();
 }
 
 /*!
@@ -170,7 +142,8 @@ void SUIT_DataOwnerPtrList::clear()
 */
 uint SUIT_DataOwnerPtrList::remove(const SUIT_DataOwnerPtr& x )
 {
-  if( mySkipEqual && myMap.contains(x) )
-    myMap.remove(x);
-  return QValueList<SUIT_DataOwnerPtr>::remove( x );
+  if ( mySkipEqual && myMap.contains(x) )
+    myMap.remove( x );
+
+  return QList<SUIT_DataOwnerPtr>::removeAll( x );
 }