0024057: Eliminate compiler warning C4100 in MSVC++ with warning level 4
[occt.git] / src / IGESSelect / IGESSelect_SetGlobalParameter.cxx
CommitLineData
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#include <IGESSelect_SetGlobalParameter.ixx>
19#include <IGESData_GlobalSection.hxx>
20#include <Interface_ParamSet.hxx>
21#include <Interface_FileParameter.hxx>
22#include <stdio.h>
23#include <Interface_Check.hxx>
24
25
b311480e 26IGESSelect_SetGlobalParameter::IGESSelect_SetGlobalParameter
7fd59977 27 (const Standard_Integer numpar)
28 : IGESSelect_ModelModifier (Standard_False)
29 { thenum = numpar; }
30
31 Standard_Integer IGESSelect_SetGlobalParameter::GlobalNumber () const
32 { return thenum; }
33
34 void IGESSelect_SetGlobalParameter::SetValue
35 (const Handle(TCollection_HAsciiString)& text)
36 { theval = text; }
37
38 Handle(TCollection_HAsciiString) IGESSelect_SetGlobalParameter::Value
39 () const
40 { return theval; }
41
42
43 void IGESSelect_SetGlobalParameter::Performing
44 (IFSelect_ContextModif& ctx,
45 const Handle(IGESData_IGESModel)& target,
46 Interface_CopyTool& ) const
47{
48 if (theval.IsNull()) {
49 ctx.CCheck()->AddWarning("Set IGES Global Parameter, no value defined, ignored");
50 return;
51 }
52 IGESData_GlobalSection GS = target->GlobalSection();
53 Handle(Interface_ParamSet) oldset = GS.Params();
54 if (thenum <= 0 || thenum > oldset->NbParams()) {
55 char mess[80];
56 sprintf(mess,"Set IGES Global Parameter : Number %d incorrect",thenum);
57 ctx.CCheck()->AddFail(mess);
58 return;
59 }
60 Interface_FileParameter& FP = oldset->ChangeParam (thenum);
61 FP.Init (theval->ToCString(),FP.ParamType());
62 Handle(Interface_Check) check = new Interface_Check;
63 GS.Init (oldset,check);
64 ctx.AddCheck(check);
65 if (!check->HasFailed()) target->SetGlobalSection(GS);
66}
67
68 TCollection_AsciiString IGESSelect_SetGlobalParameter::Label () const
69{
70 char mess[80];
71 if (theval.IsNull()) sprintf(mess,"Set IGES Global Parameter (undefined)");
72 else sprintf(mess,"Set IGES Global Parameter Number %d to %s",
73 thenum,theval->ToCString());
74 return TCollection_AsciiString (mess);
75}