Back to index

salome-gui  6.5.0
SUIT_DataOwner.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef SUIT_DATAOWNER_H
00024 #define SUIT_DATAOWNER_H
00025 
00026 #include "SUIT_SmartPtr.h"
00027 
00028 #include <QMap>
00029 #include <QList>
00030 #include <QString>
00031 
00032 #ifdef WIN32
00033 #pragma warning( disable:4251 )
00034 #pragma warning( disable:4275 )
00035 #endif
00036 
00043 class SUIT_EXPORT SUIT_DataOwner : public RefCount 
00044 {
00045 public:
00046   SUIT_DataOwner();
00047   virtual ~SUIT_DataOwner();
00048   virtual QString keyString() const = 0;
00049 };
00050 
00054 typedef SMART(SUIT_DataOwner) SUIT_DataOwnerPtr;
00055 
00057 bool operator==( const SUIT_DataOwnerPtr&, const SUIT_DataOwnerPtr& );
00058 
00066 class SUIT_EXPORT SUIT_DataOwnerPtrList : public QList<SUIT_DataOwnerPtr>
00067 {
00068 public:
00069   SUIT_DataOwnerPtrList();                         
00070   SUIT_DataOwnerPtrList( const bool skipAllEqual );
00071   SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l );                         
00072   SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l, const bool skipAllEqual );
00073 
00074   void     append      ( const SUIT_DataOwnerPtr& x );
00075   void     clear       ();
00076   uint     remove      ( const SUIT_DataOwnerPtr& x );
00077 
00078 private:
00079   // hide this methods: only append() should be used to add items to the list
00080   iterator prepend( const SUIT_DataOwnerPtr& x );
00081   iterator insert ( iterator it, const SUIT_DataOwnerPtr& x );
00082   void push_front ( const SUIT_DataOwnerPtr& x );
00083   void push_back  ( const SUIT_DataOwnerPtr& x );
00084 
00085 private:
00086   QMap<SUIT_DataOwnerPtr, int> myMap;
00087   bool                         mySkipEqual;
00088 };
00089 
00090 #ifdef WIN32
00091 #pragma warning( default:4251 )
00092 #pragma warning( default:4275 )
00093 #endif
00094 
00095 #endif