0023947: Eliminate trivial compiler warnings in MSVC++ with warning level 4
[occt.git] / src / StepData / StepData_SelectMember.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 <StepData_SelectMember.ixx>
19
20// Definitions reprises de Field :
21#define KindInteger 1
22#define KindBoolean 2
23#define KindLogical 3
24#define KindEnum 4
25#define KindReal 5
26#define KindString 6
27
28
29
b311480e 30StepData_SelectMember::StepData_SelectMember () { }
7fd59977 31
32 Standard_Boolean StepData_SelectMember::HasName () const { return Standard_False; }
33 Standard_CString StepData_SelectMember::Name () const { return ""; }
34
35 Standard_Boolean StepData_SelectMember::SetName (const Standard_CString bid)
36 { return Standard_False; }
37
38 Standard_Boolean StepData_SelectMember::Matches (const Standard_CString name) const
39 { return !strcmp (name,Name()); }
40
41 Standard_Integer StepData_SelectMember::Kind () const { return 0; }
42 void StepData_SelectMember::SetKind (const Standard_Integer ) { }
43
44Interface_ParamType StepData_SelectMember::ParamType () const
45{
46 Standard_Integer kind = Kind();
47 if (kind == 0) return Interface_ParamVoid;
48 if (kind == 1) return Interface_ParamInteger;
49 if (kind == 2 || kind == 3) return Interface_ParamLogical;
50 if (kind == 4) return Interface_ParamEnum;
51 if (kind == 5) return Interface_ParamReal;
52 if (kind == 6) return Interface_ParamText;
53 return Interface_ParamMisc;
54}
55
56 Standard_Integer StepData_SelectMember::Int () const { return 0; }
57 void StepData_SelectMember::SetInt (const Standard_Integer ) { }
58
59 Standard_Integer StepData_SelectMember::Integer () const { return Int(); }
60 void StepData_SelectMember::SetInteger (const Standard_Integer val)
61 { SetKind(KindInteger); SetInt(val); }
62 Standard_Boolean StepData_SelectMember::Boolean () const { return (Int() > 0); }
63 void StepData_SelectMember::SetBoolean (const Standard_Boolean val)
64 { SetKind(KindBoolean); SetInt((val ? 1 : 0)); }
65
66 StepData_Logical StepData_SelectMember::Logical () const
67{
68 Standard_Integer ival = Int();
69 if (ival == 0) return StepData_LFalse;
70 if (ival == 1) return StepData_LTrue;
71 return StepData_LUnknown;
72}
73
74 void StepData_SelectMember::SetLogical (const StepData_Logical val)
75{
76 SetKind(KindLogical);
77 if (val == StepData_LFalse) SetInt(0);
78 if (val == StepData_LTrue) SetInt(0);
79 if (val == StepData_LUnknown) SetInt(0);
80}
81
82 Standard_Real StepData_SelectMember::Real () const { return 0.0; }
83 void StepData_SelectMember::SetReal (const Standard_Real ) { }
84
85 Standard_CString StepData_SelectMember::String () const { return ""; }
86 void StepData_SelectMember::SetString (const Standard_CString ) { }
87
88 Standard_Integer StepData_SelectMember::Enum () const { return Int(); }
89 Standard_CString StepData_SelectMember::EnumText () const { return String(); }
90
91 void StepData_SelectMember::SetEnum
92 (const Standard_Integer val, const Standard_CString text)
93{
94 SetKind(KindEnum);
95 SetInt(val);
96 if (text && text[0] != '\0') SetEnumText(val,text);
97}
98
99 void StepData_SelectMember::SetEnumText
100 (const Standard_Integer val, const Standard_CString text)
101 { SetString(text); }