7fd59977 |
1 | // File: MDataStd_ReferenceListStorageDriver.cxx |
2 | // Created: May 29 11:40:00 2007 |
3 | // Author: Vlad Romashko |
4 | // <vladislav.romashko@opencascade.com> |
5 | // Copyright: Open CASCADE |
6 | |
7 | #include <MDataStd_ReferenceListStorageDriver.ixx> |
8 | #include <PDataStd_ReferenceList.hxx> |
9 | #include <TDataStd_ReferenceList.hxx> |
10 | #include <MDataStd.hxx> |
11 | #include <CDM_MessageDriver.hxx> |
12 | #include <TDF_ListIteratorOfLabelList.hxx> |
13 | #include <TDF_Tool.hxx> |
14 | #include <TDF_Label.hxx> |
15 | #include <PCollection_HExtendedString.hxx> |
16 | |
17 | //======================================================================= |
18 | //function : MDataStd_ReferenceListStorageDriver |
19 | //purpose : |
20 | //======================================================================= |
21 | MDataStd_ReferenceListStorageDriver::MDataStd_ReferenceListStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver) |
22 | { |
23 | |
24 | } |
25 | |
26 | //======================================================================= |
27 | //function : VersionNumber |
28 | //purpose : |
29 | //======================================================================= |
30 | Standard_Integer MDataStd_ReferenceListStorageDriver::VersionNumber() const |
31 | { |
32 | return 0; |
33 | } |
34 | |
35 | |
36 | //======================================================================= |
37 | //function : SourceType |
38 | //purpose : |
39 | //======================================================================= |
40 | Handle(Standard_Type) MDataStd_ReferenceListStorageDriver::SourceType() const |
41 | { |
42 | static Handle(Standard_Type) sourceType = STANDARD_TYPE(TDataStd_ReferenceList); |
43 | return sourceType; |
44 | } |
45 | |
46 | //======================================================================= |
47 | //function : NewEmpty |
48 | //purpose : |
49 | //======================================================================= |
50 | Handle(PDF_Attribute) MDataStd_ReferenceListStorageDriver::NewEmpty() const |
51 | { |
52 | return new PDataStd_ReferenceList(); |
53 | } |
54 | |
55 | //======================================================================= |
56 | //function : Paste |
57 | //purpose : |
58 | //======================================================================= |
59 | void MDataStd_ReferenceListStorageDriver::Paste(const Handle(TDF_Attribute)& Source, |
60 | const Handle(PDF_Attribute)& Target, |
61 | const Handle(MDF_SRelocationTable)& RelocTable) const |
62 | { |
63 | Handle(TDataStd_ReferenceList) S = Handle(TDataStd_ReferenceList)::DownCast (Source); |
64 | Handle(PDataStd_ReferenceList) T = Handle(PDataStd_ReferenceList)::DownCast (Target); |
65 | |
66 | Standard_Integer lower = 1, upper = S->Extent(), i = lower; |
67 | if (upper >= lower) |
68 | { |
69 | T->Init(lower, upper); |
70 | TDF_ListIteratorOfLabelList itr(S->List()); |
71 | for (; itr.More(); itr.Next(), i++) |
72 | { |
73 | TDF_Label L = itr.Value(); |
74 | if (!L.IsNull()) |
75 | { |
76 | TCollection_AsciiString tvalue; |
77 | TDF_Tool::Entry(L, tvalue); |
78 | Handle(PCollection_HExtendedString) pvalue = new PCollection_HExtendedString(tvalue); |
79 | T->SetValue(i, pvalue); |
80 | } |
81 | } |
82 | } |
83 | } |