FDO API Reference Feature Data Objects

FeatureHandler.h

Go to the documentation of this file.
00001 #ifndef FDO_XML_FEATUREHANDLER_H
00002 #define FDO_XML_FEATUREHANDLER_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 #ifdef _WIN32
00021 #pragma once
00022 #endif
00023 
00024 #include <FdoStd.h>
00025 
00026 class FdoXmlFeatureContext;
00027 class FdoClassDefinition;
00028 class FdoIRaster;
00029 
00030 
00031 /// \brief
00032 /// FdoXmlFeatureHandler defines the callback interface for reading features from XML.
00033 /// It is not an interface in the strict sense, since each function has a default 
00034 /// implementation that does nothing. Implementors can override these callbacks to 
00035 /// customize the handling of feature fragments parsed by FdoXmlFeaturePropertyReader.
00036 /// Note that the default FeatureProperty implementations log errors in certain circumstances.
00037 /// Therefore, these functions must be overridden to avoid these errors and indicate that 
00038 /// these types of properties are being handled by the caller.
00039 class FdoXmlFeatureHandler
00040 {
00041 public:
00042 
00043     /// \brief
00044     /// Default feature handler callback that is called when the 
00045     /// FdoXmlFeaturePropertyReader starts reading an XML document. Does nothing.
00046     /// 
00047     /// \param featureContext 
00048     /// Input caller specified contextual information
00049     /// 
00050     /// \return
00051     /// Returns the feature Handler for all sub-elements of the element that was current
00052     /// when the read started. If NULL, this feature handler remains in effect.
00053     /// 
00054     FDO_API virtual FdoXmlFeatureHandler* FeatureDocumentStart(FdoXmlFeatureContext* featureContext);
00055 
00056     /// \brief
00057     /// Default feature handler callback that is called when the 
00058     /// FdoXmlFeaturePropertyReader 
00059     /// finishes reading an XML document. Does nothing
00060     /// 
00061     /// \param featureContext 
00062     /// Input caller specified contextual information
00063     /// 
00064     FDO_API virtual void FeatureDocumentEnd(FdoXmlFeatureContext* featureContext);
00065 
00066     /// \brief
00067     /// Default feature handler callback that is called when the 
00068     /// FdoXmlFeaturePropertyReader encounters the start of a feature collection. 
00069     /// Does nothing.
00070     /// 
00071     /// \param featureContext 
00072     /// Input caller specified contextual information
00073     /// 
00074     /// \param classDefinition 
00075     /// Input class definition.
00076     /// 
00077     /// \return
00078     /// Returns the feature Handler for the features in this collection.
00079     /// If NULL, this feature handler remains in effect.
00080     /// 
00081     FDO_API virtual FdoXmlFeatureHandler* FeatureCollectionStart(FdoXmlFeatureContext* featureContext, FdoClassDefinition* classDefinition);
00082 
00083     /// \brief
00084     /// Default feature handler callback that is called when the 
00085     /// FdoXmlFeaturePropertyReader encounters the end of a feature collection. 
00086     /// Does nothing
00087     /// 
00088     /// \param featureContext 
00089     /// Input caller specified contextual information
00090     /// 
00091     /// \return
00092     /// Returning true causes the current parse to stop. Returning false causes the parse
00093     /// to continue. Return value is ignored if the current parse is not an incremental 
00094     /// parse ( see FdoXmlFeaturePropertyReader::Parse())
00095     /// 
00096     FDO_API virtual FdoBoolean FeatureCollectionEnd(FdoXmlFeatureContext* featureContext);
00097 
00098     /// \brief
00099     /// Default feature handler callback that is called when the 
00100     /// FdoXmlFeaturePropertyReader encounters the start of a feature. Does nothing.
00101     /// 
00102     /// \param featureContext 
00103     /// Input caller specified contextual information
00104     /// \param classDefinition 
00105     /// Input definition containing feature class name, schema name, valid property list,
00106     /// etc.
00107     /// 
00108     /// \return
00109     /// Returns the feature Handler for the feature's properties. If NULL, this feature 
00110     /// handler remains in effect.
00111     /// 
00112     FDO_API virtual FdoXmlFeatureHandler* FeatureStart(FdoXmlFeatureContext* featureContext, FdoClassDefinition* classDefinition);
00113 
00114     /// \brief
00115     /// Default feature handler callback that is called when the 
00116     /// FdoXmlFeaturePropertyReader encounters the end of a feature. Does nothing.
00117     /// 
00118     /// \param featureContext 
00119     /// Input caller specified contextual information
00120     /// 
00121     /// \return
00122     /// Returning true causes the current parse to stop. Returning false causes the 
00123     /// parse to continue. Return value is ignored if the current parse is not an 
00124     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00125     /// 
00126     FDO_API virtual FdoBoolean FeatureEnd(FdoXmlFeatureContext* featureContext);
00127 
00128     /// \brief
00129     /// Default feature handler callback that is called when the 
00130     /// FdoXmlFeaturePropertyReader encounters a property with boolean value. 
00131     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00132     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00133     /// 
00134     /// \param featureContext 
00135     /// Input caller specified contextual information
00136     /// \param name 
00137     /// Input property name
00138     /// \param  boolPropertyValue
00139     /// Input value of boolean property.
00140     /// 
00141     /// \return
00142     /// Returning true causes the current parse to stop. Returning false causes
00143     /// the parse to continue. Return value is ignored if the current parse is not an
00144     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00145     /// 
00146     FDO_API virtual FdoBoolean FeatureProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoBoolean boolPropertyValue);
00147 
00148     /// \brief
00149     /// Default feature handler callback that is called when the 
00150     /// FdoXmlFeaturePropertyReader encounters a property with single byte value. 
00151     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00152     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00153     /// 
00154     /// \param featureContext 
00155     /// Input caller specified contextual information
00156     /// \param name 
00157     /// Input property name
00158     /// \param bytePropertyValue 
00159     /// Input byte property value
00160     /// 
00161     /// \return
00162     /// Returning true causes the current parse to stop. Returning false causes
00163     /// the parse to continue. Return value is ignored if the current parse is not an
00164     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00165     /// 
00166     FDO_API virtual FdoBoolean FeatureProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoByte bytePropertyValue);
00167 
00168     /// \brief
00169     /// Default feature handler callback that is called when the 
00170     /// FdoXmlFeaturePropertyReader encounters a property with DataTime value. 
00171     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00172     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00173     /// 
00174     /// \param featureContext 
00175     /// Input caller specified contextual information
00176     /// \param name 
00177     /// Input property name
00178     /// \param dateTimePropertyValue 
00179     /// Input FdoDateTime property value
00180     /// 
00181     /// \return
00182     /// Returning true causes the current parse to stop. Returning false causes
00183     /// the parse to continue. Return value is ignored if the current parse is not an
00184     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00185     /// 
00186     FDO_API virtual FdoBoolean FeatureProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoDateTime dateTimePropertyValue);
00187 
00188     /// \brief
00189     /// Default feature handler callback that is called when the 
00190     /// FdoXmlFeaturePropertyReader encounters a property with double value. 
00191     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00192     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00193     /// 
00194     /// \param featureContext 
00195     /// Input caller specified contextual information
00196     /// \param name 
00197     /// Input property name
00198     /// \param doublePropertyValue 
00199     /// Input double property value
00200     /// 
00201     /// \return
00202     /// Returning true causes the current parse to stop. Returning false causes
00203     /// the parse to continue. Return value is ignored if the current parse is not an
00204     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00205     /// 
00206     FDO_API virtual FdoBoolean FeatureProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoDouble doublePropertyValue);
00207 
00208     /// \brief
00209     /// Default feature handler callback that is called when the 
00210     /// FdoXmlFeaturePropertyReader encounters a property with int16 value. 
00211     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00212     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00213     /// 
00214     /// \param featureContext 
00215     /// Input caller specified contextual information
00216     /// \param name 
00217     /// Input property name
00218     /// \param int16PropertyValue 
00219     /// Input Int16 property value
00220     /// 
00221     /// \return
00222     /// Returning true causes the current parse to stop. Returning false causes
00223     /// the parse to continue. Return value is ignored if the current parse is not an
00224     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00225     /// 
00226     FDO_API virtual FdoBoolean FeatureProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoInt16 int16PropertyValue);
00227 
00228     /// \brief
00229     /// Default feature handler callback that is called when the 
00230     /// FdoXmlFeaturePropertyReader encounters a property with int32 value. 
00231     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00232     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00233     /// 
00234     /// \param featureContext 
00235     /// Input caller specified contextual information
00236     /// \param name 
00237     /// Input property name
00238     /// \param int32PropertyValue 
00239     /// Input Int32 property value
00240     /// 
00241     /// \return
00242     /// Returning true causes the current parse to stop. Returning false causes
00243     /// the parse to continue. Return value is ignored if the current parse is not an
00244     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00245     /// 
00246     FDO_API virtual FdoBoolean FeatureProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoInt32 int32PropertyValue);
00247 
00248     /// \brief
00249     /// Default feature handler callback that is called when the 
00250     /// FdoXmlFeaturePropertyReader encounters a property with int64 value. 
00251     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00252     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00253     /// 
00254     /// \param featureContext 
00255     /// Input caller specified contextual information
00256     /// \param name 
00257     /// Input property name
00258     /// \param int64PropertyValue 
00259     /// Input Int64 property value
00260     /// 
00261     /// \return
00262     /// Returning true causes the current parse to stop. Returning false causes
00263     /// the parse to continue. Return value is ignored if the current parse is not an
00264     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00265     /// 
00266     FDO_API virtual FdoBoolean FeatureProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoInt64 int64PropertyValue);
00267 
00268     /// \brief
00269     /// Default feature handler callback that is called when the 
00270     /// FdoXmlFeaturePropertyReader encounters a property with single precision value. 
00271     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00272     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00273     /// 
00274     /// \param featureContext 
00275     /// Input caller specified contextual information
00276     /// \param name 
00277     /// Input property name
00278     /// \param floatPropertyValue 
00279     /// Input float property value
00280     /// 
00281     /// \return
00282     /// Returning true causes the current parse to stop. Returning false causes
00283     /// the parse to continue. Return value is ignored if the current parse is not an
00284     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00285     /// 
00286     FDO_API virtual FdoBoolean FeatureProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoFloat floatPropertyValue);
00287 
00288     /// \brief
00289     /// Default feature handler callback that is called when the 
00290     /// FdoXmlFeaturePropertyReader encounters a property with string value. 
00291     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00292     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00293     /// 
00294     /// \param featureContext 
00295     /// Input caller specified contextual information
00296     /// \param name 
00297     /// Input property name
00298     /// \param stringPropertyValue 
00299     /// Input string property value
00300     /// 
00301     /// \return
00302     /// Returning true causes the current parse to stop. Returning false causes
00303     /// the parse to continue. Return value is ignored if the current parse is not an
00304     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00305     /// 
00306     FDO_API virtual FdoBoolean FeatureProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoString* stringPropertyValue);
00307 
00308     /// \brief
00309     /// Default feature handler callback that is called when the 
00310     /// FdoXmlFeaturePropertyReader encounters the start of a raster property.
00311     /// Logs an error when the current ErrorLevel is High or Normal. An error is 
00312     /// also logged when the ErrorLevel is Low and the current property is not nullable.
00313     /// The raster image is sent by subsequent calls to FeatureBinaryData().
00314     /// 
00315     /// \param featureContext 
00316     /// Input caller specified contextual information
00317     /// \param name 
00318     /// Input property name
00319     /// \param rasterPropertyValue 
00320     /// Input raster image properties. This object always has a NULL stream reader. The image is
00321     /// handled by the FeatureBinaryData() callback.
00322     /// 
00323     /// \return
00324     /// Returning true causes the current parse to stop. Returning false causes the 
00325     /// parse to continue. Return value is ignored if the current parse is not an 
00326     /// incremental parse ( see FdoXmlFeaturePropertyReader::Parse())
00327     /// 
00328     FDO_API virtual FdoBoolean FeatureStartRasterProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoIRaster* rasterPropertyValue);
00329 
00330     /// \brief
00331     /// Default feature handler callback that is called when the 
00332     /// FdoXmlFeaturePropertyReader encounters the end of a raster property.
00333     /// Does nothing
00334     /// 
00335     /// \param featureContext 
00336     /// Input caller specified contextual information
00337     /// 
00338     /// \return
00339     /// Returning true causes the current parse to stop. Returning false causes the parse
00340     /// to continue. Return value is ignored if the current parse is not an incremental 
00341     /// parse ( see FdoXmlFeaturePropertyReader::Parse())
00342     /// 
00343     FDO_API virtual FdoBoolean FeatureEndRasterProperty(FdoXmlFeatureContext* featureContext);
00344 
00345     /// \brief
00346     /// Default feature handler callback that is called when the 
00347     /// FdoXmlFeaturePropertyReader encounters  the start of a lob property. 
00348     /// Logs an error when the current ErrorLevel is High or Normal. 
00349     /// If this is a BLOB property then its value is sent through the FeatureBinaryData() callback.
00350     /// If this is a CLOB property then its value is sent through the FeatureCharacters() callback.
00351     /// 
00352     /// \param featureContext 
00353     /// Input caller specified contextual information
00354     /// \param name 
00355     /// Input property name
00356     /// 
00357     /// \return
00358     /// Returning true causes the current parse to stop. Returning false cause the parse
00359     /// to continue. Return value is ignored if the current parse is not an incremental 
00360     /// parse ( see FdoXmlFeaturePropertyReader::Parse())
00361     /// 
00362     FDO_API virtual FdoBoolean FeatureStartLobProperty(FdoXmlFeatureContext* featureContext, FdoString* name);
00363 
00364     /// \brief
00365     /// Default feature handler callback that is called when the 
00366     /// FdoXmlFeaturePropertyReader encounters the end of a lob property.
00367     /// Does nothing
00368     /// 
00369     /// \param featureContext 
00370     /// Input caller specified contextual information
00371     /// 
00372     /// \return
00373     /// Returning true causes the current parse to stop. Returning false causes the parse
00374     /// to continue. Return value is ignored if the current parse is not an incremental 
00375     /// parse ( see FdoXmlFeaturePropertyReader::Parse())
00376     /// 
00377     FDO_API virtual FdoBoolean FeatureEndLobProperty(FdoXmlFeatureContext* featureContext);
00378 
00379     /// \brief
00380     /// Default feature handler callback that is called when the 
00381     /// FdoXmlFeaturePropertyReader encounters a geometric property.
00382     /// Logs an error when the current ErrorLevel is High or Normal. 
00383     /// 
00384     /// \param featureContext 
00385     /// Input caller specified contextual information
00386     /// \param name 
00387     /// Input property name
00388     /// \param geometryByteArray 
00389     /// Input pointer to the byte array defining the geometry value
00390     /// \param byteCount 
00391     /// Input number of bytes in the byte array
00392     /// 
00393     /// \return
00394     /// Returning true causes the current parse to stop. Returning false causes the parse
00395     /// continue. Return value is ignored if the current parse is not an incremental 
00396     /// parse ( see FdoXmlFeaturePropertyReader::Parse())
00397     /// 
00398     FDO_API virtual FdoBoolean FeatureGeometricProperty(FdoXmlFeatureContext* featureContext, FdoString*name, FdoByte* geometryByteArray, FdoInt32 byteCount);
00399 
00400     /// \brief
00401     /// Default feature handler callback that is called when the 
00402     /// FdoXmlFeaturePropertyReader encounters the start of an object property. 
00403     /// Does nothing.
00404     /// 
00405     /// \param featureContext 
00406     /// Input caller specified contextual information
00407     /// \param name 
00408     /// Input object property name
00409     /// \param classDefinition 
00410     /// Input definition for the object property's class.
00411     /// 
00412     /// \return
00413     /// Returns the feature Handler for the current object property's sub-properties. 
00414     /// If NULL, this feature handler remains in effect.
00415     /// 
00416     FDO_API virtual FdoXmlFeatureHandler* FeatureStartObjectProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoClassDefinition* classDefinition);
00417 
00418     /// \brief
00419     /// Default feature handler callback that is called when the 
00420     /// FdoXmlFeaturePropertyReader encounters the end of an object property.
00421     /// Does nothing
00422     /// 
00423     /// \param featureContext 
00424     /// Input caller specified contextual information
00425     /// 
00426     /// \return
00427     /// Returning true causes the current parse to stop. Returning false causes the parse
00428     /// to continue. Return value is ignored if the current parse is not an incremental 
00429     /// parse ( see FdoXmlFeaturePropertyReader::Parse())
00430     /// 
00431     FDO_API virtual FdoBoolean FeatureEndObjectProperty(FdoXmlFeatureContext* featureContext);
00432 
00433     /// \brief
00434     /// Default feature handler callback that is called when the 
00435     /// FdoXmlFeaturePropertyReader encounters the start of an association property. 
00436     /// Does nothing by default.
00437     /// A number of other events are fired between FeatureStartAssociationProperty
00438     /// and FeatureEndAssociationProperty, to identify the associated feature 
00439     /// referenced by the current association property:
00440     /// <ul>
00441     ///     <li> if the associated feature is specified by an xlink:href, then 
00442     ///       the href value is sent through a single FeatureProperty event.
00443     ///       The property is named "gml/id".
00444     ///     <li> if the associated feature is specified by its identity property
00445     ///       values, then a FeatureProperty event is fired for each identity
00446     ///       property value.
00447     ///     <li> if the associated feature is inline (specified by a sub-element of
00448     ///       current association property) then a set of FeatureStart, 
00449     ///       FeatureProperty, and FeatureEnd events are fired.
00450     /// </ul>
00451     /// 
00452     /// \param featureContext 
00453     /// Input caller specified contextual information
00454     /// \param name 
00455     /// Input association property name
00456     /// \param classDefinition 
00457     /// Input definition for the association property's 
00458     /// associated class.
00459     /// 
00460     /// \return
00461     /// Returns the feature Handler for the current association property's sub-properties. 
00462     /// If NULL, this feature handler remains in effect.
00463     /// 
00464     FDO_API virtual FdoXmlFeatureHandler* FeatureStartAssociationProperty(FdoXmlFeatureContext* featureContext, FdoString* name, FdoClassDefinition* classDefinition);
00465 
00466     /// \brief
00467     /// Default feature handler callback that is called when the 
00468     /// FdoXmlFeaturePropertyReader encounters the end of an association property.
00469     /// Does nothing
00470     /// 
00471     /// \param featureContext 
00472     /// Input caller specified contextual information
00473     /// 
00474     /// \return
00475     /// Returning true causes the current parse to stop. Returning false causes the parse
00476     /// to continue. Return value is ignored if the current parse is not an incremental 
00477     /// parse ( see FdoXmlFeaturePropertyReader::Parse())
00478     /// 
00479     FDO_API virtual FdoBoolean FeatureEndAssociationProperty(FdoXmlFeatureContext* featureContext);
00480 
00481     /// \brief
00482     /// Default Feature Handle callback that is called when the FdoXmlFeaturePropertyReader 
00483     /// reads a chunk of data for a CLOB property. Does nothing by default.
00484     /// This function may be called multiple times for the same property, if the 
00485     /// the property value is large. Applications must not make any assumptions about the
00486     /// chunk size or number of chunks for each property.
00487     /// 
00488     /// \param featureContext 
00489     /// Input caller specified contextual information
00490     /// \param chars 
00491     /// Input the next chunk of simple content
00492     /// 
00493     /// \return
00494     /// Returning true causes the current parse to stop. Returning false causes the parse
00495     /// to continue. Return value is ignored if the current parse is not an incremental 
00496     /// parse ( see FdoXmlFeaturePropertyReader::Parse())
00497     /// 
00498     FDO_API virtual FdoBoolean FeatureCharacters(FdoXmlFeatureContext* featureContext, FdoString* chars);
00499 
00500     /// \brief
00501     /// Default Feature callback that is called when the FdoXmlFeaturePropertyReader 
00502     /// reads a chunk of data for a Raster or BLOB property. 
00503     /// Does nothing by default.
00504     /// This function may be called multiple times for the same property, if the 
00505     /// the property value is large. Applications must not make any assumptions about the
00506     /// chunk size or number of chunks for each property.
00507     /// 
00508     /// \param featureContext 
00509     /// Input caller specified contextual information
00510     /// \param bytes 
00511     /// Input the next chunk of binary content in unencoded form. An exception is thrown
00512     /// if the content cannot be decoded.
00513     /// \param count 
00514     /// Input the number of bytes of binary content.
00515     /// 
00516     /// \return
00517     /// Returning true causes the current parse to stop. Returning false causes the parse
00518     /// to continue. Return value is ignored if the current parse is not an incremental 
00519     /// parse ( see FdoXmlFeaturePropertyReader::Parse())
00520     /// 
00521     FDO_API virtual FdoBoolean FeatureBinaryData(FdoXmlFeatureContext* featureContext, FdoByte* bytes, FdoSize count);
00522 
00523 };
00524 
00525 #endif
00526 
00527 

Comments or suggestions? Send us feedback.