• Main Page
  • Modules
  • Classes
  • Files
  • File List
  • File Members

ByteValue.h

Go to the documentation of this file.
00001 #ifndef _BYTEVALUE_H_
00002 #define _BYTEVALUE_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 FdoByteValue class derives from FdoDataValue and represents a literal
00032 /// byte value.
00033 class FdoByteValue : public FdoDataValue
00034 {
00035     friend class FdoStringValue;
00036     friend class FdoDataValue;
00037 /// \cond DOXYGEN-IGNORE
00038 protected:
00039     /// \brief
00040     /// Constructs a default instance of an FdoByteValue with a value of null.
00041     /// \return
00042     /// Returns nothing
00043     /// 
00044     FdoByteValue();
00045 
00046     /// \brief
00047     /// Constructs a default instance of an FdoByteValue using the specified arguments.
00048     /// \param value 
00049     /// Input a byte
00050     /// 
00051     /// \return
00052     /// Returns nothing
00053     /// 
00054     FdoByteValue(FdoByte value);
00055 
00056     /// \brief
00057     /// Default destructor for FdoByteValue.
00058     virtual ~FdoByteValue();
00059 
00060     virtual void Dispose();
00061 /// \endcond
00062 
00063 public:
00064     /// \brief
00065     /// Constructs a default instance of an FdoByteValue with a value of null.
00066     /// 
00067     /// \return
00068     /// Returns the created FdoByteValue
00069     /// 
00070     FDO_API static FdoByteValue* Create();
00071 
00072     /// \brief
00073     /// Constructs a default instance of an FdoByteValue using the specified arguments.
00074     /// 
00075     /// \param value 
00076     /// Input a byte
00077     /// 
00078     /// \return
00079     /// Returns the created FdoByteValue
00080     /// 
00081     FDO_API static FdoByteValue* Create(FdoByte value);
00082 
00083     /// \brief
00084     /// Gets the data type of the FdoByteValue.
00085     /// 
00086     /// \return
00087     /// Returns an FdoDataType
00088     /// 
00089     FDO_API FdoDataType GetDataType();
00090 
00091     /// \brief
00092     /// Gets the FdoByteValue.
00093     /// 
00094     /// \return
00095     /// Returns a byte
00096     /// 
00097     FDO_API FdoByte GetByte();
00098 
00099     /// \brief
00100     /// Sets the byte value.
00101     /// 
00102     /// \param value 
00103     /// Input a byte
00104     /// 
00105     /// \return
00106     /// Returns nothing
00107     /// 
00108     FDO_API void SetByte(FdoByte value);
00109 
00110     /// \brief
00111     /// Overrides FdoExpression.Process to pass the FdoByteValue to the appropriate
00112     /// expression processor operation.
00113     /// 
00114     /// \param p 
00115     /// Input an FdoIExpressionProcessor
00116     /// 
00117     /// \return
00118     /// Returns nothing
00119     /// 
00120     FDO_API void Process(FdoIExpressionProcessor* p);
00121 
00122     /// \brief
00123     /// Returns the well defined text representation of this expression.
00124     /// 
00125     /// \return
00126     /// Returns a text string
00127     /// 
00128     FDO_API FdoString* ToString();
00129 
00130     /// \brief
00131     /// A cast operator to get the byte value.
00132     /// 
00133     /// \return
00134     /// Returns a byte
00135     /// 
00136     FDO_API operator FdoByte()
00137     {
00138         return m_data;
00139     }
00140 
00141 /// \cond DOXYGEN-IGNORE
00142 protected:
00143     /// \brief
00144     /// Constructs an instance of an FdoByteValue from another FdoDataValue.
00145     /// 
00146     /// \param src 
00147     /// Input the other FdoDataValue. Must be of one of the following types:
00148     ///     FdoDataType_Boolean
00149     ///     FdoDataType_Byte
00150     ///     FdoDataType_Decimal
00151     ///     FdoDataType_Double
00152     ///     FdoDataType_Int16
00153     ///     FdoDataType_Int32
00154     ///     FdoDataType_Int64
00155     ///     FdoDataType_Single
00156     ///     FdoDataType_String
00157     ///         - value must be numeric.
00158     ///
00159     /// In all other cases, the src type is considered incompatible with this type.
00160     /// \param nullIfIncompatible 
00161     /// Input will determine what to do if the source value cannot be converted to 
00162     /// this type:
00163     ///     true - return NULL.
00164     ///     false - throw an exception
00165     /// 
00166     /// \param shift 
00167     /// Input determines whether non integer values can be converted:
00168     ///     true - convert values by rounding them.
00169     ///     false - behaviour depends on nullIfIncompatible:
00170     ///         true - return NULL.
00171     ///         false - throw an exception
00172     /// \param truncate 
00173     /// Input determines what to do if source value is outside the FdoByte range
00174     //  ( 0 to 255 ):
00175     ///     true - convert values less than 0 to 0, convert values greater than 255 to 255
00176     ///     false - behaviour depends on nullIfIncompatible:
00177     ///         true - return NULL.
00178     ///         false - throw an exception
00179     /// \return
00180     /// Returns an FdoByteValue, whose value is converted from the src value. 
00181     /// If src is an FdoBooleanValue:
00182     ///     false is converted to 0
00183     ///     true is converted to 1
00184     ///
00185     static FdoByteValue* Create(
00186         FdoDataValue* src, 
00187         FdoBoolean nullIfIncompatible = false,
00188         FdoBoolean shift = true, 
00189         FdoBoolean truncate = false 
00190     );
00191 
00192     // See FdoDataValue::DoCompare()
00193     virtual FdoCompareType DoCompare( FdoDataValue* other );
00194 
00195     FdoByte m_data;
00196 /// \endcond
00197 };
00198 #endif
00199 
00200 
Please send us your comment about this page