0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / StepData / StepData_SelectMember.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <Standard_Type.hxx>
16 #include <StepData_SelectMember.hxx>
17
18 IMPLEMENT_STANDARD_RTTIEXT(StepData_SelectMember,Standard_Transient)
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
30 StepData_SelectMember::StepData_SelectMember ()    {  }
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
44 Interface_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 (const Standard_Integer val, 
92                                       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 (const Standard_Integer /*val*/, 
100                                           const Standard_CString text)
101 {
102   SetString(text);  
103 }