}
else
{
- aParent->myChildren.find( myCurrent );
+ int idx = aParent->myChildren.indexOf( myCurrent );
if ( myDetourType == DepthLeft )
- myCurrent = aParent->myChildren.next();
+ myCurrent = idx < aParent->myChildren.count() - 1 ? aParent->myChildren[idx + 1] : 0;
else
- myCurrent = aParent->myChildren.prev();
+ myCurrent = idx > 0 ? aParent->myChildren[idx - 1] : 0;
if ( !myCurrent )
{
myCurrent = aParent;
if ( obj && ( par = parent( obj ) ) )
{
- par->myChildren.find( obj );
- if ( par->myChildren.next() )
- return par->myChildren.current();
+ int idx = par->myChildren.indexOf( obj );
+ if ( idx < par->myChildren.count() - 1 )
+ return par->myChildren[idx + 1];
else
{
for ( ; par; par = globalSibling( par, next ) )
SUIT_DataObject* SUIT_DataObjectIterator::extreme( DataObjectList& aList, bool FromLeft ) const
{
if ( FromLeft )
- return aList.getFirst();
+ return aList.first();
else
- return aList.getLast();
+ return aList.last();
}
/*!
//
// 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
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 )
{
return (p1->keyString() < p2->keyString());
}
-// *** end
/*!
\class SUIT_DataOwnerPtrList
Constructor (default)
*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList()
- : QValueList<SUIT_DataOwnerPtr>(),
- mySkipEqual( true )
+: QList<SUIT_DataOwnerPtr>(),
+mySkipEqual( true )
{
}
Constructor (default)
*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const bool skipAllEqual )
- : QValueList<SUIT_DataOwnerPtr>(),
- mySkipEqual( skipAllEqual )
+: QList<SUIT_DataOwnerPtr>(),
+mySkipEqual( skipAllEqual )
{
}
Constructor (copy)
*/
SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l )
- : QValueList<SUIT_DataOwnerPtr>( l ),
- mySkipEqual( true )
+: QList<SUIT_DataOwnerPtr>( l ),
+mySkipEqual( true )
{
}
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 );
{
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 );
}
/*!
*/
void SUIT_DataOwnerPtrList::clear()
{
- if( mySkipEqual )
+ if ( mySkipEqual )
myMap.clear();
- QValueList<SUIT_DataOwnerPtr>::clear();
+
+ QList<SUIT_DataOwnerPtr>::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 );
}
#include "SUIT_SmartPtr.h"
-#include <qvaluelist.h>
-#include <qmap.h>
+#include <QMap>
+#include <QList>
+#include <QString>
#ifdef WIN32
#pragma warning( disable:4251 )
public:
SUIT_DataOwner();//!< constructor
virtual ~SUIT_DataOwner();//!< destructor
- // *** jfa: The below line has been put here 14.02.2007.
- // *** It cancels modifications from branch BR_Dev_For_4_0
virtual QString keyString() const = 0;//!< used for comparison
};
/*! \class SUIT_DataOwnerPtrList
* \brief Manage list of SUIT_DataOwnerPtr.
*/
-class SUIT_EXPORT SUIT_DataOwnerPtrList : public QValueList<SUIT_DataOwnerPtr>
+class SUIT_EXPORT SUIT_DataOwnerPtrList : public QList<SUIT_DataOwnerPtr>
{
public:
SUIT_DataOwnerPtrList(); //!< constructor
SUIT_DataOwnerPtrList( const bool skipAllEqual );//!< constructor
SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l ); //!< copy constructor
SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqual );//!< copy constructor
-#ifndef QT_NO_STL
- SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l ); //!< copy constructor for STL list
- SUIT_DataOwnerPtrList( const std::list<SUIT_DataOwnerPtr>& l, const bool skipAllEqual );//!< copy constructor for STL list
-#endif
- iterator append ( const SUIT_DataOwnerPtr& x );//!< append function
+ void append ( const SUIT_DataOwnerPtr& x );//!< append function
void clear ();
- uint remove (const SUIT_DataOwnerPtr& x );
+ uint remove ( const SUIT_DataOwnerPtr& x );
private:
// hide this methods: only append() should be used to add items to the list
void push_back ( const SUIT_DataOwnerPtr& x );//!< hide method
private:
- bool mySkipEqual;
- QMap<SUIT_DataOwnerPtr, iterator> myMap;
+ QMap<SUIT_DataOwnerPtr, int> myMap;
+ bool mySkipEqual;
};
#ifdef WIN32