- Main Page
- Related Pages
- Modules
- Classes
- Files

# 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 gmlUri
    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 gmlLocalName
    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 //
    00150     /// \brief
    00151     /// Initializes this Xml Element Mapping from its XML attributes. Called when
    00152     /// the element is deserialized from XML.
    00153     ///
    00154     /// \param pContext
    00155     /// Input context contain information about the current deserialization operation
    00156     /// \param attrs
    00157     /// Input the XML attributes.
    00158     ///
    00159     /// \return
    00160     /// Returns nothing
    00161     ///
    00162     virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
    00163
    00164     /// \brief
    00165     /// Writes this XML Element Mapping to XML. Called when
    00166     /// the element is serialized to XML.
    00167     ///
    00168     /// \param xmlWriter
    00169     /// Input write the element to this XML writer
    00170     /// \param flags
    00171     /// Input flags that control the writing of the element.
    00172     ///
    00173     /// \return
    00174     /// Returns nothing
    00175     ///
    00176     virtual void _writeXml(
    00177         FdoXmlWriter* xmlWriter,
    00178         const FdoXmlFlags* flags
    00179     );
    00180 /// \endcond
    00181
    00182     virtual void SetAliasNames(FdoStringCollection* pAliasNames){m_AliasNames = FDO_SAFE_ADDREF(pAliasNames);}
    00183     virtual FdoStringCollection* GetAliasNames(){return FDO_SAFE_ADDREF(m_AliasNames.p);}
    00184
    00185     virtual void SetChoiceName(FdoString* pChoiceName){m_choiceName = pChoiceName;}
    00186     virtual FdoString* GetChoiceName(){return m_choiceName;}
    00187
    00188 /// \cond DOXYGEN-IGNORE
    00189 protected:
    00190     FdoXmlElementMapping() {}
    00191
    00192     FdoXmlElementMapping(
    00193         FdoString* name
    00194     );
    00195
    00196     virtual ~FdoXmlElementMapping();
    00197
    00198     virtual void Dispose();
    00199 /// \endcond
    00200
    00201 private:
    00202     FdoStringP                  mClassName;
    00203     FdoStringP                  mSchemaName;
    00204     FdoStringP                  mGmlUri;
    00205     FdoStringP                  mGmlLocalName;
    00206     FdoPtr<FdoXmlClassMapping>  mClassMapping;
    00207     FdoPtr<FdoStringCollection> m_AliasNames;
    00208     FdoStringP                  m_choiceName;
    00209 };
    00210
    00211 /// \ingroup (typedefs)
    00212 /// \brief
    00213 /// FdoXmlElementMappingP is a FdoPtr on FdoXmlElementMapping, provided for convenience.
    00214 typedef FdoPtr<FdoXmlElementMapping> FdoXmlElementMappingP;
    00215
    00216 #endif
    00217
    00218

Please send us your comment about this page