00001 00002 // exotkParameter_Boolean.cxx 00004 // Copyright (C) 2001 Stephane Routelous 00005 // 00006 // This file is part of exoTK. 00007 // 00008 // exoTK is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // exoTK is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with exoTK; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 00029 #include <exotkParameter_Boolean.hxx> 00030 #include <stdlib.h> 00031 #ifndef _Standard_TypeDef_HeaderFile 00032 #include <Standard_Boolean.hxx> 00033 #endif 00034 00035 // 00036 IMPLEMENT_STANDARD_HANDLE(exotkParameter_Boolean,exotkParameter_Root) 00037 IMPLEMENT_STANDARD_RTTI(exotkParameter_Boolean,exotkParameter_Root) 00038 // 00039 // Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and 00040 // a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro. 00041 // We must respect the order: from the direct ancestor class 00042 // to the base class. 00043 // 00044 00045 IMPLEMENT_STANDARD_TYPE(exotkParameter_Boolean) 00046 IMPLEMENT_STANDARD_SUPERTYPE(exotkParameter_Root) 00047 IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) 00048 IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient) 00049 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() 00050 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(exotkParameter_Root) 00051 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared) 00052 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient) 00053 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() 00054 IMPLEMENT_STANDARD_TYPE_END(exotkParameter_Boolean) 00055 00056 00057 //================================================================================== 00058 // Function name : exotkParameter_Boolean::exotkParameter_Boolean 00059 //================================================================================== 00060 // Written by : Stephane Routelous - 08/03/2001 01:01:47 00061 // Description : 00062 // Return type : 00063 //================================================================================== 00064 // Argument : const Standard_Boolean aValue 00065 exotkParameter_Boolean::exotkParameter_Boolean(const Standard_Boolean aValue) 00066 :myValue(aValue) 00067 { 00068 myType = exotkParameter_Type_Boolean; 00069 } 00070 00071 00072 //================================================================================== 00073 // Function name : exotkParameter_Boolean::~exotkParameter_Boolean 00074 //================================================================================== 00075 // Written by : Stephane Routelous - 08/03/2001 01:01:45 00076 // Description : 00077 // Return type : 00078 //================================================================================== 00079 exotkParameter_Boolean::~exotkParameter_Boolean() 00080 { 00081 00082 } 00083 00084 00085 //================================================================================== 00086 // Function name : exotkParameter_Boolean::DeepCopy 00087 //================================================================================== 00088 // Written by : Stephane Routelous - 05/04/2001 12:12:34 00089 // Description : 00090 // Return type : void 00091 //================================================================================== 00092 // Argument : const Handle_exotkParameter_Root &aParameterToCopy 00093 void exotkParameter_Boolean::DeepCopy(const Handle_exotkParameter_Root &aParameterToCopy) 00094 { 00095 exotkParameter_Root::DeepCopy(aParameterToCopy); 00096 if ( aParameterToCopy->IsKind(STANDARD_TYPE(exotkParameter_Boolean)) ) 00097 { 00098 Handle_exotkParameter_Boolean theBooleanToCopy = Handle_exotkParameter_Boolean::DownCast(aParameterToCopy); 00099 myValue = theBooleanToCopy->Value(); 00100 } 00101 } 00102 00103 //================================================================================== 00104 // Function name : exotkParameter_Boolean::SetValue 00105 //================================================================================== 00106 // Written by : Stephane Routelous - 08/03/2001 01:01:51 00107 // Description : 00108 // Return type : void 00109 //================================================================================== 00110 // Argument : const Standard_Boolean aValue 00111 void exotkParameter_Boolean::SetValue(const Standard_Boolean aValue) 00112 { 00113 myValue = aValue; 00114 } 00115 00116 //================================================================================== 00117 // Function name : exotkParameter_Boolean::Value 00118 //================================================================================== 00119 // Written by : Stephane Routelous - 08/03/2001 01:01:53 00120 // Description : 00121 // Return type : Standard_Boolean 00122 //================================================================================== 00123 Standard_Boolean exotkParameter_Boolean::Value() const 00124 { 00125 return myValue; 00126 } 00127 00128 //================================================================================== 00129 // Function name : exotkParameter_Boolean::SetParameterAsString 00130 //================================================================================== 00131 // Written by : Stephane Routelous - 08/03/2001 01:01:56 00132 // Description : 00133 // Return type : Standard_Boolean 00134 //================================================================================== 00135 // Argument : const TCollection_AsciiString& aParameter 00136 Standard_Boolean exotkParameter_Boolean::SetParameterAsString(const TCollection_AsciiString& aParameter) 00137 { 00138 TCollection_AsciiString theString = aParameter; 00139 theString.LowerCase(); 00140 if ( (theString == "true") || (theString == "standard_true") ) 00141 { 00142 myValue = Standard_True; 00143 return Standard_True; 00144 } 00145 else if ( (theString == "false") || (theString == "standard_false") ) 00146 { 00147 myValue = Standard_False; 00148 return Standard_True; 00149 } 00150 return Standard_False; 00151 } 00152 00153 //================================================================================== 00154 // Function name : exotkParameter_Boolean::ParameterAsString 00155 //================================================================================== 00156 // Written by : Stephane Routelous - 08/03/2001 01:01:58 00157 // Description : 00158 // Return type : TCollection_AsciiString 00159 //================================================================================== 00160 TCollection_AsciiString exotkParameter_Boolean::ParameterAsString() const 00161 { 00162 if ( myValue ) 00163 return TCollection_AsciiString("true"); 00164 else 00165 return TCollection_AsciiString("false"); 00166 }
1.2.12 written by Dimitri van Heesch,
© 1997-2001