FDO API Reference Feature Data Objects

PhysicalElementMapping.h

Go to the documentation of this file.
00001 #ifndef FDO_PHYSICALELEMENTMAPPING_H
00002 #define FDO_PHYSICALELEMENTMAPPING_H
00003 // 
00004 
00005 //
00006 // Copyright (C) 2004-2006  Autodesk, Inc.
00007 // 
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of version 2.1 of the GNU Lesser
00010 // General Public License as published by the Free Software Foundation.
00011 // 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 // Lesser General Public License for more details.
00016 // 
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this library; if not, write to the Free Software
00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 //
00021 
00022 #ifdef _WIN32
00023 #pragma once
00024 #endif
00025 
00026 #include <FdoStd.h>
00027 #include <Fdo/Xml/Context.h>
00028 #include <Fdo/Commands/CommandException.h>
00029 
00030 class FdoPhysicalSchemaMapping;
00031 class FdoXmlFlags;
00032 
00033 /// \brief
00034 /// FdoPhysicalElementMapping is an abstract class that acts as a base class for all 
00035 /// Physical Schema Mapping Override classes. FDO also provides a number of sub-classes
00036 /// for particular types of Provider-specific override classes:
00037 /// \remarks
00038 /// <ul>
00039 /// <li>FdoPhysicalClassMapping: All classes corresponding to Feature Classes
00040 /// must be based on FdoPhysicalClassMapping.
00041 /// <li>FdoPhysicalPropertyMapping: Must be the base for all classes corresponding to 
00042 /// Properties.
00043 /// <li>FdoPhysicalSchemaMapping: Must be the base for all types of schema override sets.
00044 /// </ul>
00045 /// Other types of schema override classes can be based directly on FdoPhysicalElementMapping.
00046 class FdoPhysicalElementMapping : 
00047     public FdoIDisposable,
00048     public virtual FdoXmlSaxHandler
00049 {
00050     template <class OBJ> friend class FdoPhysicalElementMappingCollection;
00051 
00052 public:
00053     /// \brief
00054     /// Gets the parent of this FdoPhysicalElementMapping or null if this object has not
00055     /// been added to a parent object.
00056     /// 
00057     /// \return
00058     /// Returns FdoPhysicalElementMapping of parent
00059     /// 
00060     FDO_API virtual FdoPhysicalElementMapping* GetParent();
00061 
00062     /// \brief
00063     /// Gets the FdoPhysicalSchemaMapping that this element is a part of. Returns null if this
00064     /// object has not been added to a feature schema.
00065     /// 
00066     /// \return
00067     /// Returns FdoPhysicalSchemaMapping this object is a part of
00068     /// 
00069     FDO_API virtual FdoPhysicalSchemaMapping* GetSchemaMapping();
00070 
00071     /// \brief
00072     /// Gets the name of this element.
00073     /// 
00074     /// \return
00075     /// Returns the name of this element.
00076     /// 
00077     FDO_API virtual FdoString* GetName();
00078 
00079     /// \brief
00080     /// Gets the fully qualified name of this element
00081     /// 
00082     /// \return
00083     /// default implementation simply returns the element name
00084     /// 
00085     FDO_API virtual FdoStringP GetQualifiedName();
00086 
00087     /// \brief
00088     /// Sets the name of this element.
00089     /// 
00090     /// \param value 
00091     /// Input the name of this element.
00092     /// 
00093     /// \return
00094     /// Returns nothing
00095     /// 
00096     FDO_API virtual void SetName(FdoString* value);
00097 
00098 /// \cond DOXYGEN-IGNORE
00099     //Indicates that this object allows its name
00100     //to change. This function is defined so that this class can 
00101     //be a FdoNamedCollection element.
00102     FDO_API virtual FdoBoolean CanSetName()
00103     {
00104         return true;
00105     }
00106 /// \endcond
00107 
00108     /// Functions for XML support
00109 
00110     /// \brief
00111     /// Initializes this Physical Element Mapping from its XML attributes. Called when
00112     /// the element is deserialized from XML. Can be extended to handle 
00113     /// particular XML attributes for derived classes.
00114     /// 
00115     /// \param pContext 
00116     /// Input context contain information about the current deserialization operation
00117     /// \param attrs 
00118     /// Input the XML attributes.
00119     /// 
00120     /// \return
00121     /// Returns nothing
00122     /// 
00123     FDO_API virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
00124 
00125     /// \brief
00126     /// Writes this Physical Mapping Element to XML. Called when
00127     /// the element is serialized to XML. Can be extended to handle 
00128     /// particular XML attributes and sub-elements for derived classes.
00129     /// 
00130     /// \param xmlWriter 
00131     /// Input write the element to this XML writer
00132     /// \param flags 
00133     /// Input flags that control the writing of the element.
00134     /// 
00135     /// \return
00136     /// Returns nothing
00137     /// 
00138     FDO_API virtual void _writeXml(
00139         FdoXmlWriter* xmlWriter, 
00140         const FdoXmlFlags* flags
00141     );
00142 
00143 /// \cond DOXYGEN-IGNORE
00144     /// Various error reporting functions that are not yet part of the supported
00145     /// FDO API.
00146     /// All of them return a FdoXmlSkipElementHandler, which can be used to skip
00147     /// over the element in error.
00148 
00149     FDO_API FdoXmlSaxHandler* SubElementError(
00150         FdoXmlSaxContext* pContext, 
00151         FdoString* parentElement,
00152         FdoString* subElement
00153     );
00154 
00155     FDO_API FdoXmlSaxHandler* MultiSubElementError(
00156         FdoXmlSaxContext* pContext, 
00157         FdoString* parentElement,
00158         FdoString* subElement
00159     );
00160 
00161     FDO_API FdoXmlSaxHandler* ChoiceSubElementError(
00162         FdoXmlSaxContext* pContext, 
00163         FdoString* parentElement,
00164         FdoStringsP subElements
00165     );
00166 
00167     FDO_API FdoXmlSaxHandler* DuplicateSubElementError(
00168         FdoXmlSaxContext* pContext, 
00169         FdoString* parentElement,
00170         FdoString* subElement,
00171         FdoString* subElementName
00172     );
00173 /// \endcond
00174 
00175 
00176 protected:
00177     /// \brief
00178     /// Constructs a default instance of an FdoPhysicalElementMapping.
00179     /// 
00180     FDO_API FdoPhysicalElementMapping();
00181 
00182     /// \brief
00183     /// Constructs an instance of an FdoPhysicalElementMapping using the specified arguments.
00184     /// 
00185     /// \param name 
00186     /// Input the element name
00187     /// 
00188     FDO_API FdoPhysicalElementMapping(FdoString* name /*, FdoString* description = L"" */);
00189 
00190     /// \brief
00191     /// FdoPhysicalElementMapping destructor.
00192     /// 
00193     FDO_API virtual ~FdoPhysicalElementMapping();
00194 
00195     /// \brief
00196     /// Sets the parent of this Physical Element Mapping.
00197     /// 
00198     /// \param value 
00199     /// Input the parent
00200     /// 
00201     FDO_API void SetParent(FdoPhysicalElementMapping* value);
00202 
00203 /// \cond DOXYGEN-IGNORE
00204     /// retrieves a FdoXmlSkipElementHandler for skipping an entire XML element
00205     FDO_API FdoXmlSaxHandler* GetSkipper();
00206 
00207     /// Get the second token from the provider name for this 
00208     /// elements schema mapping set.
00209     FdoStringP GetProviderLocalName();
00210 
00211     /// SAX Handler for reading simple sub-element contents
00212     FdoXmlCharDataHandlerP        m_XmlContentHandler;
00213 
00214     /// SAX Handler for skipping elements
00215     FdoXmlSkipElementHandlerP     m_XmlSkipper;
00216 /// \endcond
00217 
00218 private:
00219     /// m_parent is a non-refcounted reference, to avoid circular references that prevent
00220     /// elements from being freed.
00221     FdoPhysicalElementMapping*              m_parent;
00222 
00223     /// The name of this element
00224     FdoStringP                              m_name;
00225 
00226     /// Optional description of this element.
00227     FdoStringP                              m_description;
00228 };
00229 
00230 /// \brief
00231 /// FdoPhysicalElementMappingP is a FdoPtr on FdoPhysicalElementMapping, provided for convenience.
00232 typedef FdoPtr<FdoPhysicalElementMapping> FdoPhysicalElementMappingP;
00233 
00234 #endif
00235 
00236 

Comments or suggestions? Send us feedback.