FDO API Reference Feature Data Objects

ElementMapping.h

Go to the documentation of this file.
00001 #ifndef FDO_XMLELEMENTMAPPING_H
00002 #define FDO_XMLELEMENTMAPPING_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/Commands/Schema/PhysicalElementMapping.h>
00027 #include <Fdo/Commands/Schema/PhysicalElementMappingCollection.h>
00028 
00029 class FdoXmlClassMapping;
00030 
00031 /// \brief
00032 /// FdoXmlElementMapping describes GML to FDO mappings for a particular GML Schema
00033 /// element. Only mappings that cannot be represented in FDO are described.
00034 class FdoXmlElementMapping : public FdoPhysicalElementMapping
00035 {
00036 public:
00037     /// \brief
00038     /// Constructs an object describing the GML-FDO mappings for a GML element
00039     /// 
00040     /// \param name 
00041     /// Input element name
00042     /// 
00043     /// \return
00044     /// Returns FdoXmlElementMapping
00045     /// 
00046     FDO_API static FdoXmlElementMapping* Create(
00047         FdoString* name
00048     );
00049 
00050     /// \brief
00051     /// Sets the class mapping for this element. The class mapping provides
00052     /// information about the FDO Class for this element's type.
00053     /// 
00054     /// \param classMapping 
00055     /// Input the class mapping
00056     /// 
00057     FDO_API void SetClassMapping(FdoXmlClassMapping* classMapping);
00058 
00059     /// \brief
00060     /// Gets the class mapping for this element. The class mapping provides
00061     /// information about the FDO Class for this element's type.
00062     /// 
00063     /// \return
00064     /// Returns FdoXmlClassMapping.
00065     /// 
00066     FDO_API FdoXmlClassMapping* GetClassMapping();
00067 
00068     /// \brief
00069     /// Sets the element class name to a dangling reference. This function can be
00070     /// used to reference a class that has no FdoXmlClassMapping object.
00071     /// 
00072     /// \param className 
00073     /// Input name of the FDO class corresponding to the 
00074     /// element's type.
00075     /// 
00076     FDO_API void SetClassName(
00077         FdoString* className
00078     );
00079 
00080     /// \brief
00081     /// Gets the FDO Class name.
00082     /// 
00083     /// \return
00084     /// Returns FdoString.
00085     /// 
00086     FDO_API FdoString* GetClassName();
00087 
00088     /// \brief
00089     /// Sets the schema name for a dangling reference to an element's class. 
00090     /// 
00091     /// \param schemaName 
00092     /// Input name of the Feature Schema containing the FDO class. If
00093     /// L"" then it defaults to the schema containing this element.
00094     /// 
00095     FDO_API void SetSchemaName(
00096         FdoString* schemaName = L""
00097     );
00098 
00099     /// \brief
00100     /// Gets the Schema Name for the FDO Class.
00101     /// 
00102     /// \return
00103     /// Returns FdoString.
00104     /// 
00105     FDO_API FdoString* GetSchemaName();
00106 
00107     /// \brief
00108     /// Sets the namespace URI for this element. 
00109     /// 
00110     /// \param schemaName 
00111     /// Input a URI. Defaults to the targetNamespace
00112     /// for the schema containing this element.
00113     /// 
00114     FDO_API void SetGmlUri(
00115         FdoString* gmlUri = L""
00116     );
00117 
00118     /// \brief
00119     /// Gets the URI for the referenced element. 
00120     /// 
00121     /// \return
00122     /// Returns FdoString.
00123     /// 
00124     FDO_API FdoString* GetGmlUri();
00125 
00126     /// \brief
00127     /// Sets the local name for this element. 
00128     /// 
00129     /// \param schemaName 
00130     /// Input the local name (unprefixed name) of this
00131     /// element. Defaults to the element name.
00132     /// 
00133     FDO_API void SetGmlLocalName(
00134         FdoString* gmlLocalName = L""
00135     );
00136 
00137     /// \brief
00138     /// Gets the URI for the referenced element. 
00139     /// 
00140     /// \return
00141     /// Returns FdoString. L"" if this element does not reference
00142     /// another element.
00143     /// 
00144     FDO_API FdoString* GetGmlLocalName();
00145 
00146     /// Functions for XML support
00147 
00148 /// \cond DOXYGEN-IGNORE
00149     /// \brief
00150     /// Initializes this Xml Element Mapping from its XML attributes. Called when
00151     /// the element is deserialized from XML. 
00152     /// 
00153     /// \param pContext 
00154     /// Input context contain information about the current deserialization operation
00155     /// \param attrs 
00156     /// Input the XML attributes.
00157     /// 
00158     /// \return
00159     /// Returns nothing
00160     /// 
00161     virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
00162 
00163     /// \brief
00164     /// Writes this XML Element Mapping to XML. Called when
00165     /// the element is serialized to XML. 
00166     /// 
00167     /// \param xmlWriter 
00168     /// Input write the element to this XML writer
00169     /// \param flags 
00170     /// Input flags that control the writing of the element.
00171     /// 
00172     /// \return
00173     /// Returns nothing
00174     /// 
00175     virtual void _writeXml(
00176         FdoXmlWriter* xmlWriter, 
00177         const FdoXmlFlags* flags
00178     );
00179 /// \endcond
00180 
00181 
00182 protected:
00183 /// \cond DOXYGEN-IGNORE
00184     FdoXmlElementMapping() {}
00185 
00186     FdoXmlElementMapping(
00187         FdoString* name
00188     );
00189 
00190     virtual ~FdoXmlElementMapping();
00191 
00192     virtual void Dispose();
00193 /// \endcond
00194 
00195 private:
00196     FdoStringP                  mClassName;
00197     FdoStringP                  mSchemaName;
00198     FdoStringP                  mGmlUri;
00199     FdoStringP                  mGmlLocalName;
00200     FdoPtr<FdoXmlClassMapping>  mClassMapping;
00201 };
00202 
00203 /// \brief
00204 /// FdoXmlElementMappingP is a FdoPtr on FdoXmlElementMapping, provided for convenience.
00205 typedef FdoPtr<FdoXmlElementMapping> FdoXmlElementMappingP;
00206 
00207 #endif
00208 
00209 

Comments or suggestions? Send us feedback.