b311480e |
1 | // Created on: 2007-05-29 |
2 | // Created by: Vlad Romashko |
973c2be1 |
3 | // Copyright (c) 2007-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #include <MDataStd_ReferenceArrayStorageDriver.ixx> |
17 | #include <PDataStd_ReferenceArray.hxx> |
18 | #include <TDataStd_ReferenceArray.hxx> |
19 | #include <MDataStd.hxx> |
20 | #include <CDM_MessageDriver.hxx> |
21 | #include <TDF_Tool.hxx> |
22 | #include <TDF_Label.hxx> |
23 | #include <PCollection_HExtendedString.hxx> |
24 | |
25 | //======================================================================= |
26 | //function : MDataStd_ReferenceArrayStorageDriver |
27 | //purpose : |
28 | //======================================================================= |
29 | MDataStd_ReferenceArrayStorageDriver::MDataStd_ReferenceArrayStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver) |
30 | { |
31 | |
32 | } |
33 | |
34 | //======================================================================= |
35 | //function : VersionNumber |
36 | //purpose : |
37 | //======================================================================= |
38 | Standard_Integer MDataStd_ReferenceArrayStorageDriver::VersionNumber() const |
39 | { |
40 | return 0; |
41 | } |
42 | |
43 | //======================================================================= |
44 | //function : SourceType |
45 | //purpose : |
46 | //======================================================================= |
47 | Handle(Standard_Type) MDataStd_ReferenceArrayStorageDriver::SourceType() const |
48 | { |
49 | static Handle(Standard_Type) sourceType = STANDARD_TYPE(TDataStd_ReferenceArray); |
50 | return sourceType; |
51 | } |
52 | |
53 | //======================================================================= |
54 | //function : NewEmpty |
55 | //purpose : |
56 | //======================================================================= |
57 | Handle(PDF_Attribute) MDataStd_ReferenceArrayStorageDriver::NewEmpty() const |
58 | { |
59 | return new PDataStd_ReferenceArray(); |
60 | } |
61 | |
62 | //======================================================================= |
63 | //function : Paste |
64 | //purpose : |
65 | //======================================================================= |
66 | void MDataStd_ReferenceArrayStorageDriver::Paste(const Handle(TDF_Attribute)& Source, |
67 | const Handle(PDF_Attribute)& Target, |
35e08fe8 |
68 | const Handle(MDF_SRelocationTable)& /*RelocTable*/) const |
7fd59977 |
69 | { |
70 | Handle(TDataStd_ReferenceArray) S = Handle(TDataStd_ReferenceArray)::DownCast (Source); |
71 | Handle(PDataStd_ReferenceArray) T = Handle(PDataStd_ReferenceArray)::DownCast (Target); |
72 | |
73 | Standard_Integer lower = S->Lower(), upper = S->Upper(), i = lower; |
74 | if (upper >= lower) |
75 | { |
76 | T->Init(lower, upper); |
77 | for (; i <= upper; i++) |
78 | { |
79 | TDF_Label L = S->Value(i); |
80 | if (!L.IsNull()) |
81 | { |
82 | TCollection_AsciiString tvalue; |
83 | TDF_Tool::Entry(L, tvalue); |
84 | Handle(PCollection_HExtendedString) pvalue = new PCollection_HExtendedString(tvalue); |
85 | T->SetValue(i, pvalue); |
86 | } |
87 | } |
88 | } |
89 | } |