FDO API Reference | Feature Data Objects |
00001 #ifndef _DATAPROPERTYDEFINITION_H_ 00002 #define _DATAPROPERTYDEFINITION_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/PropertyDefinition.h> 00027 #include <Fdo/Schema/ObjectType.h> 00028 #include <Fdo/Schema/DataType.h> 00029 #include <Fdo/Schema/PropertyType.h> 00030 #include <Fdo/Schema/PropertyValueConstraint.h> 00031 00032 /// \brief 00033 /// The FdoDataPropertyDefinition class derives from FdoPropertyDefinition and represents simple 00034 /// values or collections of simple values. FdoDataPropertyDefinitions can take on 00035 /// any of the data types listed in the FdoDataType enumeration. 00036 class FdoDataPropertyDefinition : public FdoPropertyDefinition 00037 { 00038 template <class OBJ> friend class FdoSchemaCollection; 00039 friend class FdoObjectPropertyDefinition; 00040 00041 protected: 00042 /// \cond DOXYGEN-IGNORE 00043 /// Constructs a default instance of an FdoDataPropertyDefinition. 00044 FdoDataPropertyDefinition(); 00045 00046 /// Constructs an instance of an FdoDataPropertyDefinition using the specified arguments 00047 FdoDataPropertyDefinition(FdoString* name, FdoString* description, bool system = false); 00048 00049 /// Common initialization code called by all constructors: 00050 void Init(); 00051 00052 virtual ~FdoDataPropertyDefinition(); 00053 00054 virtual void Dispose(); 00055 /// \endcond 00056 00057 public: 00058 /// \brief 00059 /// Constructs a default instance of an FdoDataPropertyDefinition. 00060 /// 00061 /// \return 00062 /// Returns FdoDataPropertyDefinition 00063 /// 00064 FDO_API static FdoDataPropertyDefinition* Create(); 00065 00066 /// \brief 00067 /// Constructs an instance of an FdoDataPropertyDefinition using the specified arguments 00068 /// 00069 /// \param name 00070 /// Input name 00071 /// \param description 00072 /// Input description 00073 /// \param system 00074 /// Input true if this is a system generated property, otherwise falseds. 00075 /// 00076 /// \return 00077 /// Returns FdoDataPropertyDefinition 00078 /// 00079 FDO_API static FdoDataPropertyDefinition* Create(FdoString* name, FdoString* description, bool system = false); 00080 00081 /// \brief 00082 /// Gets the concrete property type. 00083 /// 00084 /// \return 00085 /// Returns the concrete property type 00086 /// 00087 FDO_API virtual FdoPropertyType GetPropertyType(); 00088 00089 /// \brief 00090 /// Gets the FdoDataType of this property. 00091 /// 00092 /// \return 00093 /// Returns FdoDataType of this property 00094 /// 00095 FDO_API FdoDataType GetDataType(); 00096 00097 /// \brief 00098 /// Sets the FdoDataType of this property. 00099 /// 00100 /// \param dataType 00101 /// Input the FdoDataType of this property 00102 /// 00103 /// \return 00104 /// Returns nothing 00105 /// 00106 FDO_API void SetDataType(FdoDataType dataType); 00107 00108 /// \brief 00109 /// Returns a Boolean value that indicates if this property is read-only. 00110 /// 00111 /// \return 00112 /// Returns a Boolean value 00113 /// 00114 FDO_API bool GetReadOnly(); 00115 00116 /// \brief 00117 /// Sets a Boolean value that indicates if this property is read-only. 00118 /// 00119 /// \param value 00120 /// Input a Boolean value that indicates if this property is read-only 00121 /// 00122 /// \return 00123 /// Returns nothing 00124 /// 00125 FDO_API void SetReadOnly(bool value); 00126 00127 /// \brief 00128 /// Gets the length of a String, BLOB, or CLOB data property. This value 00129 /// does not apply to any other FdoDataType. 00130 /// 00131 /// \return 00132 /// Returns the length of a String, BLOB, or CLOB data property 00133 /// 00134 FDO_API FdoInt32 GetLength(); 00135 00136 /// \brief 00137 /// Sets the length of a String, BLOB, or CLOB data property. This value is 00138 /// ignored for all other FdoDataType values. 00139 /// 00140 /// \param value 00141 /// Input the length of a String, BLOB, or CLOB data property 00142 /// 00143 /// \return 00144 /// Returns nothing 00145 /// 00146 FDO_API void SetLength(FdoInt32 value); 00147 00148 /// \brief 00149 /// Gets the precision (total number of digits) of a decimal data property. 00150 /// This value does not apply to any other FdoDataType. 00151 /// 00152 /// \return 00153 /// Returns the precision 00154 /// 00155 FDO_API FdoInt32 GetPrecision(); 00156 00157 /// \brief 00158 /// Sets the precision (total number of digits) of a decimal data property. 00159 /// This value is ignored for all other FdoDataType values. 00160 /// 00161 /// \param value 00162 /// Input the precision 00163 /// 00164 /// \return 00165 /// Returns nothing 00166 /// 00167 FDO_API void SetPrecision(FdoInt32 value); 00168 00169 /// \brief 00170 /// Gets the scale (number of digits to the right of the decimal point) of a 00171 /// decimal data property. This value does not apply to any other FdoDataType. 00172 /// 00173 /// \return 00174 /// Returns the scale 00175 /// 00176 FDO_API FdoInt32 GetScale(); 00177 00178 /// \brief 00179 /// Sets the scale (number of digits to the right of the decimal point) of a 00180 /// decimal data property. This value is ignored for all other FdoDataType values. 00181 /// 00182 /// \param value 00183 /// Input the scale 00184 /// 00185 /// \return 00186 /// Returns nothing 00187 /// 00188 FDO_API void SetScale(FdoInt32 value); 00189 00190 /// \brief 00191 /// Returns a Boolean value that indicates if this property's value can be 00192 /// null. 00193 /// 00194 /// \return 00195 /// Returns a Boolean value 00196 /// 00197 FDO_API bool GetNullable(); 00198 00199 /// \brief 00200 /// Sets a Boolean value that indicates if this property's value can be 00201 /// null. 00202 /// 00203 /// \param value 00204 /// Input a Boolean value that indicates if this property's value can be 00205 /// null 00206 /// 00207 /// \return 00208 /// Returns nothing 00209 /// 00210 FDO_API void SetNullable(bool value); 00211 00212 /// \brief 00213 /// Gets the default value for this property. The default value is used when 00214 /// an instance of the containing class is created without specifying a value 00215 /// for this property. 00216 /// 00217 /// \return 00218 /// Returns the default value 00219 /// 00220 FDO_API FdoString* GetDefaultValue(); 00221 00222 /// \brief 00223 /// Sets the default value for this property. The default value is used when 00224 /// an instance of the containing class is created without specifying a value 00225 /// for this property. 00226 /// 00227 /// \param value 00228 /// Input the default value 00229 /// 00230 /// \return 00231 /// Returns nothing 00232 /// 00233 FDO_API void SetDefaultValue(FdoString* value); 00234 00235 /// \brief 00236 /// Sets a Boolean value that indicates if this is an autogenerated property. 00237 /// 00238 /// \param value 00239 /// Input a Boolean value that indicates if this property should 00240 /// be automatically generated by the provider. If true, then the provider will auto-generate 00241 /// unique id values for objects of the class containing this property. 00242 /// The provider will set the attribute properties to read-only. 00243 /// If the provider does not support auto-generation or if the data types of the 00244 /// property is not supported for unique id generation by the provider, then the provider will 00245 /// throw an AutoGenerationException. If false, then the provider will not autogenerate values. 00246 /// 00247 /// \return 00248 /// Returns nothing 00249 /// 00250 FDO_API void SetIsAutoGenerated(bool value); 00251 00252 /// \brief 00253 /// Returns a Boolean value that indicates if this is an autogenerated property. 00254 /// 00255 /// \return 00256 /// Returns a Boolean value. 00257 /// 00258 FDO_API bool GetIsAutoGenerated(); 00259 00260 /// \brief 00261 /// Returns the value constraint of this data property. 00262 /// 00263 /// \return 00264 /// Returns the FdoPropertyValueConstraint or NULL if not set. 00265 /// 00266 FDO_API FdoPropertyValueConstraint* GetValueConstraint(); 00267 00268 /// \brief 00269 /// Sets the value constraint of this data property. 00270 /// 00271 /// \param value 00272 /// Set the value constraint of this data property. 00273 /// 00274 /// \return 00275 /// Returns nothing 00276 /// 00277 FDO_API void SetValueConstraint( FdoPropertyValueConstraint* value ); 00278 00279 /// \cond DOXYGEN-IGNORE 00280 /// Public non-API functions for XML support 00281 00282 /// Update this property from the given property. 00283 virtual void Set( FdoPropertyDefinition* pProperty, FdoSchemaXmlContext* pContext ); 00284 00285 /// Initialize this property from its XML attributes 00286 virtual void InitFromXml(const FdoString* propertyTypeName, FdoSchemaXmlContext* pContext, FdoXmlAttributeCollection* attrs); 00287 00288 /// read the geometric types from XML sub-elements. 00289 /// Element start 00290 virtual FdoXmlSaxHandler* XmlStartElement( 00291 FdoXmlSaxContext* context, 00292 FdoString* uri, 00293 FdoString* name, 00294 FdoString* qname, 00295 FdoXmlAttributeCollection* atts 00296 ); 00297 /// Element end 00298 virtual FdoBoolean XmlEndElement( 00299 FdoXmlSaxContext* context, 00300 FdoString* uri, 00301 FdoString* name, 00302 FdoString* qname 00303 ); 00304 00305 /// Serialize this property to XML. 00306 virtual void _writeXml( FdoSchemaXmlContext* pContext ); 00307 00308 private: 00309 FdoDataType m_dataType; 00310 bool m_readOnly; 00311 FdoInt32 m_length; 00312 FdoInt32 m_precision; 00313 FdoInt32 m_scale; 00314 bool m_nullable; 00315 wchar_t* m_defaultValue; 00316 bool m_autogenerated; 00317 FdoPropertyValueConstraint *m_propertyValueConstraint; 00318 00319 protected: 00320 /// FdoFeatureSchema::RejectChanges() support 00321 virtual void _StartChanges(); 00322 virtual void _RejectChanges(); 00323 virtual void _AcceptChanges(); 00324 FdoDataType m_dataTypeCHANGED; 00325 bool m_readOnlyCHANGED; 00326 FdoInt32 m_lengthCHANGED; 00327 FdoInt32 m_precisionCHANGED; 00328 FdoInt32 m_scaleCHANGED; 00329 bool m_nullableCHANGED; 00330 wchar_t* m_defaultValueCHANGED; 00331 bool m_autogeneratedCHANGED; 00332 FdoPropertyValueConstraint *m_propertyValueConstraintCHANGED; 00333 /// \endcond 00334 }; 00335 00336 /// \brief 00337 /// FdoDataPropertyP is a FdoPtr on FdoDataPropertyDefinition, provided for convenience. 00338 typedef FdoPtr<FdoDataPropertyDefinition> FdoDataPropertyP; 00339 00340 #endif 00341 00342
Comments or suggestions? Send us feedback. |