1 // Copyright (c) 2015 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <StdLPersistent_Value.hxx>
16 #include <TCollection_HExtendedString.hxx>
17 #include <Standard_GUID.hxx>
20 //=======================================================================
21 //function : ImportAttribute
22 //purpose : Import transient attribuite from the persistent data
23 //=======================================================================
24 template <class AttribClass>
25 void StdLPersistent_Value::integer<AttribClass>::ImportAttribute()
27 this->myTransient->Set (this->myData);
30 //=======================================================================
31 //function : ImportAttribute
32 //purpose : Import transient attribuite from the persistent data
33 //=======================================================================
34 template <class AttribClass, class HStringClass>
35 void StdLPersistent_Value::string<AttribClass, HStringClass>::ImportAttribute()
37 Handle(HStringClass) anHString =
38 Handle(HStringClass)::DownCast (this->myData);
41 this->myTransient->Set (anHString->Value()->String());
42 this->myData.Nullify();
46 //=======================================================================
47 //function : ImportAttribute
48 //purpose : Import transient attribuite from the persistent data
49 //=======================================================================
51 void StdLPersistent_Value::string<TDF_Reference>::ImportAttribute()
55 TDF_Label aLabel = myData->Label (this->myTransient->Label().Data());
57 this->myTransient->Set (aLabel);
58 this->myData.Nullify();
62 //=======================================================================
63 //function : ImportAttribute
64 //purpose : Import transient attribuite from the persistent data
65 //=======================================================================
67 void StdLPersistent_Value::string<TDataStd_UAttribute>::ImportAttribute()
70 //=======================================================================
71 //function : CreateAttribute
72 //purpose : Create an empty transient attribuite
73 //=======================================================================
74 Handle(TDF_Attribute) StdLPersistent_Value::UAttribute::CreateAttribute()
76 string<TDataStd_UAttribute,StdLPersistent_HString::Extended>::CreateAttribute();
80 Handle(TCollection_HExtendedString) aString = this->myData->ExtString();
82 this->myTransient->SetID (Standard_GUID (aString->String().ToExtString()));
83 this->myData.Nullify();
86 return this->myTransient;
89 //=======================================================================
90 Handle(TDF_Attribute) StdLPersistent_Value::Integer::CreateAttribute()
92 integer<TDataStd_Integer>::CreateAttribute();
96 this->myTransient->SetID (TDataStd_Integer::GetID());
99 return this->myTransient;
102 //=======================================================================
103 Handle(TDF_Attribute) StdLPersistent_Value::Name::CreateAttribute()
105 string<TDataStd_Name>::CreateAttribute();
109 this->myTransient->SetID (TDataStd_Name::GetID());
112 return this->myTransient;
115 //=======================================================================
116 Handle(TDF_Attribute) StdLPersistent_Value::AsciiString::CreateAttribute()
118 string<TDataStd_AsciiString, StdLPersistent_HString::Ascii>::CreateAttribute();
122 this->myTransient->SetID (TDataStd_AsciiString::GetID());
125 return this->myTransient;
128 template class StdLPersistent_Value::integer <TDataStd_Integer>;
129 template class StdLPersistent_Value::integer <TDF_TagSource>;
131 template class StdLPersistent_Value::string <TDF_Reference>;
132 template class StdLPersistent_Value::string <TDataStd_UAttribute>;
133 template class StdLPersistent_Value::string <TDataStd_Name>;
134 template class StdLPersistent_Value::string <TDataStd_Comment>;
135 template class StdLPersistent_Value::string <TDataStd_AsciiString,
136 StdLPersistent_HString::Ascii>;