0026342: No materials are read from STEP
[occt.git] / src / RWStepRepr / RWStepRepr_RWDescriptiveRepresentationItem.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <RWStepRepr_RWDescriptiveRepresentationItem.ixx>
15 #include <TCollection_HAsciiString.hxx>
16
17
18 RWStepRepr_RWDescriptiveRepresentationItem::RWStepRepr_RWDescriptiveRepresentationItem () {}
19
20 void RWStepRepr_RWDescriptiveRepresentationItem::ReadStep
21         (const Handle(StepData_StepReaderData)& data,
22          const Standard_Integer num,
23          Handle(Interface_Check)& ach,
24          const Handle(StepRepr_DescriptiveRepresentationItem)& ent) const
25 {
26
27
28         // --- Number of Parameter Control ---
29
30         //if (!data->CheckNbParams(num,2,ach,"descriptive_representation_item")) return;
31   // for the case when description is absent
32   if (data->NbParams(num) != 2 && data->NbParams(num) != 1)
33   {
34     Handle(TCollection_HAsciiString) errmess = new TCollection_HAsciiString(
35       "Count of Parameters is not 1 or 2 for descriptive_representation_item");
36     Handle(TCollection_HAsciiString) errmesso = new TCollection_HAsciiString(
37       "Count of Parameters is not %d or %d for %s");
38     ach->AddFail (errmess->ToCString(),errmesso->ToCString());
39     return;
40   }
41
42         // --- inherited field : name ---
43
44         Handle(TCollection_HAsciiString) aName;
45         //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
46         data->ReadString (num,1,"name",ach,aName);
47
48         // --- own field : description ---
49
50         Handle(TCollection_HAsciiString) aDescription;
51         //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
52         data->ReadString (num,2,"description",ach,aDescription);
53
54         //--- Initialisation of the read entity ---
55
56
57         ent->Init(aName, aDescription);
58 }
59
60
61 void RWStepRepr_RWDescriptiveRepresentationItem::WriteStep
62         (StepData_StepWriter& SW,
63          const Handle(StepRepr_DescriptiveRepresentationItem)& ent) const
64 {
65
66         // --- inherited field name ---
67
68         SW.Send(ent->Name());
69
70         // --- own field : description ---
71
72         SW.Send(ent->Description());
73 }