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_ExtStringListStorageDriver.ixx> |
17 | #include <PDataStd_ExtStringList.hxx> |
18 | #include <TDataStd_ExtStringList.hxx> |
19 | #include <MDataStd.hxx> |
20 | #include <CDM_MessageDriver.hxx> |
21 | #include <TDataStd_ListIteratorOfListOfExtendedString.hxx> |
22 | #include <TCollection_ExtendedString.hxx> |
23 | #include <PCollection_HExtendedString.hxx> |
24 | |
25 | //======================================================================= |
26 | //function : MDataStd_ExtStringListStorageDriver |
27 | //purpose : |
28 | //======================================================================= |
29 | MDataStd_ExtStringListStorageDriver::MDataStd_ExtStringListStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver) |
30 | { |
31 | } |
32 | |
33 | //======================================================================= |
34 | //function : VersionNumber |
35 | //purpose : |
36 | //======================================================================= |
37 | Standard_Integer MDataStd_ExtStringListStorageDriver::VersionNumber() const |
38 | { |
39 | return 0; |
40 | } |
41 | |
42 | |
43 | //======================================================================= |
44 | //function : SourceType |
45 | //purpose : |
46 | //======================================================================= |
47 | Handle(Standard_Type) MDataStd_ExtStringListStorageDriver::SourceType() const |
48 | { |
49 | static Handle(Standard_Type) sourceType = STANDARD_TYPE(TDataStd_ExtStringList); |
50 | return sourceType; |
51 | } |
52 | |
53 | //======================================================================= |
54 | //function : NewEmpty |
55 | //purpose : |
56 | //======================================================================= |
57 | Handle(PDF_Attribute) MDataStd_ExtStringListStorageDriver::NewEmpty() const |
58 | { |
59 | return new PDataStd_ExtStringList(); |
60 | } |
61 | |
62 | //======================================================================= |
63 | //function : Paste |
64 | //purpose : |
65 | //======================================================================= |
66 | void MDataStd_ExtStringListStorageDriver::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_ExtStringList) S = Handle(TDataStd_ExtStringList)::DownCast (Source); |
71 | Handle(PDataStd_ExtStringList) T = Handle(PDataStd_ExtStringList)::DownCast (Target); |
72 | |
73 | Standard_Integer lower = 1, upper = S->Extent(), i = lower; |
74 | if (upper >= lower) |
75 | { |
76 | T->Init(lower, upper); |
77 | TDataStd_ListIteratorOfListOfExtendedString itr(S->List()); |
78 | for (; itr.More(); itr.Next(), i++) |
79 | { |
80 | const TCollection_ExtendedString& tvalue = itr.Value(); |
81 | Handle(PCollection_HExtendedString) pvalue = new PCollection_HExtendedString(tvalue); |
82 | T->SetValue(i, pvalue); |
83 | } |
84 | } |
85 | } |