0024057: Eliminate compiler warning C4100 in MSVC++ with warning level 4
[occt.git] / src / APIHeaderSection / APIHeaderSection_EditHeader.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 <APIHeaderSection_EditHeader.ixx>
19#include <Interface_TypedValue.hxx>
20
21#include <APIHeaderSection_MakeHeader.hxx>
22
23static Standard_Boolean IsTimeStamp
24 (const Handle(TCollection_HAsciiString)& val)
25{
26 if (val.IsNull()) return Standard_False;
27 if (val->Length() != 19) return Standard_False;
28// On y va
29 char dizmois = val->Value(6);
30 char dizjour = val->Value(9);
31 char dizheur = val->Value(12);
32 for (Standard_Integer i = 1; i <= 19; i ++) {
33 char uncar = val->Value(i);
34 switch (i) {
35 case 1 : if (uncar != '1' && uncar != '2') return Standard_False; break;
36 case 2 :
37 case 3 :
38 case 4 : if (uncar < '0' || uncar > '9') return Standard_False; break;
39 case 5 : if (uncar != '-') return Standard_False;
40 case 6 : if (uncar != '0' && uncar != '1') return Standard_False; break;
d3f26155 41 case 7 : if (uncar < '0' || uncar > '9') return Standard_False;
42 if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False; break;
7fd59977 43 case 8 : if (uncar != '-') return Standard_False;
44 case 9 : if (uncar < '0' || uncar > '3') return Standard_False; break;
45 case 10 : if (uncar < '0' || uncar > '9') return Standard_False;
d3f26155 46 if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False; break;
7fd59977 47 case 11 : if (uncar != 'T') return Standard_False;
48 case 12 : if (uncar < '0' || uncar > '2') return Standard_False; break;
49 case 13 : if (uncar < '0' || uncar > '9') return Standard_False;
50 if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False; break;
7fd59977 51 case 14 : if (uncar != ':') return Standard_False;
52 case 15 : if (uncar < '0' || uncar > '5') return Standard_False; break;
53 case 16 : if (uncar < '0' || uncar > '9') return Standard_False; break;
54 case 17 : if (uncar != ':') return Standard_False;
55 case 18 : if (uncar < '0' || uncar > '5') return Standard_False; break;
56 case 19 : if (uncar < '0' || uncar > '9') return Standard_False; break;
57 default : break;
58 }
59 }
60 return Standard_True;
61}
62
63
64 APIHeaderSection_EditHeader::APIHeaderSection_EditHeader ()
65 : IFSelect_Editor (10)
66{
67// Definition
68 Handle(Interface_TypedValue) fn_name = new Interface_TypedValue("fn_name");
69 SetValue (1,fn_name,"name");
70 Handle(Interface_TypedValue) fn_time = new Interface_TypedValue("fn_time_stamp");
71 fn_time->SetSatisfies (IsTimeStamp,"IsTimeStamp");
72 SetValue (2,fn_time,"time");
73 Handle(Interface_TypedValue) fn_author = new Interface_TypedValue("fn_author");
74 SetValue (3,fn_author,"author"); // 1 seul (1er de liste)
75 Handle(Interface_TypedValue) fn_org = new Interface_TypedValue("fn_organization");
76 SetValue (4,fn_org,"org"); // 1 seul (1er de liste)
77 Handle(Interface_TypedValue) fn_preproc = new Interface_TypedValue("fn_preprocessor_version");
78 SetValue (5,fn_preproc,"preproc");
79 Handle(Interface_TypedValue) fn_orig = new Interface_TypedValue("fn_originating_system");
80 SetValue (6,fn_orig,"orig");
81 Handle(Interface_TypedValue) fn_autorize = new Interface_TypedValue("fn_authorization");
82 SetValue (7,fn_autorize,"autorize");
83
84 Handle(Interface_TypedValue) fs_schema = new Interface_TypedValue("fs_schema_identifiers");
85 SetValue (8,fs_schema,"schema"); // 1 seul (1er de liste)
86
87 Handle(Interface_TypedValue) fd_descr = new Interface_TypedValue("fd_description");
88 SetValue (9,fd_descr,"descr"); // 1 seul (1er de liste)
89
90 Handle(Interface_TypedValue) fd_level = new Interface_TypedValue("fd_implementation_level");
91 SetValue (10,fd_level,"level");
92
93}
94
95 TCollection_AsciiString APIHeaderSection_EditHeader::Label () const
96 { return TCollection_AsciiString ("Step Header"); }
97
98 Standard_Boolean APIHeaderSection_EditHeader::Recognize
35e08fe8 99 (const Handle(IFSelect_EditForm)& /*form*/) const
7fd59977 100{ return Standard_True; } // ??
101
102 Handle(TCollection_HAsciiString) APIHeaderSection_EditHeader::StringValue
35e08fe8 103 (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
7fd59977 104{
105// Default Values
106 return TypedValue(num)->HStringValue();
107}
108
109 Standard_Boolean APIHeaderSection_EditHeader::Load
110 (const Handle(IFSelect_EditForm)& form,
35e08fe8 111 const Handle(Standard_Transient)& /*ent*/,
7fd59977 112 const Handle(Interface_InterfaceModel)& model) const
113{
114 Handle(StepData_StepModel) modl =
115 Handle(StepData_StepModel)::DownCast(model);
116 if (modl.IsNull()) return Standard_False;
117
118 APIHeaderSection_MakeHeader mkh (modl);
119
120 form->LoadValue (1 ,mkh.Name ());
121 form->LoadValue (2 ,mkh.TimeStamp ());
122 form->LoadValue (3 ,mkh.AuthorValue (1));
123 form->LoadValue (4 ,mkh.OrganizationValue (1));
124 form->LoadValue (5 ,mkh.PreprocessorVersion ());
125 form->LoadValue (6 ,mkh.OriginatingSystem ());
126 form->LoadValue (7 ,mkh.Authorisation ());
127
128 form->LoadValue (8 ,mkh.SchemaIdentifiersValue (1));
129
130 form->LoadValue (9 ,mkh.DescriptionValue (1));
131 form->LoadValue (10,mkh.ImplementationLevel ());
132
133 return Standard_True;
134}
135
136 Standard_Boolean APIHeaderSection_EditHeader::Apply
137 (const Handle(IFSelect_EditForm)& form,
35e08fe8 138 const Handle(Standard_Transient)& /*ent*/,
7fd59977 139 const Handle(Interface_InterfaceModel)& model) const
140{
141 Handle(StepData_StepModel) modl =
142 Handle(StepData_StepModel)::DownCast(model);
143 if (modl.IsNull()) return Standard_False;
144
145 APIHeaderSection_MakeHeader mkh (modl);
146
147 if (form->IsModified(1)) mkh.SetName (form->EditedValue(1));
148 if (form->IsModified(2)) mkh.SetTimeStamp (form->EditedValue(2));
149 if (form->IsModified(3)) mkh.SetAuthorValue (1,form->EditedValue(3));
150 if (form->IsModified(4)) mkh.SetOrganizationValue (1,form->EditedValue(4));
151 if (form->IsModified(5)) mkh.SetPreprocessorVersion (form->EditedValue(5));
152 if (form->IsModified(6)) mkh.SetOriginatingSystem (form->EditedValue(6));
153 if (form->IsModified(7)) mkh.SetAuthorisation (form->EditedValue(7));
154
155 if (form->IsModified(8)) mkh.SetSchemaIdentifiersValue (1,form->EditedValue(8));
156
157 if (form->IsModified(9)) mkh.SetDescriptionValue (1,form->EditedValue(9));
158 if (form->IsModified(10)) mkh.SetImplementationLevel (form->EditedValue(10));
159
160 mkh.Apply( Handle(StepData_StepModel)::DownCast(model) );
161
162 return Standard_True;
163}