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_ExtStringListRetrievalDriver.ixx> |
17 | #include <PDataStd_ExtStringList.hxx> |
18 | #include <TDataStd_ExtStringList.hxx> |
19 | #include <MDataStd.hxx> |
20 | #include <CDM_MessageDriver.hxx> |
21 | #include <TCollection_ExtendedString.hxx> |
22 | #include <PCollection_HExtendedString.hxx> |
23 | |
24 | //======================================================================= |
25 | //function : MDataStd_ExtStringListRetrievalDriver |
26 | //purpose : |
27 | //======================================================================= |
28 | MDataStd_ExtStringListRetrievalDriver::MDataStd_ExtStringListRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver) |
29 | { |
30 | |
31 | } |
32 | |
33 | //======================================================================= |
34 | //function : VersionNumber |
35 | //purpose : |
36 | //======================================================================= |
37 | Standard_Integer MDataStd_ExtStringListRetrievalDriver::VersionNumber() const |
38 | { |
39 | return 0; |
40 | } |
41 | |
42 | //======================================================================= |
43 | //function : SourceType |
44 | //purpose : |
45 | //======================================================================= |
46 | Handle(Standard_Type) MDataStd_ExtStringListRetrievalDriver::SourceType() const |
47 | { |
48 | static Handle(Standard_Type) sourceType = STANDARD_TYPE(PDataStd_ExtStringList); |
49 | return sourceType; |
50 | } |
51 | |
52 | //======================================================================= |
53 | //function : NewEmpty |
54 | //purpose : |
55 | //======================================================================= |
56 | Handle(TDF_Attribute) MDataStd_ExtStringListRetrievalDriver::NewEmpty () const |
57 | { |
58 | return new TDataStd_ExtStringList(); |
59 | } |
60 | |
61 | //======================================================================= |
62 | //function : Paste |
63 | //purpose : |
64 | //======================================================================= |
65 | void MDataStd_ExtStringListRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source, |
66 | const Handle(TDF_Attribute)& Target, |
67 | const Handle(MDF_RRelocationTable)& ) const |
68 | { |
69 | Handle(PDataStd_ExtStringList) S = Handle(PDataStd_ExtStringList)::DownCast (Source); |
70 | Handle(TDataStd_ExtStringList) T = Handle(TDataStd_ExtStringList)::DownCast (Target); |
71 | |
72 | Standard_Integer i, lower = S->Lower(), upper = S->Upper(); |
73 | for (i = lower; i <= upper; i++) |
74 | { |
75 | const Handle(PCollection_HExtendedString)& pvalue = S->Value(i); |
76 | TCollection_ExtendedString tvalue = pvalue->Convert(); |
77 | T->Append(tvalue); |
78 | } |
79 | } |