b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | |
19 | #include <RWStepVisual_RWCompositeText.ixx> |
20 | #include <StepVisual_HArray1OfTextOrCharacter.hxx> |
21 | #include <StepVisual_TextOrCharacter.hxx> |
22 | |
23 | |
24 | #include <Interface_EntityIterator.hxx> |
25 | |
26 | |
27 | #include <StepVisual_CompositeText.hxx> |
28 | |
29 | |
30 | RWStepVisual_RWCompositeText::RWStepVisual_RWCompositeText () {} |
31 | |
32 | void RWStepVisual_RWCompositeText::ReadStep |
33 | (const Handle(StepData_StepReaderData)& data, |
34 | const Standard_Integer num, |
35 | Handle(Interface_Check)& ach, |
36 | const Handle(StepVisual_CompositeText)& ent) const |
37 | { |
38 | |
39 | |
40 | // --- Number of Parameter Control --- |
41 | |
42 | if (!data->CheckNbParams(num,2,ach,"composite_text has not 2 parameter(s)")) return; |
43 | |
44 | // --- inherited field : name --- |
45 | |
46 | Handle(TCollection_HAsciiString) aName; |
47 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
48 | data->ReadString (num,1,"name",ach,aName); |
49 | |
50 | // --- own field : collectedText --- |
51 | |
52 | Handle(StepVisual_HArray1OfTextOrCharacter) aCollectedText; |
53 | StepVisual_TextOrCharacter aCollectedTextItem; |
54 | Standard_Integer nsub2; |
55 | nsub2 = data->SubListNumber(num, 2, Standard_False); |
56 | if (nsub2 !=0) { |
57 | Standard_Integer nb2 = data->NbParams(nsub2); |
58 | aCollectedText = new StepVisual_HArray1OfTextOrCharacter (1, nb2); |
59 | for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) { |
60 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
61 | if (data->ReadEntity (nsub2,i2,"collected_text",ach,aCollectedTextItem)) |
62 | aCollectedText->SetValue(i2,aCollectedTextItem); |
63 | } |
64 | } |
65 | else { |
66 | ach->AddFail("Parameter #2 (collected_text) is not a LIST"); |
67 | } |
68 | |
69 | //--- Initialisation of the read entity --- |
70 | |
71 | |
72 | ent->Init(aName, aCollectedText); |
73 | } |
74 | |
75 | |
76 | void RWStepVisual_RWCompositeText::WriteStep |
77 | (StepData_StepWriter& SW, |
78 | const Handle(StepVisual_CompositeText)& ent) const |
79 | { |
80 | |
81 | // --- inherited field name --- |
82 | |
83 | SW.Send(ent->Name()); |
84 | |
85 | // --- own field : collectedText --- |
86 | |
87 | SW.OpenSub(); |
88 | for (Standard_Integer i2 = 1; i2 <= ent->NbCollectedText(); i2 ++) { |
89 | SW.Send(ent->CollectedTextValue(i2).Value()); |
90 | } |
91 | SW.CloseSub(); |
92 | } |
93 | |
94 | |
95 | void RWStepVisual_RWCompositeText::Share(const Handle(StepVisual_CompositeText)& ent, Interface_EntityIterator& iter) const |
96 | { |
97 | |
98 | Standard_Integer nbElem1 = ent->NbCollectedText(); |
99 | for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) { |
100 | iter.GetOneItem(ent->CollectedTextValue(is1).Value()); |
101 | } |
102 | |
103 | } |
104 | |