]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDSImpl/SALOMEDSImpl_AttributeComment.cxx
Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeComment.cxx
1 //  File   : SALOMEDSImpl_AttributeComment.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5 #ifndef WNT
6 using namespace std;
7 #endif
8 #include "SALOMEDSImpl_AttributeComment.hxx"
9
10 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
11 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
12
13 //=======================================================================
14 //function : GetID
15 //purpose  :
16 //=======================================================================
17 const Standard_GUID& SALOMEDSImpl_AttributeComment::GetID ()
18 {
19   static Standard_GUID CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9");
20   return CommentID;
21 }   
22
23 Handle(SALOMEDSImpl_AttributeComment) SALOMEDSImpl_AttributeComment::Set (const TDF_Label& L, 
24                                                                           const TCollection_ExtendedString& Val) 
25 {
26   Handle(SALOMEDSImpl_AttributeComment) A;
27   if (!L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), A)) {
28     A = new  SALOMEDSImpl_AttributeComment(); 
29     L.AddAttribute(A);
30   }
31
32   A->SetValue(Val);     
33     
34   return A;
35 }
36
37 //=======================================================================
38 //function : SetValue
39 //purpose  :
40 //=======================================================================
41 void SALOMEDSImpl_AttributeComment::SetValue (const TCollection_ExtendedString& S)
42 {
43   CheckLocked();
44
45   if(myString == S) return;
46
47   Backup();
48
49   myString = S;
50   
51   SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved 
52 }
53            
54
55 //=======================================================================
56 //function : ID
57 //purpose  :
58 //=======================================================================
59 const Standard_GUID& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); } 
60
61 //=======================================================================
62 //function : NewEmpty
63 //purpose  : 
64 //=======================================================================
65 Handle(TDF_Attribute) SALOMEDSImpl_AttributeComment::NewEmpty () const
66 {  
67   return new SALOMEDSImpl_AttributeComment(); 
68 }
69
70 //=======================================================================
71 //function : Restore
72 //purpose  : 
73 //=======================================================================
74 void SALOMEDSImpl_AttributeComment::Restore(const Handle(TDF_Attribute)& with) 
75 {
76   myString = Handle(SALOMEDSImpl_AttributeComment)::DownCast (with)->Value ();
77 }
78
79 //=======================================================================
80 //function : Paste
81 //purpose  : 
82 //=======================================================================
83
84 void SALOMEDSImpl_AttributeComment::Paste (const Handle(TDF_Attribute)& into,
85                                            const Handle(TDF_RelocationTable)& RT) const
86 {
87   Handle(SALOMEDSImpl_AttributeComment)::DownCast (into)->SetValue(myString);
88 }