00001 #ifndef _INT16VALUE_H_ 00002 #define _INT16VALUE_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 FdoInt16Value class derives from FdoDataValue and represents a 16-bit signed integer value. 00032 class FdoInt16Value : public FdoDataValue 00033 { 00034 /// \cond DOXYGEN-IGNORE 00035 friend class FdoDataValue; 00036 friend class FdoByteValue; 00037 friend class FdoStringValue; 00038 protected: 00039 /// \brief 00040 /// Constructs a default instance of an FdoInt16Value with a 00041 /// value of null. 00042 /// \return 00043 /// Returns nothing 00044 /// 00045 FdoInt16Value(); 00046 00047 /// \brief 00048 /// Constructs a default instance of an FdoInt16Value using the specified arguaments. 00049 /// \param value 00050 /// Input a 16 bit integer 00051 /// 00052 /// \return 00053 /// Returns nothing 00054 /// 00055 FdoInt16Value(FdoInt16 value); 00056 00057 /// \brief 00058 /// Default destructor for FdoInt16Value. 00059 /// \return 00060 /// Returns nothing 00061 /// 00062 virtual ~FdoInt16Value(); 00063 00064 virtual void Dispose(); 00065 /// \endcond 00066 00067 public: 00068 00069 /// \brief 00070 /// Constructs a default instance of an FdoInt16Value with a value of null. 00071 /// 00072 /// \return 00073 /// Returns the created FdoInt16Value 00074 /// 00075 FDO_API static FdoInt16Value* Create(); 00076 00077 /// \brief 00078 /// Constructs a default instance of an FdoInt16Value using the specified arguments. 00079 /// 00080 /// \param value 00081 /// Input a 16 bit integer 00082 /// 00083 /// \return 00084 /// Returns the created FdoInt16Value 00085 /// 00086 FDO_API static FdoInt16Value* Create(FdoInt16 value); 00087 00088 /// \brief 00089 /// Gets the data type of the FdoInt16Value. 00090 /// 00091 /// \return 00092 /// Returns an FdoDataType 00093 /// 00094 FDO_API FdoDataType GetDataType(); 00095 00096 /// \brief 00097 /// Gets the FdoInt16Value. 00098 /// 00099 /// \return 00100 /// Returns a 16 bit integer 00101 /// 00102 FDO_API FdoInt16 GetInt16(); 00103 00104 /// \brief 00105 /// Sets the FdoInt16Value. 00106 /// 00107 /// \param value 00108 /// Input a 16 bit integer 00109 /// 00110 /// \return 00111 /// Returns nothing 00112 /// 00113 FDO_API void SetInt16(FdoInt16 value); 00114 00115 /// \brief 00116 /// Overrides FdoExpression.Process to pass the FdoInt16Value 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 16 bit integer 00140 /// 00141 FDO_API operator FdoInt16() 00142 { 00143 return m_data; 00144 } 00145 00146 /// \cond DOXYGEN-IGNORE 00147 protected: 00148 /// \brief 00149 /// Constructs an instance of an FdoInt16Value 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 FdoInt16 range 00179 // ( -32768 to 32767 ): 00180 /// true - convert values less than -32768 to -32768, convert values greater than 32767 to 32767 00181 /// false - behaviour depends on nullIfIncompatible: 00182 /// true - return NULL. 00183 /// false - throw an exception 00184 /// \return 00185 /// Returns an FdoInt16Value, 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 FdoInt16Value* 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 FdoInt16 m_data; 00201 /// \endcond 00202 }; 00203 #endif 00204 00205