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