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

DateTimeValue.h

Go to the documentation of this file.
00001 #ifndef _DATATIMEVALUE_H_
00002 #define _DATATIMEVALUE_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 FdoDateTimeValue class derives from FdoDataValue and represents a date or time.
00032 class FdoDateTimeValue : public FdoDataValue
00033 {
00034     friend class FdoDataValue;
00035 /// \cond DOXYGEN-IGNORE
00036 protected:
00037     /// \brief
00038     /// Constructs a default instance of an FdoDateTimeValue with a
00039     /// value of null.
00040     /// 
00041     /// \return
00042     /// Returns nothing
00043     /// 
00044     FdoDateTimeValue();
00045 
00046     /// \brief
00047     /// Constructs a default instance of an FdoDateTimeValue using the specified
00048     /// arguments.
00049     /// 
00050     /// \param value 
00051     /// Input a FdoDateTime
00052     /// 
00053     /// \return
00054     /// Returns nothing
00055     /// 
00056     FdoDateTimeValue(FdoDateTime value);
00057 
00058     /// \brief
00059     /// Default destructor for FdoDateTimeValue.
00060     /// 
00061     /// \return
00062     /// Returns nothing
00063     /// 
00064     virtual ~FdoDateTimeValue();
00065 
00066     virtual void Dispose();
00067     /// \endcond
00068 
00069 public:
00070     /// \brief
00071     /// Constructs a default instance of an FdoDateTimeValue with a value of null.
00072     /// 
00073     /// \return
00074     /// Returns the created FdoDateTimeValue
00075     /// 
00076     FDO_API static FdoDateTimeValue* Create();
00077 
00078     /// \brief
00079     /// Constructs a default instance of an FdoDateTimeValue using the specified arguments.
00080     /// 
00081     /// \param value 
00082     /// Input a FdoDateTime
00083     /// 
00084     /// \return
00085     /// Returns the created FdoDateTimeValue
00086     /// 
00087     FDO_API static FdoDateTimeValue* Create(FdoDateTime value);
00088 
00089     /// \brief
00090     /// Gets the data type of the FdoDateTimeValue.
00091     /// 
00092     /// \return
00093     /// Returns an FdoDataType
00094     /// 
00095     FDO_API FdoDataType GetDataType();
00096 
00097     /// \brief
00098     /// Gets the date time value.
00099     /// 
00100     /// \return
00101     /// Returns a FdoDateTime
00102     /// 
00103     FDO_API FdoDateTime GetDateTime();
00104 
00105     /// \brief
00106     /// Sets the date time value.
00107     /// 
00108     /// \param value 
00109     /// Input a FdoDateTime
00110     /// 
00111     /// \return
00112     /// Returns nothing
00113     /// 
00114     FDO_API void SetDateTime(FdoDateTime value);
00115 
00116     /// \brief
00117     /// Overrides FdoExpression.Process to pass the FdoDateTimeValue to the appropriate
00118     /// expression processor operation.
00119     /// 
00120     /// \param p 
00121     /// Input an FdoIExpressionProcessor
00122     /// 
00123     /// \return
00124     /// Returns nothing
00125     /// 
00126     FDO_API void Process(FdoIExpressionProcessor* p);
00127 
00128     /// \brief
00129     /// Returns the well defined text representation of this expression.
00130     /// 
00131     /// \return
00132     /// Returns a character string
00133     /// 
00134     FDO_API FdoString* ToString();
00135 
00136     /// \brief
00137     /// A cast operator to get the date time value.
00138     /// 
00139     /// \return
00140     /// Returns a FdoDateTime
00141     /// 
00142     FDO_API operator FdoDateTime()
00143     {
00144         return m_data;
00145     }
00146 
00147 /// \cond DOXYGEN-IGNORE
00148 protected:
00149     /// \brief
00150     /// Constructs an instance of an FdoDateTimeValue from another FdoDataValue.
00151     /// 
00152     /// \param src 
00153     /// Input the other FdoDataValue. Must be of one of the following types:
00154     ///     FdoDataType_DateTime
00155     ///     FdoDataType_Double
00156     ///     FdoDataType_String
00157     ///         - value must follow an FDO DateTime format
00158     ///           (e.g. "TIMESTAMP 'YYYY-MM-DD HH24:MI:SS'"
00159     ///
00160     /// In all other cases, the src type is considered incompatible with this type.
00161     /// \param nullIfIncompatible 
00162     /// Input will determine what to do if the source value cannot be converted to 
00163     /// this type:
00164     ///     true - return NULL.
00165     ///     false - throw an exception
00166     /// 
00167     /// \param shift 
00168     /// Input for future use.
00169     /// \param truncate 
00170     /// Input for future use.
00171     /// \return
00172     /// Returns an FdoDateTimeValue, whose value is converted from the src value. 
00173     static FdoDateTimeValue* Create(
00174         FdoDataValue* src, 
00175         FdoBoolean nullIfIncompatible = false,
00176         FdoBoolean shift = true, 
00177         FdoBoolean truncate = false 
00178     );
00179 
00180     // See FdoDataValue::DoCompare()
00181     virtual FdoCompareType DoCompare( FdoDataValue* other );
00182 
00183     FdoDateTime m_data;
00184 /// \endcond
00185 };
00186 #endif
00187 
00188 
Please send us your comment about this page