FDO API Reference Feature Data Objects

FeaturePropertyReader.h

Go to the documentation of this file.
00001 #ifndef FDO_XML_FEATUREPROPERTYREADER_H_
00002 #define FDO_XML_FEATUREPROPERTYREADER_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 
00028 class FdoXmlFeatureContext;
00029 class FdoXmlFeatureFlags;
00030 class FdoXmlFeatureHandler;
00031 class FdoXmlGeometryHandler;
00032 
00033 /// \brief
00034 /// FdoXmlFeaturePropertyReader reads features from an XML document. The reading
00035 /// is event driven. As features and properties within features are encountered, the 
00036 /// invoker is notified through the FdoXmlFeatureHandler interface. This class is 
00037 /// similar to FdoXmlFeatureReader except that it provides better performance.
00038 class FdoXmlFeaturePropertyReader :
00039     public FdoXmlSaxHandler,
00040     public FdoIDisposable
00041 {
00042 public:
00043 
00044 
00045     /// \brief
00046     /// creates a Feature Property Reader.
00047     /// 
00048     /// \remarks
00049     /// The XML element, at the document reader's current position, is recognized as a feature 
00050     /// collection if it is one or more of the following: 
00051     /// <ul>
00052     ///     <li> GML FeatureCollection element
00053     ///     <li> the element specified by flags->collectionUri and flags->collectionName
00054     ///     <li> it has a corresponding class definition, in the given schemas, that 
00055     ///       derives from the GML AbstractFeatureCollectionType.
00056     /// </ul>
00057     /// 
00058     /// \param reader 
00059     /// Input XML document reader.
00060     /// If this reader is currently positioned at a feature 
00061     /// collection type element then all features in this element are read. Otherwise, 
00062     /// it processes all Feature Collection type sub-elements of the current element 
00063     /// and reads their features. Therefore, if the reader is at the start of the XML 
00064     /// document, all top-level feature collections in the document are read.
00065     /// \param flags 
00066     /// Input options for controlling the deserializing of the features. If NULL then 
00067     /// the default flags are used.
00068     /// 
00069     /// \return
00070     /// Returns FdoXmlFeaturePropertyReader
00071     /// 
00072     FDO_API static FdoXmlFeaturePropertyReader * Create( 
00073         FdoXmlReader*               reader,
00074         FdoXmlFeatureFlags*         flags = NULL
00075     );
00076 
00077     /// \brief
00078     /// Gets the Xml document reader that was passed to this object.
00079     /// 
00080     /// \return
00081     /// Returns FdoXmlReader.
00082     /// 
00083     FDO_API virtual FdoXmlReader* GetXmlReader() = 0;
00084 
00085     /// \brief
00086     /// Gets the feature schemas describing the features being read.
00087     /// 
00088     /// \return
00089     /// Returns FdoFeatureSchemaCollection
00090     /// 
00091     FDO_API virtual FdoFeatureSchemaCollection* GetFeatureSchemas() = 0;
00092 
00093     /// \brief
00094     /// Sets the feature schemas describing the features being read.
00095     /// 
00096     /// \remarks
00097     /// The feature schemas provide directions to this class on how to deserialize the 
00098     /// features and convert their property values from the strings in the XML document
00099     /// to their proper types. If any feature, whose class definition is not present 
00100     /// in these schemas, is encountered then one of the following is done:
00101     /// <ul>
00102     ///     <li> an exception is thrown when flags->errorLevel is Normal or higher. The 
00103     ///       exception reports all such features.
00104     ///     <li> the feature is read according to a best default translation when the 
00105     ///       flags->errorLevel is below Normal.
00106     /// </ul>
00107     /// 
00108     /// \param schemas 
00109     /// Input the feature schemas
00110     /// 
00111     /// \return
00112     /// Returns nothing
00113     /// 
00114     FDO_API virtual void SetFeatureSchemas(FdoFeatureSchemaCollection* schemas) = 0;
00115 
00116     /// \brief
00117     /// Parses the XML document.
00118     /// 
00119     /// \param featureHandler 
00120     /// Input handler to receive events. Parse() fires various events as features and
00121     /// properties are encountered.
00122     /// \param featureContext 
00123     /// Input Caller-specific contextual information that is pass to the feature 
00124     /// handler event callbacks.
00125     /// \param incremental 
00126     /// Input 
00127     /// true: an incremental (progressive) parse is performed. This function returns after the 
00128     /// next feature is read. 
00129     /// false: this function keeps going until all features have been read.
00130     /// 
00131     /// \return
00132     /// Returns false if no feature(s) were read.
00133     /// 
00134     FDO_API virtual FdoBoolean Parse(
00135         FdoXmlFeatureHandler* featureHandler = NULL, 
00136         FdoXmlFeatureContext* featureContext = NULL, 
00137         FdoBoolean incremental = false
00138     ) = 0;
00139 
00140     /// \brief
00141     /// Indicates whether all features have been read
00142     /// 
00143     /// \return
00144     /// Returns true if there are no more features to read , false otherwise
00145     /// 
00146     FDO_API virtual FdoBoolean GetEOF() = 0;
00147 
00148 };
00149 
00150 /// \brief
00151 /// FdoXmlFeaturePropertyReaderP is a FdoPtr on FdoXmlFeaturePropertyReader, provided for convenience.
00152 typedef FdoPtr<FdoXmlFeaturePropertyReader> FdoXmlFeaturePropertyReaderP;
00153 
00154 
00155 #endif
00156 
00157 

Comments or suggestions? Send us feedback.