0029590: Coding - avoid usage of Standard_EXPORT attribute for inline methods
[occt.git] / src / StdLPersistent / StdLPersistent_Value.cxx
CommitLineData
ff205346 1// Copyright (c) 2015 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
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.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#include <StdLPersistent_Value.hxx>
15
16#include <TCollection_HExtendedString.hxx>
17#include <Standard_GUID.hxx>
18
19
20//=======================================================================
21//function : ImportAttribute
22//purpose : Import transient attribuite from the persistent data
23//=======================================================================
24template <class AttribClass>
25void StdLPersistent_Value::integer<AttribClass>::ImportAttribute()
26{
27 this->myTransient->Set (this->myData);
28}
29
30//=======================================================================
31//function : ImportAttribute
32//purpose : Import transient attribuite from the persistent data
33//=======================================================================
34template <class AttribClass, class HStringClass>
35void StdLPersistent_Value::string<AttribClass, HStringClass>::ImportAttribute()
36{
45d8465e 37 Handle(HStringClass) anHString =
38 Handle(HStringClass)::DownCast (this->myData);
39 if (anHString)
ff205346 40 {
41 this->myTransient->Set (anHString->Value()->String());
42 this->myData.Nullify();
43 }
44}
45
46//=======================================================================
47//function : ImportAttribute
48//purpose : Import transient attribuite from the persistent data
49//=======================================================================
50template<>
51void StdLPersistent_Value::string<TDF_Reference>::ImportAttribute()
52{
53 if (this->myData)
54 {
55 TDF_Label aLabel = myData->Label (this->myTransient->Label().Data());
56 if (!aLabel.IsNull())
57 this->myTransient->Set (aLabel);
58 this->myData.Nullify();
59 }
60}
61
62//=======================================================================
63//function : ImportAttribute
64//purpose : Import transient attribuite from the persistent data
65//=======================================================================
66template<>
67void StdLPersistent_Value::string<TDataStd_UAttribute>::ImportAttribute()
68{}
69
70//=======================================================================
71//function : CreateAttribute
72//purpose : Create an empty transient attribuite
73//=======================================================================
74Handle(TDF_Attribute) StdLPersistent_Value::UAttribute::CreateAttribute()
75{
76 string<TDataStd_UAttribute,StdLPersistent_HString::Extended>::CreateAttribute();
77
78 if (this->myData)
79 {
80 Handle(TCollection_HExtendedString) aString = this->myData->ExtString();
81 if (aString)
82 this->myTransient->SetID (Standard_GUID (aString->String().ToExtString()));
83 this->myData.Nullify();
84 }
85
86 return this->myTransient;
45d8465e 87}
ff205346 88
fa53efef 89//=======================================================================
90Handle(TDF_Attribute) StdLPersistent_Value::Integer::CreateAttribute()
91{
92 integer<TDataStd_Integer>::CreateAttribute();
93
94 if (this->myData)
95 {
96 this->myTransient->SetID (TDataStd_Integer::GetID());
97 }
98
99 return this->myTransient;
100}
101
102//=======================================================================
103Handle(TDF_Attribute) StdLPersistent_Value::Name::CreateAttribute()
104{
105 string<TDataStd_Name>::CreateAttribute();
106
107 if (this->myData)
108 {
109 this->myTransient->SetID (TDataStd_Name::GetID());
110 }
111
112 return this->myTransient;
113}
114
115//=======================================================================
116Handle(TDF_Attribute) StdLPersistent_Value::AsciiString::CreateAttribute()
117{
118 string<TDataStd_AsciiString, StdLPersistent_HString::Ascii>::CreateAttribute();
119
120 if (this->myData)
121 {
122 this->myTransient->SetID (TDataStd_AsciiString::GetID());
123 }
124
125 return this->myTransient;
126}
ff205346 127
128template class StdLPersistent_Value::integer <TDataStd_Integer>;
129template class StdLPersistent_Value::integer <TDF_TagSource>;
130
131template class StdLPersistent_Value::string <TDF_Reference>;
132template class StdLPersistent_Value::string <TDataStd_UAttribute>;
133template class StdLPersistent_Value::string <TDataStd_Name>;
134template class StdLPersistent_Value::string <TDataStd_Comment>;
135template class StdLPersistent_Value::string <TDataStd_AsciiString,
136 StdLPersistent_HString::Ascii>;