1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Standard_Type.hxx>
16 #include <StepData_SelectMember.hxx>
18 IMPLEMENT_STANDARD_RTTIEXT(StepData_SelectMember,Standard_Transient)
20 // Definitions reprises de Field :
30 StepData_SelectMember::StepData_SelectMember () { }
32 Standard_Boolean StepData_SelectMember::HasName () const { return Standard_False; }
33 Standard_CString StepData_SelectMember::Name () const { return ""; }
35 Standard_Boolean StepData_SelectMember::SetName (const Standard_CString /*bid*/)
36 { return Standard_False; }
38 Standard_Boolean StepData_SelectMember::Matches (const Standard_CString name) const
39 { return !strcmp (name,Name()); }
41 Standard_Integer StepData_SelectMember::Kind () const { return 0; }
42 void StepData_SelectMember::SetKind (const Standard_Integer ) { }
44 Interface_ParamType StepData_SelectMember::ParamType () const
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;
56 Standard_Integer StepData_SelectMember::Int () const { return 0; }
57 void StepData_SelectMember::SetInt (const Standard_Integer ) { }
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)); }
66 StepData_Logical StepData_SelectMember::Logical () const
68 Standard_Integer ival = Int();
69 if (ival == 0) return StepData_LFalse;
70 if (ival == 1) return StepData_LTrue;
71 return StepData_LUnknown;
74 void StepData_SelectMember::SetLogical (const StepData_Logical val)
77 if (val == StepData_LFalse) SetInt(0);
78 if (val == StepData_LTrue) SetInt(0);
79 if (val == StepData_LUnknown) SetInt(0);
82 Standard_Real StepData_SelectMember::Real () const { return 0.0; }
83 void StepData_SelectMember::SetReal (const Standard_Real ) { }
85 Standard_CString StepData_SelectMember::String () const { return ""; }
86 void StepData_SelectMember::SetString (const Standard_CString ) { }
88 Standard_Integer StepData_SelectMember::Enum () const { return Int(); }
89 Standard_CString StepData_SelectMember::EnumText () const { return String(); }
91 void StepData_SelectMember::SetEnum (const Standard_Integer val,
92 const Standard_CString text)
96 if (text && text[0] != '\0') SetEnumText(val,text);
99 void StepData_SelectMember::SetEnumText (const Standard_Integer /*val*/,
100 const Standard_CString text)