FDO API Reference Feature Data Objects

ObjectPropertyDefinition.h

Go to the documentation of this file.
00001 #ifndef _OBJECTPROPERTYDEFINITION_H_
00002 #define _OBJECTPROPERTYDEFINITION_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/ClassDefinition.h>
00029 #include <Fdo/Schema/PropertyType.h>
00030 #include <Fdo/Schema/OrderType.h>
00031 #include <Fdo/Schema/DataPropertyDefinition.h>
00032 
00033 /// \brief
00034 /// The FdoObjectPropertyDefinition class derives from FdoPropertyDefinition and represents
00035 /// containment of an object or a collection of objects within another class.
00036 /// The class of the contained object must already be defined in the feature
00037 /// schema and cannot be abstract.
00038 class FdoObjectPropertyDefinition : public FdoPropertyDefinition
00039 {
00040 protected:
00041     /// Constructs a default instance of an FdoObjectPropertyDefinition. 
00042     FDO_API FdoObjectPropertyDefinition();
00043 
00044     /// Constructs an instance of an FdoObjectPropertyDefinition using the specified
00045     /// arguments.
00046     FDO_API FdoObjectPropertyDefinition(FdoString* name, FdoString* description, bool system = false);
00047 
00048 /// \cond DOXYGEN-IGNORE
00049     virtual ~FdoObjectPropertyDefinition();
00050 
00051     virtual void Dispose();
00052 /// \endcond
00053 
00054 public:
00055     /// \brief
00056     /// Constructs a default instance of an FdoObjectPropertyDefinition.
00057     /// 
00058     /// \return
00059     /// Returns FdoObjectPropertyDefinition
00060     /// 
00061     FDO_API static FdoObjectPropertyDefinition* Create();
00062 
00063     /// \brief
00064     /// Constructs an instance of an FdoObjectPropertyDefinition using the specified
00065     /// arguments.
00066     /// 
00067     /// \param name 
00068     /// Input name
00069     /// \param description 
00070     /// Input description
00071     /// \param system 
00072     /// Input true if this is a system generated property, otherwise false.
00073     /// \note
00074     /// A client would never set system to true, only a provider.
00075     /// 
00076     /// \return
00077     /// Returns FdoObjectPropertyDefinition
00078     /// 
00079     FDO_API static FdoObjectPropertyDefinition* 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 a reference to the FdoClassDefinition that defines the type of this
00091     /// property.
00092     /// 
00093     /// \return
00094     /// Returns class definition
00095     /// 
00096     FDO_API FdoClassDefinition* GetClass();
00097 
00098     /// \brief
00099     /// Sets a reference to the FdoClassDefinition that defines the type of this
00100     /// property.
00101     /// 
00102     /// \param value 
00103     /// Input class definition
00104     /// 
00105     /// \return
00106     /// Returns nothing
00107     /// 
00108     FDO_API void SetClass(FdoClassDefinition* value);
00109 
00110     /// \brief
00111     /// Gets a reference to an FdoDataPropertyDefinition to use for uniquely identifying
00112     /// instances of the contained class within a single parent object instance.
00113     /// This value is only used for the FdoObjectType_Collection and FdoObjectType_OrderedCollection object
00114     /// property types. The FdoDataPropertyDefinition must belong to the FdoClassDefinition that
00115     /// defines the type of this property.
00116     /// 
00117     /// \return
00118     /// Returns data property definition
00119     /// 
00120     FDO_API FdoDataPropertyDefinition* GetIdentityProperty();
00121 
00122     /// \brief
00123     /// Sets a reference to an FdoDataPropertyDefinition to use for uniquely identifying
00124     /// instances of the contained class within a single parent object instance.
00125     /// This value is only used for the FdoObjectType_Collection and FdoObjectType_OrderedCollection object
00126     /// property types. The FdoDataPropertyDefinition must belong to the FdoClassDefinition that
00127     /// defines the type of this property.
00128     /// 
00129     /// \param value 
00130     /// Input data property definition
00131     /// 
00132     /// \return
00133     /// Returns nothing
00134     /// 
00135     FDO_API void SetIdentityProperty(FdoDataPropertyDefinition* value);
00136 
00137     /// \brief
00138     /// Gets the type of this object property (value, collection, or ordered 
00139     /// collection).
00140     /// 
00141     /// \return
00142     /// Returns the type of this object property
00143     /// 
00144     FDO_API FdoObjectType GetObjectType();
00145 
00146     /// \brief
00147     /// Sets the type of this object property (value, collection, or ordered 
00148     /// collection).
00149     /// 
00150     /// \param value 
00151     /// Input the type of this object property
00152     /// 
00153     /// \return
00154     /// Returns nothing
00155     /// 
00156     FDO_API void SetObjectType(FdoObjectType value);
00157 
00158     /// \brief
00159     /// Gets the order type of this object property (ascending or descending). 
00160     /// This property is only applicable if the property type is set to 
00161     /// FdoObjectType_OrderedCollection.
00162     /// 
00163     /// \return
00164     /// Returns the order type
00165     /// 
00166     FDO_API FdoOrderType GetOrderType();
00167 
00168     /// \brief
00169     /// Sets the order type of this object property (ascending or descending). 
00170     /// This property is only applicable if the property type is set to 
00171     /// FdoObjectType_OrderedCollection.
00172     /// 
00173     /// \param value 
00174     /// Input the order type
00175     /// 
00176     /// \return
00177     /// Returns nothing
00178     /// 
00179     FDO_API void SetOrderType(FdoOrderType value);
00180 
00181 /// \cond DOXYGEN-IGNORE
00182     /// Public non-API functions for XML support
00183 
00184     /// Update this property from the given property.
00185     virtual void Set( FdoPropertyDefinition* pProperty, FdoSchemaXmlContext* pContext );
00186 
00187     /// Initialize this property from its XML attributes
00188     virtual void InitFromXml(const FdoString* propertyTypeName, FdoSchemaXmlContext* pContext, FdoXmlAttributeCollection* attrs);
00189 
00190     /// Serialize this property to XML.
00191     virtual void _writeXml( FdoSchemaXmlContext* pContext );
00192 
00193 private:
00194     FdoClassDefinition*         m_class;
00195     FdoObjectType               m_objectType;
00196     FdoOrderType                m_orderType;
00197     FdoDataPropertyDefinition*  m_identityProperty;
00198 
00199 protected:
00200     /// FdoFeatureSchema::RejectChanges() support
00201     virtual void    _StartChanges();
00202     virtual void    _BeginChangeProcessing();
00203     virtual void    _AcceptChanges();
00204     virtual void    _RejectChanges();
00205     virtual void    _EndChangeProcessing();
00206     FdoClassDefinition*         m_classCHANGED;
00207     FdoObjectType               m_objectTypeCHANGED;
00208     FdoOrderType                m_orderTypeCHANGED;
00209     FdoDataPropertyDefinition*  m_identityPropertyCHANGED;
00210 /// \endcond
00211 };
00212 
00213 /// \brief
00214 /// FdoObjectPropertyP is a FdoPtr on FdoObjectPropertyDefinition, provided for convenience.
00215 typedef FdoPtr<FdoObjectPropertyDefinition> FdoObjectPropertyP;
00216 
00217 
00218 #endif
00219 
00220 

Comments or suggestions? Send us feedback.