FDO API Reference Feature Data Objects

PropertyValueConstraintRange.h

Go to the documentation of this file.
00001 #ifndef _PROPERTYVALUECONSTRAINTRANGE_H_
00002 #define _PROPERTYVALUECONSTRAINTRANGE_H_
00003 
00004 //
00005 // Copyright (C) 2004-2006  Autodesk, Inc.
00006 // 
00007 // This library is free software; you can redistribute it and/or
00008 // modify it under the terms of version 2.1 of the GNU Lesser
00009 // General Public License as published by the Free Software Foundation.
00010 // 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 //
00020 
00021 #ifdef _WIN32
00022 #pragma once
00023 #endif
00024 
00025 #include <FdoStd.h>
00026 #include <Fdo/Schema/PropertyValueConstraint.h>
00027 #include <Fdo/Expression/DataValue.h>
00028 
00029 /// \brief
00030 /// FdoPropertyValueConstraintRange is used to specify minimum and / or maximum allowed values for a particular property. 
00031 /// It can be used for all data property types except for Boolean, BLOB, or CLOB.
00032 /// One or the other or both of MinValue and MaxValue must be specified. If both are specified, then MaxValue must be greater 
00033 /// than or equal to MinValue and if either MinInclusive or MaxInclusive are false, then MaxValue must be greater than MinValue. 
00034 /// MinValue and MaxValue if specified must be valid values for the property type. E.g. if the property is decimal(4,0), 
00035 /// then the maximum possible MaxValue is 9999.
00036 /// If the data property definition includes a non-null default value, then this constraint is applied to that value as well.
00037 /// If the data property definition allows nulls, a null value is considered as being valid regardless of the range constraint.
00038 class FdoPropertyValueConstraintRange : public FdoPropertyValueConstraint
00039 {
00040 protected:
00041     /// Constructs a default instance of a FdoPropertyValueConstraintRange.
00042     FdoPropertyValueConstraintRange();
00043 
00044     /// Constructs an instance of a FdoPropertyValueConstraintRange using the specified
00045     /// arguments.
00046     FdoPropertyValueConstraintRange(FdoDataValue  *minValue, FdoDataValue* maxValue);
00047 
00048     virtual ~FdoPropertyValueConstraintRange();
00049 
00050     virtual void Dispose()
00051     {
00052         delete this;
00053     }
00054 public:
00055     
00056     /// \brief
00057     /// Constructs an empty instance of an FdoPropertyValueConstraintRange.
00058     /// 
00059     /// \return
00060     /// Returns an FdoPropertyValueConstraintRange
00061     /// 
00062     FDO_API static FdoPropertyValueConstraintRange* Create( );
00063 
00064     /// \brief
00065     /// Constructs and populates an instance of an FdoPropertyValueConstraintRange.
00066     /// 
00067     /// \param minValue 
00068     /// Minimum allowed value
00069     /// \param maxValue 
00070     /// Maximum allowed value
00071     /// 
00072     /// \return
00073     /// Returns an FdoPropertyValueConstraintRange
00074     /// 
00075     FDO_API static FdoPropertyValueConstraintRange* Create( FdoDataValue  *minValue, FdoDataValue* maxValue );
00076 
00077     /// \brief
00078     /// Returns FdoPropertyValueConstraintType_Range type.
00079     /// 
00080     /// \return
00081     /// Returns the constraint type
00082     /// 
00083     FDO_API virtual FdoPropertyValueConstraintType GetConstraintType();
00084 
00085     /// \brief
00086     /// Get the minimum allowed value. The type of this is the same as the type of the property. 
00087     /// E.g. if the property is int32, then this value is int32.
00088     /// 
00089     /// \return
00090     /// Returns the minimum value
00091     /// 
00092     FDO_API FdoDataValue* GetMinValue();
00093 
00094     /// \brief
00095     /// Set the minimum allowed value.
00096     /// 
00097     /// \param value 
00098     /// Minimum allowed value
00099     /// 
00100     /// \return
00101     /// Returns nothing
00102     /// 
00103     FDO_API void SetMinValue(FdoDataValue* value);
00104 
00105     /// \brief
00106     /// Returns a bool to indicate if the minimum value is inclusive or exclusive. This is the difference between >= and >. 
00107     /// This is a boolean type where true means inclusive.
00108     /// 
00109     /// \return
00110     /// Returns true if the value is inclusive. false otherwise
00111     /// 
00112     FDO_API bool GetMinInclusive();
00113 
00114     /// \brief
00115     /// Set the minimum value to inclusive or exclusive. This is the difference between >= and >. 
00116     /// 
00117     /// \param value 
00118     /// This is a boolean type where true means inclusive.
00119     /// 
00120     /// \return
00121     /// Returns nothing
00122     /// 
00123     FDO_API void SetMinInclusive(bool value);
00124 
00125     /// \brief
00126     /// Get the maximum allowed value. The type of this is the same as the type of the property. 
00127     /// E.g. if the property is int32, then this value is int32.
00128     /// 
00129     /// \return
00130     /// Returns the maximum value
00131     /// 
00132     FDO_API FdoDataValue* GetMaxValue();
00133 
00134     /// \brief
00135     /// Set the maximum allowed value.
00136     /// 
00137     /// \param value 
00138     /// Maximum allowed value
00139     /// 
00140     /// \return
00141     /// Returns nothing
00142     /// 
00143     FDO_API void SetMaxValue(FdoDataValue* value);
00144 
00145     /// \brief
00146     /// Returns a bool to indicate if the maximum value is inclusive or exclusive. This is the difference between <= and <. 
00147     /// This is a boolean type where true means inclusive.
00148     /// 
00149     /// \return
00150     /// Returns true if the value is inclusive. false otherwise
00151     /// 
00152     FDO_API bool GetMaxInclusive();
00153 
00154     /// \brief
00155     /// Returns a bool to indicate if the maximum value is inclusive or exclusive. This is the difference between <= and <. 
00156     /// This is a boolean type where true means inclusive.
00157     /// 
00158     /// \return
00159     /// Returns true if the value is inclusive. false otherwise
00160     /// 
00161     FDO_API void SetMaxInclusive(bool value);
00162 
00163 private:
00164     FdoDataValue*   m_minValue;
00165     FdoDataValue*   m_maxValue;
00166     bool            m_isMinInclusive;
00167     bool            m_isMaxInclusive;
00168 };
00169 
00170 #endif
00171 
00172 

Comments or suggestions? Send us feedback.