Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/gui.git] / src / LightApp / LightApp_DataOwner.cxx
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/
18 //
19 #include "LightApp_DataOwner.h"
20
21 #include "LightApp_DataObject.h"
22
23 #ifndef WNT
24 #include <typeinfo>
25 #define _typeinfo std::type_info
26 #else
27 #include <typeinfo.h>
28 #define _typeinfo type_info
29 #endif
30
31 #include <iostream>
32
33 /*!Constructor. Initialize by \a theEntry.*/
34 LightApp_DataOwner
35 ::LightApp_DataOwner( const QString& theEntry ): 
36   myEntry( theEntry )
37 {
38 }
39
40 #ifndef DISABLE_SALOMEOBJECT
41 /*!Constructor. Initialize by \a SALOME_InteractiveObject.*/
42 LightApp_DataOwner
43 ::LightApp_DataOwner( const Handle(SALOME_InteractiveObject)& theIO ):
44   myEntry(!theIO.IsNull()? theIO->getEntry(): ""),
45   myIO(theIO)
46 {
47 }
48 #endif
49
50 /*!Destructor. Do nothing.*/
51 LightApp_DataOwner
52 ::~LightApp_DataOwner()
53 {
54 }
55
56 /*!Checks: Is current data owner equal \a obj.*/
57 bool
58 LightApp_DataOwner
59 ::isEqual( const SUIT_DataOwner& obj ) const
60 {
61   const LightApp_DataOwner* other = dynamic_cast<const LightApp_DataOwner*>( &obj );
62
63   return other && entry() == other->entry();
64 }
65
66 bool LightApp_DataOwner::operator<( const SUIT_DataOwner& obj ) const
67 {
68   const LightApp_DataOwner* other = dynamic_cast<const LightApp_DataOwner*>( &obj );
69   return entry() < other->entry();
70 }
71
72 /*!Gets entry.*/
73 QString
74 LightApp_DataOwner
75 ::entry() const
76 {
77   return myEntry;
78 }
79
80 #ifndef DISABLE_SALOMEOBJECT
81 /*!Gets SALOME_InteractiveObject.*/
82 const Handle(SALOME_InteractiveObject)&
83 LightApp_DataOwner
84 ::IO() const
85 {
86   return myIO;
87 }
88 #endif