LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts - ogrsf_frmts.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 26 26 100.0 %
Date: 2024-05-04 12:52:34 Functions: 26 27 96.3 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  * $Id$
       3             :  *
       4             :  * Project:  OpenGIS Simple Features Reference Implementation
       5             :  * Purpose:  Classes related to format registration, and file opening.
       6             :  * Author:   Frank Warmerdam, warmerda@home.com
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 1999,  Les Technologies SoftMap Inc.
      10             :  * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
      11             :  *
      12             :  * Permission is hereby granted, free of charge, to any person obtaining a
      13             :  * copy of this software and associated documentation files (the "Software"),
      14             :  * to deal in the Software without restriction, including without limitation
      15             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      16             :  * and/or sell copies of the Software, and to permit persons to whom the
      17             :  * Software is furnished to do so, subject to the following conditions:
      18             :  *
      19             :  * The above copyright notice and this permission notice shall be included
      20             :  * in all copies or substantial portions of the Software.
      21             :  *
      22             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      23             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      24             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      25             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      26             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      27             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      28             :  * DEALINGS IN THE SOFTWARE.
      29             :  ****************************************************************************/
      30             : 
      31             : #ifndef OGRSF_FRMTS_H_INCLUDED
      32             : #define OGRSF_FRMTS_H_INCLUDED
      33             : 
      34             : #include "cpl_progress.h"
      35             : #include "ogr_feature.h"
      36             : #include "ogr_featurestyle.h"
      37             : #include "gdal_priv.h"
      38             : 
      39             : #include <memory>
      40             : #include <deque>
      41             : 
      42             : /**
      43             :  * \file ogrsf_frmts.h
      44             :  *
      45             :  * Classes related to registration of format support, and opening datasets.
      46             :  */
      47             : 
      48             : //! @cond Doxygen_Suppress
      49             : #if !defined(GDAL_COMPILATION) && !defined(SUPPRESS_DEPRECATION_WARNINGS)
      50             : #define OGR_DEPRECATED(x) CPL_WARN_DEPRECATED(x)
      51             : #else
      52             : #define OGR_DEPRECATED(x)
      53             : #endif
      54             : //! @endcond
      55             : 
      56             : class OGRLayerAttrIndex;
      57             : class OGRSFDriver;
      58             : 
      59             : struct ArrowArrayStream;
      60             : 
      61             : /************************************************************************/
      62             : /*                               OGRLayer                               */
      63             : /************************************************************************/
      64             : 
      65             : /**
      66             :  * This class represents a layer of simple features, with access methods.
      67             :  *
      68             :  */
      69             : 
      70             : /* Note: any virtual method added to this class must also be added in the */
      71             : /* OGRLayerDecorator and OGRMutexedLayer classes. */
      72             : 
      73             : class CPL_DLL OGRLayer : public GDALMajorObject
      74             : {
      75             :   private:
      76             :     struct Private;
      77             :     std::unique_ptr<Private> m_poPrivate;
      78             : 
      79             :     void ConvertGeomsIfNecessary(OGRFeature *poFeature);
      80             : 
      81             :     class CPL_DLL FeatureIterator
      82             :     {
      83             :         struct Private;
      84             :         std::unique_ptr<Private> m_poPrivate;
      85             : 
      86             :       public:
      87             :         FeatureIterator(OGRLayer *poLayer, bool bStart);
      88             :         FeatureIterator(
      89             :             FeatureIterator &&oOther) noexcept;  // declared but not defined.
      90             :                                                  // Needed for gcc 5.4 at least
      91             :         ~FeatureIterator();
      92             :         OGRFeatureUniquePtr &operator*();
      93             :         FeatureIterator &operator++();
      94             :         bool operator!=(const FeatureIterator &it) const;
      95             :     };
      96             : 
      97             :     friend inline FeatureIterator begin(OGRLayer *poLayer);
      98             :     friend inline FeatureIterator end(OGRLayer *poLayer);
      99             : 
     100             :     CPL_DISALLOW_COPY_ASSIGN(OGRLayer)
     101             : 
     102             :   protected:
     103             :     //! @cond Doxygen_Suppress
     104             :     int m_bFilterIsEnvelope;
     105             :     OGRGeometry *m_poFilterGeom;
     106             :     OGRPreparedGeometry *m_pPreparedFilterGeom; /* m_poFilterGeom compiled as a
     107             :                                                    prepared geometry */
     108             :     OGREnvelope m_sFilterEnvelope;
     109             :     int m_iGeomFieldFilter;  // specify the index on which the spatial
     110             :                              // filter is active.
     111             : 
     112             :     int FilterGeometry(const OGRGeometry *);
     113             :     // int          FilterGeometry( OGRGeometry *, OGREnvelope*
     114             :     // psGeometryEnvelope);
     115             :     int InstallFilter(OGRGeometry *);
     116             :     bool
     117             :     ValidateGeometryFieldIndexForSetSpatialFilter(int iGeomField,
     118             :                                                   const OGRGeometry *poGeomIn,
     119             :                                                   bool bIsSelectLayer = false);
     120             : 
     121             :     OGRErr GetExtentInternal(int iGeomField, OGREnvelope *psExtent, int bForce);
     122             :     //! @endcond
     123             : 
     124             :     virtual OGRErr ISetFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
     125             :     virtual OGRErr ICreateFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
     126             :     virtual OGRErr IUpsertFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
     127             :     virtual OGRErr
     128             :     IUpdateFeature(OGRFeature *poFeature, int nUpdatedFieldsCount,
     129             :                    const int *panUpdatedFieldsIdx, int nUpdatedGeomFieldsCount,
     130             :                    const int *panUpdatedGeomFieldsIdx,
     131             :                    bool bUpdateStyleString) CPL_WARN_UNUSED_RESULT;
     132             : 
     133             :     //! @cond Doxygen_Suppress
     134             :     CPLStringList m_aosArrowArrayStreamOptions{};
     135             : 
     136             :     struct ArrowArrayStreamPrivateData
     137             :     {
     138             :         bool m_bArrowArrayStreamInProgress = false;
     139             :         bool m_bEOF = false;
     140             :         OGRLayer *m_poLayer = nullptr;
     141             :         std::vector<GIntBig> m_anQueriedFIDs{};
     142             :         size_t m_iQueriedFIDS = 0;
     143             :         std::deque<std::unique_ptr<OGRFeature>> m_oFeatureQueue{};
     144             :     };
     145             : 
     146             :     std::shared_ptr<ArrowArrayStreamPrivateData>
     147             :         m_poSharedArrowArrayStreamPrivateData{};
     148             : 
     149             :     struct ArrowArrayStreamPrivateDataSharedDataWrapper
     150             :     {
     151             :         std::shared_ptr<ArrowArrayStreamPrivateData> poShared{};
     152             :     };
     153             :     //! @endcond
     154             : 
     155             :     friend class OGRArrowArrayHelper;
     156             :     static void ReleaseArray(struct ArrowArray *array);
     157             :     static void ReleaseSchema(struct ArrowSchema *schema);
     158             :     static void ReleaseStream(struct ArrowArrayStream *stream);
     159             :     virtual int GetArrowSchema(struct ArrowArrayStream *,
     160             :                                struct ArrowSchema *out_schema);
     161             :     virtual int GetNextArrowArray(struct ArrowArrayStream *,
     162             :                                   struct ArrowArray *out_array);
     163             :     static int StaticGetArrowSchema(struct ArrowArrayStream *,
     164             :                                     struct ArrowSchema *out_schema);
     165             :     static int StaticGetNextArrowArray(struct ArrowArrayStream *,
     166             :                                        struct ArrowArray *out_array);
     167             :     static const char *GetLastErrorArrowArrayStream(struct ArrowArrayStream *);
     168             : 
     169             :     static struct ArrowSchema *
     170             :     CreateSchemaForWKBGeometryColumn(const OGRGeomFieldDefn *poFieldDefn,
     171             :                                      const char *pszArrowFormat,
     172             :                                      const char *pszExtensionName);
     173             : 
     174             :     virtual bool
     175             :     CanPostFilterArrowArray(const struct ArrowSchema *schema) const;
     176             :     void PostFilterArrowArray(const struct ArrowSchema *schema,
     177             :                               struct ArrowArray *array,
     178             :                               CSLConstList papszOptions) const;
     179             : 
     180             :     //! @cond Doxygen_Suppress
     181             :     bool CreateFieldFromArrowSchemaInternal(const struct ArrowSchema *schema,
     182             :                                             const std::string &osFieldPrefix,
     183             :                                             CSLConstList papszOptions);
     184             :     //! @endcond
     185             : 
     186             :   public:
     187             :     OGRLayer();
     188             :     virtual ~OGRLayer();
     189             : 
     190             :     /** Return begin of feature iterator.
     191             :      *
     192             :      * Using this iterator for standard range-based loops is safe, but
     193             :      * due to implementation limitations, you shouldn't try to access
     194             :      * (dereference) more than one iterator step at a time, since the
     195             :      * OGRFeatureUniquePtr reference is reused.
     196             :      *
     197             :      * Only one iterator per layer can be active at a time.
     198             :      * @since GDAL 2.3
     199             :      */
     200             :     FeatureIterator begin();
     201             : 
     202             :     /** Return end of feature iterator. */
     203             :     FeatureIterator end();
     204             : 
     205             :     virtual OGRGeometry *GetSpatialFilter();
     206             :     virtual void SetSpatialFilter(OGRGeometry *);
     207             :     virtual void SetSpatialFilterRect(double dfMinX, double dfMinY,
     208             :                                       double dfMaxX, double dfMaxY);
     209             : 
     210             :     virtual void SetSpatialFilter(int iGeomField, OGRGeometry *);
     211             :     virtual void SetSpatialFilterRect(int iGeomField, double dfMinX,
     212             :                                       double dfMinY, double dfMaxX,
     213             :                                       double dfMaxY);
     214             : 
     215             :     virtual OGRErr SetAttributeFilter(const char *);
     216             : 
     217             :     virtual void ResetReading() = 0;
     218             :     virtual OGRFeature *GetNextFeature() CPL_WARN_UNUSED_RESULT = 0;
     219             :     virtual OGRErr SetNextByIndex(GIntBig nIndex);
     220             :     virtual OGRFeature *GetFeature(GIntBig nFID) CPL_WARN_UNUSED_RESULT;
     221             : 
     222             :     virtual GDALDataset *GetDataset();
     223             :     virtual bool GetArrowStream(struct ArrowArrayStream *out_stream,
     224             :                                 CSLConstList papszOptions = nullptr);
     225             :     virtual bool IsArrowSchemaSupported(const struct ArrowSchema *schema,
     226             :                                         CSLConstList papszOptions,
     227             :                                         std::string &osErrorMsg) const;
     228             :     virtual bool
     229             :     CreateFieldFromArrowSchema(const struct ArrowSchema *schema,
     230             :                                CSLConstList papszOptions = nullptr);
     231             :     virtual bool WriteArrowBatch(const struct ArrowSchema *schema,
     232             :                                  struct ArrowArray *array,
     233             :                                  CSLConstList papszOptions = nullptr);
     234             : 
     235             :     OGRErr SetFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
     236             :     OGRErr CreateFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
     237             :     OGRErr UpsertFeature(OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT;
     238             :     OGRErr UpdateFeature(OGRFeature *poFeature, int nUpdatedFieldsCount,
     239             :                          const int *panUpdatedFieldsIdx,
     240             :                          int nUpdatedGeomFieldsCount,
     241             :                          const int *panUpdatedGeomFieldsIdx,
     242             :                          bool bUpdateStyleString) CPL_WARN_UNUSED_RESULT;
     243             : 
     244             :     virtual OGRErr DeleteFeature(GIntBig nFID) CPL_WARN_UNUSED_RESULT;
     245             : 
     246             :     virtual const char *GetName();
     247             :     virtual OGRwkbGeometryType GetGeomType();
     248             :     virtual OGRFeatureDefn *GetLayerDefn() = 0;
     249             :     virtual int FindFieldIndex(const char *pszFieldName, int bExactMatch);
     250             : 
     251             :     virtual OGRSpatialReference *GetSpatialRef();
     252             : 
     253             :     /** Return type of OGRLayer::GetSupportedSRSList() */
     254             :     typedef std::vector<
     255             :         std::unique_ptr<OGRSpatialReference, OGRSpatialReferenceReleaser>>
     256             :         GetSupportedSRSListRetType;
     257             :     virtual const GetSupportedSRSListRetType &
     258             :     GetSupportedSRSList(int iGeomField);
     259             :     virtual OGRErr SetActiveSRS(int iGeomField,
     260             :                                 const OGRSpatialReference *poSRS);
     261             : 
     262             :     virtual GIntBig GetFeatureCount(int bForce = TRUE);
     263             :     virtual OGRErr GetExtent(OGREnvelope *psExtent,
     264             :                              int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
     265             :     virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent,
     266             :                              int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
     267             : 
     268             :     virtual OGRErr GetExtent3D(int iGeomField, OGREnvelope3D *psExtent3D,
     269             :                                int bForce = TRUE) CPL_WARN_UNUSED_RESULT;
     270             : 
     271             :     virtual int TestCapability(const char *) = 0;
     272             : 
     273             :     virtual OGRErr Rename(const char *pszNewName) CPL_WARN_UNUSED_RESULT;
     274             : 
     275             :     virtual OGRErr CreateField(const OGRFieldDefn *poField,
     276             :                                int bApproxOK = TRUE);
     277             :     virtual OGRErr DeleteField(int iField);
     278             :     virtual OGRErr ReorderFields(int *panMap);
     279             :     virtual OGRErr AlterFieldDefn(int iField, OGRFieldDefn *poNewFieldDefn,
     280             :                                   int nFlagsIn);
     281             :     virtual OGRErr
     282             :     AlterGeomFieldDefn(int iGeomField,
     283             :                        const OGRGeomFieldDefn *poNewGeomFieldDefn,
     284             :                        int nFlagsIn);
     285             : 
     286             :     virtual OGRErr CreateGeomField(const OGRGeomFieldDefn *poField,
     287             :                                    int bApproxOK = TRUE);
     288             : 
     289             :     virtual OGRErr SyncToDisk();
     290             : 
     291             :     virtual OGRStyleTable *GetStyleTable();
     292             :     virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable);
     293             : 
     294             :     virtual void SetStyleTable(OGRStyleTable *poStyleTable);
     295             : 
     296             :     virtual OGRErr StartTransaction() CPL_WARN_UNUSED_RESULT;
     297             :     virtual OGRErr CommitTransaction() CPL_WARN_UNUSED_RESULT;
     298             :     virtual OGRErr RollbackTransaction();
     299             : 
     300             :     virtual const char *GetFIDColumn();
     301             :     virtual const char *GetGeometryColumn();
     302             : 
     303             :     virtual OGRErr SetIgnoredFields(CSLConstList papszFields);
     304             : 
     305             :     virtual OGRGeometryTypeCounter *
     306             :     GetGeometryTypes(int iGeomField, int nFlagsGGT, int &nEntryCountOut,
     307             :                      GDALProgressFunc pfnProgress, void *pProgressData);
     308             : 
     309             :     OGRErr Intersection(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
     310             :                         char **papszOptions = nullptr,
     311             :                         GDALProgressFunc pfnProgress = nullptr,
     312             :                         void *pProgressArg = nullptr);
     313             :     OGRErr Union(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
     314             :                  char **papszOptions = nullptr,
     315             :                  GDALProgressFunc pfnProgress = nullptr,
     316             :                  void *pProgressArg = nullptr);
     317             :     OGRErr SymDifference(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
     318             :                          char **papszOptions, GDALProgressFunc pfnProgress,
     319             :                          void *pProgressArg);
     320             :     OGRErr Identity(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
     321             :                     char **papszOptions = nullptr,
     322             :                     GDALProgressFunc pfnProgress = nullptr,
     323             :                     void *pProgressArg = nullptr);
     324             :     OGRErr Update(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
     325             :                   char **papszOptions = nullptr,
     326             :                   GDALProgressFunc pfnProgress = nullptr,
     327             :                   void *pProgressArg = nullptr);
     328             :     OGRErr Clip(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
     329             :                 char **papszOptions = nullptr,
     330             :                 GDALProgressFunc pfnProgress = nullptr,
     331             :                 void *pProgressArg = nullptr);
     332             :     OGRErr Erase(OGRLayer *pLayerMethod, OGRLayer *pLayerResult,
     333             :                  char **papszOptions = nullptr,
     334             :                  GDALProgressFunc pfnProgress = nullptr,
     335             :                  void *pProgressArg = nullptr);
     336             : 
     337             :     int Reference();
     338             :     int Dereference();
     339             :     int GetRefCount() const;
     340             :     //! @cond Doxygen_Suppress
     341             :     GIntBig GetFeaturesRead();
     342             :     //! @endcond
     343             : 
     344             :     /* non virtual : convenience wrapper for ReorderFields() */
     345             :     OGRErr ReorderField(int iOldFieldPos, int iNewFieldPos);
     346             : 
     347             :     //! @cond Doxygen_Suppress
     348             :     int AttributeFilterEvaluationNeedsGeometry();
     349             : 
     350             :     /* consider these private */
     351             :     OGRErr InitializeIndexSupport(const char *);
     352             : 
     353        5775 :     OGRLayerAttrIndex *GetIndex()
     354             :     {
     355        5775 :         return m_poAttrIndex;
     356             :     }
     357             : 
     358          13 :     int GetGeomFieldFilter() const
     359             :     {
     360          13 :         return m_iGeomFieldFilter;
     361             :     }
     362             : 
     363          13 :     const char *GetAttrQueryString() const
     364             :     {
     365          13 :         return m_pszAttrQueryString;
     366             :     }
     367             : 
     368             :     //! @endcond
     369             : 
     370             :     /** Convert a OGRLayer* to a OGRLayerH.
     371             :      * @since GDAL 2.3
     372             :      */
     373       27311 :     static inline OGRLayerH ToHandle(OGRLayer *poLayer)
     374             :     {
     375       27311 :         return reinterpret_cast<OGRLayerH>(poLayer);
     376             :     }
     377             : 
     378             :     /** Convert a OGRLayerH to a OGRLayer*.
     379             :      * @since GDAL 2.3
     380             :      */
     381      730396 :     static inline OGRLayer *FromHandle(OGRLayerH hLayer)
     382             :     {
     383      730396 :         return reinterpret_cast<OGRLayer *>(hLayer);
     384             :     }
     385             : 
     386             :     //! @cond Doxygen_Suppress
     387             :     bool FilterWKBGeometry(const GByte *pabyWKB, size_t nWKBSize,
     388             :                            bool bEnvelopeAlreadySet,
     389             :                            OGREnvelope &sEnvelope) const;
     390             :     //! @endcond
     391             : 
     392             :     /** Field name used by GetArrowSchema() for a FID column when
     393             :      * GetFIDColumn() is not set.
     394             :      */
     395             :     static constexpr const char *DEFAULT_ARROW_FID_NAME = "OGC_FID";
     396             : 
     397             :     /** Field name used by GetArrowSchema() for the name of the (single)
     398             :      * geometry column (returned by GetGeometryColumn()) is not set.
     399             :      */
     400             :     static constexpr const char *DEFAULT_ARROW_GEOMETRY_NAME = "wkb_geometry";
     401             : 
     402             :   protected:
     403             :     //! @cond Doxygen_Suppress
     404             :     OGRStyleTable *m_poStyleTable;
     405             :     OGRFeatureQuery *m_poAttrQuery;
     406             :     char *m_pszAttrQueryString;
     407             :     OGRLayerAttrIndex *m_poAttrIndex;
     408             : 
     409             :     int m_nRefCount;
     410             : 
     411             :     GIntBig m_nFeaturesRead;
     412             :     //! @endcond
     413             : };
     414             : 
     415             : /** Return begin of feature iterator.
     416             :  *
     417             :  * Using this iterator for standard range-based loops is safe, but
     418             :  * due to implementation limitations, you shouldn't try to access
     419             :  * (dereference) more than one iterator step at a time, since the
     420             :  * std::unique_ptr&lt;OGRFeature&gt; reference is reused.
     421             :  *
     422             :  * Only one iterator per layer can be active at a time.
     423             :  * @since GDAL 2.3
     424             :  * @see OGRLayer::begin()
     425             :  */
     426        2256 : inline OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
     427             : {
     428        2256 :     return poLayer->begin();
     429             : }
     430             : 
     431             : /** Return end of feature iterator.
     432             :  * @see OGRLayer::end()
     433             :  */
     434        2256 : inline OGRLayer::FeatureIterator end(OGRLayer *poLayer)
     435             : {
     436        2256 :     return poLayer->end();
     437             : }
     438             : 
     439             : /** Unique pointer type for OGRLayer.
     440             :  * @since GDAL 3.2
     441             :  */
     442             : using OGRLayerUniquePtr = std::unique_ptr<OGRLayer>;
     443             : 
     444             : /************************************************************************/
     445             : /*                     OGRGetNextFeatureThroughRaw                      */
     446             : /************************************************************************/
     447             : 
     448             : /** Template class offering a GetNextFeature() implementation relying on
     449             :  * GetNextRawFeature()
     450             :  *
     451             :  * @since GDAL 3.2
     452             :  */
     453             : template <class BaseLayer> class OGRGetNextFeatureThroughRaw
     454             : {
     455             :   protected:
     456             :     ~OGRGetNextFeatureThroughRaw() = default;
     457             : 
     458             :   public:
     459             :     /** Implement OGRLayer::GetNextFeature(), relying on
     460             :      * BaseLayer::GetNextRawFeature() */
     461       17586 :     OGRFeature *GetNextFeature()
     462             :     {
     463       17586 :         const auto poThis = static_cast<BaseLayer *>(this);
     464        2108 :         while (true)
     465             :         {
     466       19694 :             OGRFeature *poFeature = poThis->GetNextRawFeature();
     467       19694 :             if (poFeature == nullptr)
     468        3373 :                 return nullptr;
     469             : 
     470        2682 :             if ((poThis->m_poFilterGeom == nullptr ||
     471       32642 :                  poThis->FilterGeometry(poFeature->GetGeometryRef())) &&
     472       18096 :                 (poThis->m_poAttrQuery == nullptr ||
     473        2697 :                  poThis->m_poAttrQuery->Evaluate(poFeature)))
     474             :             {
     475       14213 :                 return poFeature;
     476             :             }
     477             :             else
     478        2108 :                 delete poFeature;
     479             :         }
     480             :     }
     481             : };
     482             : 
     483             : /** Utility macro to define GetNextFeature() through GetNextRawFeature() */
     484             : #define DEFINE_GET_NEXT_FEATURE_THROUGH_RAW(BaseLayer)                         \
     485             :   private:                                                                     \
     486             :     friend class OGRGetNextFeatureThroughRaw<BaseLayer>;                       \
     487             :                                                                                \
     488             :   public:                                                                      \
     489             :     OGRFeature *GetNextFeature() override                                      \
     490             :     {                                                                          \
     491             :         return OGRGetNextFeatureThroughRaw<BaseLayer>::GetNextFeature();       \
     492             :     }
     493             : 
     494             : /************************************************************************/
     495             : /*                            OGRDataSource                             */
     496             : /************************************************************************/
     497             : 
     498             : /**
     499             :  * LEGACY class. Use GDALDataset in your new code ! This class may be
     500             :  * removed in a later release.
     501             :  *
     502             :  * This class represents a data source.  A data source potentially
     503             :  * consists of many layers (OGRLayer).  A data source normally consists
     504             :  * of one, or a related set of files, though the name doesn't have to be
     505             :  * a real item in the file system.
     506             :  *
     507             :  * When an OGRDataSource is destroyed, all its associated OGRLayers objects
     508             :  * are also destroyed.
     509             :  *
     510             :  * NOTE: Starting with GDAL 2.0, it is *NOT* safe to cast the handle of
     511             :  * a C function that returns a OGRDataSourceH to a OGRDataSource*. If a C++
     512             :  * object is needed, the handle should be cast to GDALDataset*.
     513             :  *
     514             :  * @deprecated
     515             :  */
     516             : 
     517             : class CPL_DLL OGRDataSource : public GDALDataset
     518             : {
     519             :   public:
     520             :     OGRDataSource();
     521             :     //! @cond Doxygen_Suppress
     522             :     virtual const char *GetName()
     523             :         OGR_DEPRECATED("Use GDALDataset class instead") = 0;
     524             : 
     525             :     static void DestroyDataSource(OGRDataSource *)
     526             :         OGR_DEPRECATED("Use GDALDataset class instead");
     527             :     //! @endcond
     528             : };
     529             : 
     530             : /************************************************************************/
     531             : /*                             OGRSFDriver                              */
     532             : /************************************************************************/
     533             : 
     534             : /**
     535             :  * LEGACY class. Use GDALDriver in your new code ! This class may be
     536             :  * removed in a later release.
     537             :  *
     538             :  * Represents an operational format driver.
     539             :  *
     540             :  * One OGRSFDriver derived class will normally exist for each file format
     541             :  * registered for use, regardless of whether a file has or will be opened.
     542             :  * The list of available drivers is normally managed by the
     543             :  * OGRSFDriverRegistrar.
     544             :  *
     545             :  * NOTE: Starting with GDAL 2.0, it is *NOT* safe to cast the handle of
     546             :  * a C function that returns a OGRSFDriverH to a OGRSFDriver*. If a C++ object
     547             :  * is needed, the handle should be cast to GDALDriver*.
     548             :  *
     549             :  * @deprecated
     550             :  */
     551             : 
     552             : class CPL_DLL OGRSFDriver : public GDALDriver
     553             : {
     554             :   public:
     555             :     //! @cond Doxygen_Suppress
     556             :     virtual ~OGRSFDriver();
     557             : 
     558             :     virtual const char *GetName()
     559             :         OGR_DEPRECATED("Use GDALDriver class instead") = 0;
     560             : 
     561             :     virtual OGRDataSource *Open(const char *pszName, int bUpdate = FALSE)
     562             :         OGR_DEPRECATED("Use GDALDriver class instead") = 0;
     563             : 
     564             :     virtual int TestCapability(const char *pszCap)
     565             :         OGR_DEPRECATED("Use GDALDriver class instead") = 0;
     566             : 
     567             :     virtual OGRDataSource *CreateDataSource(const char *pszName,
     568             :                                             char ** = nullptr)
     569             :         OGR_DEPRECATED("Use GDALDriver class instead");
     570             :     virtual OGRErr DeleteDataSource(const char *pszName)
     571             :         OGR_DEPRECATED("Use GDALDriver class instead");
     572             :     //! @endcond
     573             : };
     574             : 
     575             : /************************************************************************/
     576             : /*                         OGRSFDriverRegistrar                         */
     577             : /************************************************************************/
     578             : 
     579             : /**
     580             :  * LEGACY class. Use GDALDriverManager in your new code ! This class may be
     581             :  * removed in a later release.
     582             :  *
     583             :  * Singleton manager for OGRSFDriver instances that will be used to try
     584             :  * and open datasources.  Normally the registrar is populated with
     585             :  * standard drivers using the OGRRegisterAll() function and does not need
     586             :  * to be directly accessed.  The driver registrar and all registered drivers
     587             :  * may be cleaned up on shutdown using OGRCleanupAll().
     588             :  *
     589             :  * @deprecated
     590             :  */
     591             : 
     592             : class CPL_DLL OGRSFDriverRegistrar
     593             : {
     594             : 
     595             :     OGRSFDriverRegistrar();
     596             :     ~OGRSFDriverRegistrar();
     597             : 
     598             :     static GDALDataset *OpenWithDriverArg(GDALDriver *poDriver,
     599             :                                           GDALOpenInfo *poOpenInfo);
     600             :     static GDALDataset *CreateVectorOnly(GDALDriver *poDriver,
     601             :                                          const char *pszName,
     602             :                                          char **papszOptions);
     603             :     static CPLErr DeleteDataSource(GDALDriver *poDriver, const char *pszName);
     604             : 
     605             :   public:
     606             :     //! @cond Doxygen_Suppress
     607             :     static OGRSFDriverRegistrar *GetRegistrar()
     608             :         OGR_DEPRECATED("Use GDALDriverManager class instead");
     609             : 
     610             :     // cppcheck-suppress functionStatic
     611             :     void RegisterDriver(OGRSFDriver *poDriver)
     612             :         OGR_DEPRECATED("Use GDALDriverManager class instead");
     613             : 
     614             :     // cppcheck-suppress functionStatic
     615             :     int GetDriverCount(void)
     616             :         OGR_DEPRECATED("Use GDALDriverManager class instead");
     617             :     // cppcheck-suppress functionStatic
     618             :     GDALDriver *GetDriver(int iDriver)
     619             :         OGR_DEPRECATED("Use GDALDriverManager class instead");
     620             :     // cppcheck-suppress functionStatic
     621             :     GDALDriver *GetDriverByName(const char *)
     622             :         OGR_DEPRECATED("Use GDALDriverManager class instead");
     623             : 
     624             :     // cppcheck-suppress functionStatic
     625             :     int GetOpenDSCount() OGR_DEPRECATED("Use GDALDriverManager class instead");
     626             :     // cppcheck-suppress functionStatic
     627             :     OGRDataSource *GetOpenDS(int)
     628             :         OGR_DEPRECATED("Use GDALDriverManager class instead");
     629             :     //! @endcond
     630             : };
     631             : 
     632             : /* -------------------------------------------------------------------- */
     633             : /*      Various available registration methods.                         */
     634             : /* -------------------------------------------------------------------- */
     635             : CPL_C_START
     636             : 
     637             : //! @cond Doxygen_Suppress
     638             : void OGRRegisterAllInternal();
     639             : 
     640             : void CPL_DLL RegisterOGRFileGDB();
     641             : void DeclareDeferredOGRFileGDBPlugin();
     642             : void CPL_DLL RegisterOGRShape();
     643             : void CPL_DLL RegisterOGRNTF();
     644             : void CPL_DLL RegisterOGRSDTS();
     645             : void CPL_DLL RegisterOGRTiger();
     646             : void CPL_DLL RegisterOGRS57();
     647             : void CPL_DLL RegisterOGRTAB();
     648             : void CPL_DLL RegisterOGRMIF();
     649             : void CPL_DLL RegisterOGROGDI();
     650             : void DeclareDeferredOGROGDIPlugin();
     651             : void CPL_DLL RegisterOGRODBC();
     652             : void DeclareDeferredOGRODBCPlugin();
     653             : void CPL_DLL RegisterOGRWAsP();
     654             : void CPL_DLL RegisterOGRPG();
     655             : void DeclareDeferredOGRPGPlugin();
     656             : void CPL_DLL RegisterOGRMSSQLSpatial();
     657             : void DeclareDeferredOGRMSSQLSpatialPlugin();
     658             : void CPL_DLL RegisterOGRMySQL();
     659             : void DeclareDeferredOGRMySQLPlugin();
     660             : void CPL_DLL RegisterOGROCI();
     661             : void DeclareDeferredOGROCIPlugin();
     662             : void CPL_DLL RegisterOGRDGN();
     663             : void CPL_DLL RegisterOGRGML();
     664             : void CPL_DLL RegisterOGRLIBKML();
     665             : void DeclareDeferredOGRLIBKMLPlugin();
     666             : void CPL_DLL RegisterOGRKML();
     667             : void CPL_DLL RegisterOGRFlatGeobuf();
     668             : void CPL_DLL RegisterOGRGeoJSON();
     669             : void CPL_DLL RegisterOGRGeoJSONSeq();
     670             : void CPL_DLL RegisterOGRESRIJSON();
     671             : void CPL_DLL RegisterOGRTopoJSON();
     672             : void CPL_DLL RegisterOGRAVCBin();
     673             : void CPL_DLL RegisterOGRAVCE00();
     674             : void CPL_DLL RegisterOGRMEM();
     675             : void CPL_DLL RegisterOGRVRT();
     676             : void CPL_DLL RegisterOGRSQLite();
     677             : void CPL_DLL RegisterOGRCSV();
     678             : void CPL_DLL RegisterOGRILI1();
     679             : void CPL_DLL RegisterOGRILI2();
     680             : void CPL_DLL RegisterOGRPGeo();
     681             : void CPL_DLL RegisterOGRDXF();
     682             : void CPL_DLL RegisterOGRCAD();
     683             : void DeclareDeferredOGRCADPlugin();
     684             : void CPL_DLL RegisterOGRDWG();
     685             : void CPL_DLL RegisterOGRDGNV8();
     686             : void DeclareDeferredOGRDWGPlugin();
     687             : void DeclareDeferredOGRDGNV8Plugin();
     688             : void CPL_DLL RegisterOGRIDB();
     689             : void DeclareDeferredOGRIDBPlugin();
     690             : void CPL_DLL RegisterOGRGMT();
     691             : void CPL_DLL RegisterOGRGPX();
     692             : void CPL_DLL RegisterOGRGeoconcept();
     693             : void CPL_DLL RegisterOGRNAS();
     694             : void CPL_DLL RegisterOGRGeoRSS();
     695             : void CPL_DLL RegisterOGRVFK();
     696             : void DeclareDeferredOGRVFKPlugin();
     697             : void CPL_DLL RegisterOGRPGDump();
     698             : void CPL_DLL RegisterOGROSM();
     699             : void CPL_DLL RegisterOGRGPSBabel();
     700             : void CPL_DLL RegisterOGRPDS();
     701             : void CPL_DLL RegisterOGRWFS();
     702             : void CPL_DLL RegisterOGROAPIF();
     703             : void CPL_DLL RegisterOGRSOSI();
     704             : void DeclareDeferredOGRSOSIPlugin();
     705             : void CPL_DLL RegisterOGREDIGEO();
     706             : void CPL_DLL RegisterOGRSVG();
     707             : void CPL_DLL RegisterOGRIdrisi();
     708             : void CPL_DLL RegisterOGRXLS();
     709             : void DeclareDeferredOGRXLSPlugin();
     710             : void CPL_DLL RegisterOGRODS();
     711             : void CPL_DLL RegisterOGRXLSX();
     712             : void CPL_DLL RegisterOGRElastic();
     713             : void DeclareDeferredOGRElasticPlugin();
     714             : void CPL_DLL RegisterOGRGeoPackage();
     715             : void CPL_DLL RegisterOGRCarto();
     716             : void DeclareDeferredOGRCartoPlugin();
     717             : void CPL_DLL RegisterOGRAmigoCloud();
     718             : void CPL_DLL RegisterOGRSXF();
     719             : void CPL_DLL RegisterOGROpenFileGDB();
     720             : void DeclareDeferredOGROpenFileGDBPlugin();
     721             : void CPL_DLL RegisterOGRSelafin();
     722             : void CPL_DLL RegisterOGRJML();
     723             : void CPL_DLL RegisterOGRPLSCENES();
     724             : void DeclareDeferredOGRPLSCENESPlugin();
     725             : void CPL_DLL RegisterOGRCSW();
     726             : void CPL_DLL RegisterOGRMongoDBv3();
     727             : void DeclareDeferredOGRMongoDBv3Plugin();
     728             : void CPL_DLL RegisterOGRVDV();
     729             : void CPL_DLL RegisterOGRGMLAS();
     730             : void DeclareDeferredOGRGMLASPlugin();
     731             : void CPL_DLL RegisterOGRMVT();
     732             : void CPL_DLL RegisterOGRNGW();
     733             : void CPL_DLL RegisterOGRMapML();
     734             : void CPL_DLL RegisterOGRLVBAG();
     735             : void CPL_DLL RegisterOGRHANA();
     736             : void DeclareDeferredOGRHANAPlugin();
     737             : void CPL_DLL RegisterOGRParquet();
     738             : void DeclareDeferredOGRParquetPlugin();
     739             : void CPL_DLL RegisterOGRArrow();
     740             : void DeclareDeferredOGRArrowPlugin();
     741             : void CPL_DLL RegisterOGRGTFS();
     742             : void CPL_DLL RegisterOGRPMTiles();
     743             : void CPL_DLL RegisterOGRJSONFG();
     744             : void CPL_DLL RegisterOGRMiraMon();
     745             : // @endcond
     746             : 
     747             : CPL_C_END
     748             : 
     749             : #endif /* ndef OGRSF_FRMTS_H_INCLUDED */

Generated by: LCOV version 1.14