LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/gpsbabel - ogr_gpsbabel.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 2 6 33.3 %
Date: 2024-04-29 01:40:10 Functions: 1 3 33.3 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  * $Id$
       3             :  *
       4             :  * Project:  OpenGIS Simple Features Reference Implementation
       5             :  * Purpose:  Private definitions for OGR/GPSBabel driver.
       6             :  * Author:   Even Rouault, <even dot rouault at spatialys.com>
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 2010, Even Rouault <even dot rouault at spatialys.com>
      10             :  *
      11             :  * Permission is hereby granted, free of charge, to any person obtaining a
      12             :  * copy of this software and associated documentation files (the "Software"),
      13             :  * to deal in the Software without restriction, including without limitation
      14             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15             :  * and/or sell copies of the Software, and to permit persons to whom the
      16             :  * Software is furnished to do so, subject to the following conditions:
      17             :  *
      18             :  * The above copyright notice and this permission notice shall be included
      19             :  * in all copies or substantial portions of the Software.
      20             :  *
      21             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27             :  * DEALINGS IN THE SOFTWARE.
      28             :  ****************************************************************************/
      29             : 
      30             : #ifndef OGR_GPSBABEL_H_INCLUDED
      31             : #define OGR_GPSBABEL_H_INCLUDED
      32             : 
      33             : #include "ogrsf_frmts.h"
      34             : #include "cpl_string.h"
      35             : #include <array>
      36             : 
      37             : /************************************************************************/
      38             : /*                        OGRGPSBabelDataSource                         */
      39             : /************************************************************************/
      40             : 
      41             : class OGRGPSBabelDataSource final : public OGRDataSource
      42             : {
      43             :     int nLayers = 0;
      44             :     std::array<OGRLayer *, 5> apoLayers{
      45             :         {nullptr, nullptr, nullptr, nullptr, nullptr}};
      46             :     char *pszName = nullptr;
      47             :     char *pszGPSBabelDriverName = nullptr;
      48             :     char *pszFilename = nullptr;
      49             :     CPLString osTmpFileName{};
      50             :     GDALDataset *poGPXDS = nullptr;
      51             : 
      52             :   public:
      53             :     OGRGPSBabelDataSource();
      54             :     virtual ~OGRGPSBabelDataSource();
      55             : 
      56             :     virtual int CloseDependentDatasets() override;
      57             : 
      58           0 :     virtual const char *GetName() override
      59             :     {
      60           0 :         return pszName;
      61             :     }
      62             : 
      63           5 :     virtual int GetLayerCount() override
      64             :     {
      65           5 :         return nLayers;
      66             :     }
      67             : 
      68             :     virtual OGRLayer *GetLayer(int) override;
      69             : 
      70             :     virtual int TestCapability(const char *) override;
      71             : 
      72             :     int Open(const char *pszFilename, const char *pszGPSBabelDriverNameIn,
      73             :              char **papszOpenOptions);
      74             : 
      75             :     static bool IsSpecialFile(const char *pszFilename);
      76             :     static bool IsValidDriverName(const char *pszGPSBabelDriverName);
      77             : };
      78             : 
      79             : /************************************************************************/
      80             : /*                   OGRGPSBabelWriteDataSource                         */
      81             : /************************************************************************/
      82             : 
      83             : class OGRGPSBabelWriteDataSource final : public OGRDataSource
      84             : {
      85             :     char *pszName;
      86             :     char *pszGPSBabelDriverName;
      87             :     char *pszFilename;
      88             :     CPLString osTmpFileName;
      89             :     GDALDataset *poGPXDS;
      90             : 
      91             :     bool Convert();
      92             : 
      93             :   public:
      94             :     OGRGPSBabelWriteDataSource();
      95             :     virtual ~OGRGPSBabelWriteDataSource();
      96             : 
      97           0 :     virtual const char *GetName() override
      98             :     {
      99           0 :         return pszName;
     100             :     }
     101             : 
     102             :     virtual int GetLayerCount() override;
     103             :     virtual OGRLayer *GetLayer(int) override;
     104             : 
     105             :     virtual int TestCapability(const char *) override;
     106             : 
     107             :     OGRLayer *ICreateLayer(const char *pszName,
     108             :                            const OGRGeomFieldDefn *poGeomFieldDefn,
     109             :                            CSLConstList papszOptions) override;
     110             : 
     111             :     int Create(const char *pszFilename, char **papszOptions);
     112             : };
     113             : 
     114             : #endif /* ndef OGR_GPSBABEL_H_INCLUDED */

Generated by: LCOV version 1.14