0024830: Remove redundant keyword 'mutable' in CDL declarations
[occt.git] / src / IGESDefs / IGESDefs_ToolMacroDef.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <IGESDefs_ToolMacroDef.ixx>
20 #include <IGESData_ParamCursor.hxx>
21 #include <TCollection_HAsciiString.hxx>
22 #include <Interface_HArray1OfHAsciiString.hxx>
23 #include <IGESData_Dump.hxx>
24 #include <Interface_Macros.hxx>
25
26
27 IGESDefs_ToolMacroDef::IGESDefs_ToolMacroDef ()    {  }
28
29
30 void  IGESDefs_ToolMacroDef::ReadOwnParams
31   (const Handle(IGESDefs_MacroDef)& ent,
32    const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
33
34   //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
35
36   Handle(TCollection_HAsciiString) macro;
37   Standard_Integer entityTypeID;
38   Handle(Interface_HArray1OfHAsciiString) langStatements;
39   Handle(TCollection_HAsciiString) endMacro;
40
41   PR.ReadText(PR.Current(), "MACRO", macro); //szv#4:S4163:12Mar99 `st=` not needed
42
43   PR.ReadInteger(PR.Current(), "Entity Type ID", entityTypeID); //szv#4:S4163:12Mar99 `st=` not needed
44
45   Standard_Integer tempCurrent = PR.CurrentNumber();
46   // Counting the no. of language statements.
47   Standard_Integer nbval; // svv Jan 10 2000 : porting on DEC
48   for (nbval = 0; PR.CurrentNumber() != PR.NbParams();
49        nbval++, PR.SetCurrentNumber(PR.CurrentNumber() + 1));
50
51   PR.SetCurrentNumber(tempCurrent);
52   if (nbval > 0) langStatements =
53     new Interface_HArray1OfHAsciiString(1, nbval);
54   else  PR.AddFail("Number of Lang. Stats. : Not Positive");
55
56   if (! langStatements.IsNull())
57     {
58       for (Standard_Integer i = 1; i <= nbval; i++)
59         {
60           Handle(TCollection_HAsciiString) langStat;
61           //st = PR.ReadText(PR.Current(), "Language Statement", langStat); //szv#4:S4163:12Mar99 moved in if
62           if (PR.ReadText(PR.Current(), "Language Statement", langStat))
63             langStatements->SetValue(i, langStat);
64         }
65     }
66
67   PR.ReadText(PR.Current(), "END MACRO", endMacro); //szv#4:S4163:12Mar99 `st=` not needed
68
69   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
70   ent->Init (macro, entityTypeID, langStatements, endMacro);
71 }
72
73 void  IGESDefs_ToolMacroDef::WriteOwnParams
74   (const Handle(IGESDefs_MacroDef)& ent, IGESData_IGESWriter& IW) const 
75
76   IW.Send(ent->MACRO());
77   IW.Send(ent->EntityTypeID());
78   Standard_Integer upper = ent->NbStatements();
79   for (Standard_Integer i = 1; i <= upper; i++)
80     IW.Send(ent->LanguageStatement(i));
81   IW.Send(ent->ENDMACRO());
82 }
83
84 void  IGESDefs_ToolMacroDef::OwnShared
85   (const Handle(IGESDefs_MacroDef)& /* ent */, Interface_EntityIterator& /* iter */) const
86 {
87 }
88
89 void  IGESDefs_ToolMacroDef::OwnCopy
90   (const Handle(IGESDefs_MacroDef)& another,
91    const Handle(IGESDefs_MacroDef)& ent, Interface_CopyTool& /* TC */) const
92
93
94   Handle(TCollection_HAsciiString) macro =
95     new TCollection_HAsciiString(another->MACRO());
96   Standard_Integer entityTypeID = another->EntityTypeID();
97   Handle(TCollection_HAsciiString) endMacro =
98     new TCollection_HAsciiString(another->ENDMACRO());
99   Handle(Interface_HArray1OfHAsciiString) langStatements;
100   Standard_Integer nbval = another->NbStatements();
101   langStatements = new Interface_HArray1OfHAsciiString(1, nbval);
102
103   for (Standard_Integer i = 1; i <= nbval; i++)
104     {
105       Handle(TCollection_HAsciiString) langStat =
106         new TCollection_HAsciiString(another->LanguageStatement(i));
107       langStatements->SetValue(i, langStat);
108     }
109   ent->Init(macro, entityTypeID, langStatements, endMacro);
110 }
111
112 IGESData_DirChecker  IGESDefs_ToolMacroDef::DirChecker
113   (const Handle(IGESDefs_MacroDef)& /* ent */ ) const 
114
115   IGESData_DirChecker DC (306, 0);
116   DC.Structure(IGESData_DefVoid);
117   DC.LineFont(IGESData_DefVoid);
118   DC.LineWeight(IGESData_DefVoid);
119   DC.Color(IGESData_DefVoid);
120   DC.BlankStatusIgnored();
121   DC.SubordinateStatusRequired(0);
122   DC.UseFlagRequired(2);
123   DC.HierarchyStatusIgnored();
124   return DC;
125 }
126
127 void  IGESDefs_ToolMacroDef::OwnCheck
128   (const Handle(IGESDefs_MacroDef)& /* ent */,
129    const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const 
130 {
131 }
132
133 void  IGESDefs_ToolMacroDef::OwnDump
134   (const Handle(IGESDefs_MacroDef)& ent, const IGESData_IGESDumper& /* dumper */,
135    const Handle(Message_Messenger)& S, const Standard_Integer level) const 
136
137   S << "IGESDefs_MacroDef" << endl;
138   S << "MACRO : ";
139   IGESData_DumpString(S,ent->MACRO());
140   S << endl;
141   S << "Entity Type ID : " << ent->EntityTypeID() << endl;
142   S << "Language Statement : ";
143   IGESData_DumpStrings(S ,level,1, ent->NbStatements(),ent->LanguageStatement);
144   S << "END MACRO : ";
145   IGESData_DumpString(S,ent->ENDMACRO());
146   S << endl;
147 }