0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / StepVisual / StepVisual_NullStyleMember.cxx
1 // Created on: 2015-07-16
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2015 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <StepVisual_NullStyleMember.hxx>
17 #include <StepData_EnumTool.hxx>
18 #include <TCollection_AsciiString.hxx>
19
20 IMPLEMENT_STANDARD_RTTIEXT(StepVisual_NullStyleMember,StepData_SelectInt)
21
22 static StepData_EnumTool tool
23   (".NULL.");
24
25 //=======================================================================
26 //function : StepVisual_NullStyleMember
27 //purpose  : 
28 //=======================================================================
29
30 StepVisual_NullStyleMember::StepVisual_NullStyleMember ()   {  }
31
32 //=======================================================================
33 //function : EnumText
34 //purpose  : 
35 //=======================================================================
36
37 Standard_CString  StepVisual_NullStyleMember::EnumText () const
38 {
39   return tool.Text(Int()).ToCString();
40 }
41
42 //=======================================================================
43 //function : SetEnumText
44 //purpose  : 
45 //=======================================================================
46
47 void  StepVisual_NullStyleMember::SetEnumText (const Standard_Integer /*theValue*/, 
48                                                                   const Standard_CString theText)
49 {
50   Standard_Integer aVal = tool.Value (theText);
51   if (aVal >= 0) SetInt (aVal);
52 }
53
54 //=======================================================================
55 //function : SetValue
56 //purpose  : 
57 //=======================================================================
58
59 void  StepVisual_NullStyleMember::SetValue (const StepVisual_NullStyle theValue)
60 {
61   SetInt ( Standard_Integer (theValue) );  
62 }
63
64 //=======================================================================
65 //function : Value
66 //purpose  : 
67 //=======================================================================
68
69 StepVisual_NullStyle StepVisual_NullStyleMember::Value () const
70 {
71   return StepVisual_NullStyle (Int());  
72 }