FDO API Reference | Feature Data Objects |
00001 #ifndef _PROPERTYVALUECONSTRAINTLIST_H_ 00002 #define _PROPERTYVALUECONSTRAINTLIST_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/DataValueCollection.h> 00028 00029 /// \brief 00030 /// FdoPropertyValueConstraintList is used to specify a list of allowed values for a particular property. 00031 /// It can be used for all data property types except for Boolean, BLOB, or CLOB. 00032 /// This constraint is represented by a list of values of the same type as the corresponding data property. 00033 /// The list cannot be empty. The list could be a single value. While that may not seem very useful it could serve as a 00034 /// temporary way to enforce a single value for a property, e.g. for a particular customer, Parcel.State is always 'CA' 00035 /// In this case, the definer of the property definition probably should also set the default value to be the same, unless it can be null. 00036 /// The list does not need to be ordered. However, a provider may choose to reorder the list so the list that is returned when 00037 /// a user gets the definition of this constraint for a property may be different than the order that was given when defined. 00038 /// E.g. defined as (12, 8, 24), but returned as (8, 12, 24). If the list has duplicate values, the provider may choose to eliminate 00039 /// duplicates from the list. 00040 /// If the data property definition allows nulls, a null value is considered as being valid regardless of this list of valid values. 00041 /// The list of valid values should not include the null value itself, but leave the specification of whether null is allowed to 00042 /// the null value constraint. If the data property definition includes a non-null default value, then that value should be one 00043 /// of the values in the list. 00044 /// If both a valid values list constraint and a unique constraint on the same property are included, then the side effect is that 00045 /// there will be an upper limit of the number of objects of that class that have non-null values for the property. 00046 class FdoPropertyValueConstraintList : public FdoPropertyValueConstraint 00047 { 00048 friend class FdoInternalPropertyValueConstraintList; 00049 00050 protected: 00051 /// Constructs a default instance of a FdoPropertyValueConstraintList. 00052 FdoPropertyValueConstraintList(); 00053 00054 virtual ~FdoPropertyValueConstraintList(); 00055 00056 virtual void Dispose() 00057 { 00058 delete this; 00059 } 00060 public: 00061 00062 /// \brief 00063 /// Constructs an empty instance of an FdoPropertyValueConstraintList. 00064 /// 00065 /// \return 00066 /// Returns an FdoPropertyValueConstraintList 00067 /// 00068 FDO_API static FdoPropertyValueConstraintList* Create( ); 00069 00070 /// \brief 00071 /// Returns the list of allowed values for a particular property. 00072 /// 00073 /// \return 00074 /// Returns na instance of FdoDataValueCollection. 00075 /// 00076 FDO_API FdoDataValueCollection* GetConstraintList(); 00077 00078 /// \brief 00079 /// Returns FdoPropertyValueConstraintType_Range type. 00080 /// 00081 /// \return 00082 /// Returns the constraint type 00083 /// 00084 FDO_API virtual FdoPropertyValueConstraintType GetConstraintType(); 00085 00086 /// \cond DOXYGEN-IGNORE 00087 // Public non-API functions for XML and Schema Merge support 00088 00089 /// Update this list constraint from the given value constraint. 00090 virtual void Set( FdoPropertyValueConstraint* pProperty, FdoString* parentName, FdoSchemaMergeContext* pContext ); 00091 00092 // \brief 00093 // Compares this list constraint with another one. 00094 // 00095 // \param value 00096 // The Property Value constraint to compare with 00097 // 00098 // \return 00099 // Returns true if this list constraint is the same as pConstraint 00100 // (same constraint type and all members have the same values). 00101 virtual bool Equals( FdoPropertyValueConstraint* pConstraint ); 00102 00103 private: 00104 // Builds dictionary from given data values, filtering out duplicates. 00105 FdoDictionaryP ValuesToDictionary( FdoDataValueCollection* values ); 00106 00107 FdoDataValueCollection* m_constraintList; 00108 /// \endcond 00109 }; 00110 #endif 00111 00112
Comments or suggestions? Send us feedback. |