00001 #ifndef _INT32VALUE_H_ 00002 #define _INT32VALUE_H_ 00003 // 00004 00005 // 00006 // Copyright (C) 2004-2006 Autodesk, Inc. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of version 2.1 of the GNU Lesser 00010 // General Public License as published by the Free Software Foundation. 00011 // 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 // Lesser General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public 00018 // License along with this library; if not, write to the Free Software 00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 // 00021 00022 #ifdef _WIN32 00023 #pragma once 00024 #endif 00025 00026 #include <FdoStd.h> 00027 #include <Fdo/Expression/DataValue.h> 00028 #include <Fdo/Schema/DataType.h> 00029 00030 /// \brief 00031 /// The FdoInt32Value class derives from FdoDataValue and represents a 32-bit signed integer value. 00032 class FdoInt32Value : public FdoDataValue 00033 { 00034 /// \cond DOXYGEN-IGNORE 00035 friend class FdoByteValue; 00036 friend class FdoInt16Value; 00037 friend class FdoStringValue; 00038 friend class FdoDataValue; 00039 protected: 00040 /// \brief 00041 /// Constructs a default instance of an FdoInt32Value with a 00042 /// value of null. 00043 /// \return 00044 /// Returns nothing 00045 /// 00046 FdoInt32Value(); 00047 00048 /// \brief 00049 /// Constructs a default instance of an FdoInt32Value using the specified arguments. 00050 /// \param value 00051 /// Input a 32 bit integer 00052 /// 00053 /// \return 00054 /// Returns nothing 00055 /// 00056 FdoInt32Value(FdoInt32 value); 00057 00058 /// \brief 00059 /// Default destructor for FdoInt32Value. 00060 /// \return 00061 /// Returns nothing 00062 /// 00063 virtual ~FdoInt32Value(); 00064 00065 virtual void Dispose(); 00066 /// \endcond 00067 00068 public: 00069 /// \brief 00070 /// Constructs a default instance of an FdoInt32Value with a value of null. 00071 /// 00072 /// \return 00073 /// Returns nothing 00074 /// 00075 FDO_API static FdoInt32Value* Create(); 00076 00077 /// \brief 00078 /// Constructs a default instance of an FdoInt32Value using the specified arguments. 00079 /// 00080 /// \param value 00081 /// Input a 32 bit integer 00082 /// 00083 /// \return 00084 /// Returns nothing 00085 /// 00086 FDO_API static FdoInt32Value* Create(FdoInt32 value); 00087 00088 /// \brief 00089 /// Gets the data type of the FdoInt32Value. 00090 /// 00091 /// \return 00092 /// Returns an FdoDataType 00093 /// 00094 FDO_API FdoDataType GetDataType(); 00095 00096 /// \brief 00097 /// Gets the FdoInt32Value. 00098 /// 00099 /// \return 00100 /// Returns a 32 bit integer 00101 /// 00102 FDO_API FdoInt32 GetInt32(); 00103 00104 /// \brief 00105 /// Sets the FdoInt32Value. 00106 /// 00107 /// \param value 00108 /// Input a 32 bit integer 00109 /// 00110 /// \return 00111 /// Returns nothing 00112 /// 00113 FDO_API void SetInt32(FdoInt32 value); 00114 00115 /// \brief 00116 /// Overrides FdoExpression.Process to pass the FdoInt32Value to the appropriate 00117 /// expression processor operation. 00118 /// 00119 /// \param p 00120 /// Input an FdoIExpressionProcessor 00121 /// 00122 /// \return 00123 /// Returns nothing 00124 /// 00125 FDO_API void Process(FdoIExpressionProcessor* p); 00126 00127 /// \brief 00128 /// Returns the well defined text representation of this expression. 00129 /// 00130 /// \return 00131 /// Returns a character string 00132 /// 00133 FDO_API FdoString* ToString(); 00134 00135 /// \brief 00136 /// A cast operator to get the integer value. 00137 /// 00138 /// \return 00139 /// Returns a 32 bit integer 00140 /// 00141 FDO_API operator FdoInt32() 00142 { 00143 return m_data; 00144 } 00145 00146 /// \cond DOXYGEN-IGNORE 00147 protected: 00148 /// \brief 00149 /// Constructs an instance of an FdoInt32Value from another FdoDataValue. 00150 /// 00151 /// \param src 00152 /// Input the other FdoDataValue. Must be of one of the following types: 00153 /// FdoDataType_Boolean 00154 /// FdoDataType_Byte 00155 /// FdoDataType_Decimal 00156 /// FdoDataType_Double 00157 /// FdoDataType_Int16 00158 /// FdoDataType_Int32 00159 /// FdoDataType_Int64 00160 /// FdoDataType_Single 00161 /// FdoDataType_String 00162 /// - value must be numeric. 00163 /// 00164 /// In all other cases, the src type is considered incompatible with this type. 00165 /// \param nullIfIncompatible 00166 /// Input will determine what to do if the source value cannot be converted to 00167 /// this type: 00168 /// true - return NULL. 00169 /// false - throw an exception 00170 /// 00171 /// \param shift 00172 /// Input determines whether non integer values can be converted: 00173 /// true - convert values by rounding them. 00174 /// false - behaviour depends on nullIfIncompatible: 00175 /// true - return NULL. 00176 /// false - throw an exception 00177 /// \param truncate 00178 /// Input determines what to do if source value is outside the FdoInt32 range 00179 // ( LONG_MIN to LONG_MAX ): 00180 /// true - convert values less than LONG_MIN to LONG_MIN, convert values greater than LONG_MAX to LONG_MAX 00181 /// false - behaviour depends on nullIfIncompatible: 00182 /// true - return NULL. 00183 /// false - throw an exception 00184 /// \return 00185 /// Returns an FdoInt32Value, whose value is converted from the src value. 00186 /// If src is an FdoBooleanValue: 00187 /// false is converted to 0 00188 /// true is converted to 1 00189 /// 00190 static FdoInt32Value* Create( 00191 FdoDataValue* src, 00192 FdoBoolean nullIfIncompatible = false, 00193 FdoBoolean shift = true, 00194 FdoBoolean truncate = false 00195 ); 00196 00197 // See FdoDataValue::DoCompare() 00198 virtual FdoCompareType DoCompare( FdoDataValue* other ); 00199 00200 FdoInt32 m_data; 00201 /// \endcond 00202 }; 00203 #endif 00204 00205