From 2252efe032e7c4f7923984fe1d3421ebeeb20ffc Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 25 Nov 2005 11:41:14 +0000 Subject: [PATCH] Fix for bug 10505: Explode with 'Select Sub Shapes' is impossible --- src/LightApp/LightApp_DataOwner.cxx | 12 ++++++++- src/LightApp/LightApp_DataSubOwner.cxx | 8 +++--- src/SUIT/SUIT_DataOwner.cxx | 35 +++++++++++++++++--------- src/SUIT/SUIT_DataOwner.h | 11 ++++---- 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/LightApp/LightApp_DataOwner.cxx b/src/LightApp/LightApp_DataOwner.cxx index 647b5d328..6d01eb5fe 100644 --- a/src/LightApp/LightApp_DataOwner.cxx +++ b/src/LightApp/LightApp_DataOwner.cxx @@ -2,8 +2,12 @@ #include "LightApp_DataObject.h" -#ifdef WNT +#ifndef WNT +#include +#define _typeinfo std::type_info +#else #include +#define _typeinfo type_info #endif #include @@ -34,6 +38,12 @@ bool LightApp_DataOwner ::isEqual( const SUIT_DataOwner& obj ) const { + const _typeinfo& ti1 = typeid( obj ); + const _typeinfo& ti2 = typeid( *(this) ); + + if (ti1 != ti2) + return false; + const LightApp_DataOwner* other = dynamic_cast( &obj ); return other && entry() == other->entry(); diff --git a/src/LightApp/LightApp_DataSubOwner.cxx b/src/LightApp/LightApp_DataSubOwner.cxx index 50c5ca3a3..95de81a3f 100644 --- a/src/LightApp/LightApp_DataSubOwner.cxx +++ b/src/LightApp/LightApp_DataSubOwner.cxx @@ -21,9 +21,11 @@ LightApp_DataSubOwner::~LightApp_DataSubOwner() /*!Checks: Is current data sub owner equal \a obj.*/ bool LightApp_DataSubOwner::isEqual( const SUIT_DataOwner& obj ) const { - const LightApp_DataSubOwner* other = dynamic_cast( &obj ); - - return other && entry() == other->entry() && index() == other->index(); + if (LightApp_DataOwner::isEqual(obj)) { + const LightApp_DataSubOwner* other = dynamic_cast( &obj ); + return other && index() == other->index(); + } + return false; } /*!Gets index.*/ diff --git a/src/SUIT/SUIT_DataOwner.cxx b/src/SUIT/SUIT_DataOwner.cxx index 603da20aa..ebac9dc7f 100755 --- a/src/SUIT/SUIT_DataOwner.cxx +++ b/src/SUIT/SUIT_DataOwner.cxx @@ -41,9 +41,18 @@ bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) //==================================================================== //! Constructor (default) //==================================================================== -SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const bool skipAllEqal ) -: QValueList(), -mySkipEqual( skipAllEqal ) +SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList() + : QValueList(), + mySkipEqual( true ) +{ +} + +//==================================================================== +//! Constructor (default) +//==================================================================== +SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const bool skipAllEqual ) + : QValueList(), + mySkipEqual( skipAllEqual ) { } @@ -51,18 +60,19 @@ mySkipEqual( skipAllEqal ) //! Constructor (copy) //==================================================================== SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l ) -: QValueList( l ) + : QValueList( l ), + mySkipEqual( true ) { } //==================================================================== //! Constructor (copy) //==================================================================== -SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqal ) -: QValueList(), -mySkipEqual( skipAllEqal ) +SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqual ) + : QValueList(), + mySkipEqual( skipAllEqual ) { - if ( skipAllEqal == l.mySkipEqual ) + if ( skipAllEqual == l.mySkipEqual ) operator =( l ); else { @@ -78,7 +88,8 @@ mySkipEqual( skipAllEqal ) //! Constructor (from stl) //==================================================================== SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list& l ) -: QValueList( l ) + : QValueList( l ), + mySkipEqual( true ) { } #endif @@ -87,9 +98,9 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list //==================================================================== //! Constructor (from stl) //==================================================================== -SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list& l, const bool skipAllEqal ) -: QValueList(), -mySkipEqual( skipAllEqal ) +SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list& l, const bool skipAllEqual ) + : QValueList(), + mySkipEqual( skipAllEqual ) { std::list::const_iterator beginIt = l.begin(); std::list::const_iterator endIt = l.begin(); diff --git a/src/SUIT/SUIT_DataOwner.h b/src/SUIT/SUIT_DataOwner.h index 9c1b758b6..ffff7fe9f 100755 --- a/src/SUIT/SUIT_DataOwner.h +++ b/src/SUIT/SUIT_DataOwner.h @@ -36,12 +36,13 @@ bool operator==( const SUIT_DataOwnerPtr&, const SUIT_DataOwnerPtr& ); class SUIT_EXPORT SUIT_DataOwnerPtrList : public QValueList { public: - SUIT_DataOwnerPtrList( const bool skipAllEqal = true );//!< constructor - SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l );//!< copy constructor - SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqal );//!< copy constructor + 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& l );//!< copy constructor for STL list - SUIT_DataOwnerPtrList( const std::list& l, const bool skipAllEqal );//!< copy constructor for STL list + SUIT_DataOwnerPtrList( const std::list& l ); //!< copy constructor for STL list + SUIT_DataOwnerPtrList( const std::list& l, const bool skipAllEqual );//!< copy constructor for STL list #endif iterator append ( const SUIT_DataOwnerPtr& x );//!< append function -- 2.39.2