LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/gpx - ogrgpxdriver.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 32 19 59.4 %
Date: 2010-01-09 Functions: 8 6 75.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogrgpxdriver.cpp 15805 2008-11-23 21:42:01Z rouault $
       3                 :  *
       4                 :  * Project:  GPX Translator
       5                 :  * Purpose:  Implements OGRGPXDriver.
       6                 :  * Author:   Even Rouault, even dot rouault at mines dash paris dot org
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2007, Even Rouault
      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                 : #include "ogr_gpx.h"
      31                 : #include "cpl_conv.h"
      32                 : 
      33                 : CPL_CVSID("$Id: ogrgpxdriver.cpp 15805 2008-11-23 21:42:01Z rouault $");
      34                 : 
      35                 : /************************************************************************/
      36                 : /*                           ~OGRGPXDriver()                            */
      37                 : /************************************************************************/
      38                 : 
      39              96 : OGRGPXDriver::~OGRGPXDriver()
      40                 : 
      41                 : {
      42              96 : }
      43                 : 
      44                 : /************************************************************************/
      45                 : /*                              GetName()                               */
      46                 : /************************************************************************/
      47                 : 
      48            1915 : const char *OGRGPXDriver::GetName()
      49                 : 
      50                 : {
      51            1915 :     return "GPX";
      52                 : }
      53                 : 
      54                 : /************************************************************************/
      55                 : /*                                Open()                                */
      56                 : /************************************************************************/
      57                 : 
      58             123 : OGRDataSource *OGRGPXDriver::Open( const char * pszFilename, int bUpdate )
      59                 : 
      60                 : {
      61             123 :     if (bUpdate)
      62                 :     {
      63              59 :         return NULL;
      64                 :     }
      65                 : 
      66              64 :     OGRGPXDataSource   *poDS = new OGRGPXDataSource();
      67                 : 
      68              64 :     if( !poDS->Open( pszFilename, bUpdate ) )
      69                 :     {
      70              61 :         delete poDS;
      71              61 :         poDS = NULL;
      72                 :     }
      73                 : 
      74              64 :     return poDS;
      75                 : }
      76                 : 
      77                 : /************************************************************************/
      78                 : /*                          CreateDataSource()                          */
      79                 : /************************************************************************/
      80                 : 
      81               2 : OGRDataSource *OGRGPXDriver::CreateDataSource( const char * pszName,
      82                 :                                                char **papszOptions )
      83                 : 
      84                 : {
      85               2 :     OGRGPXDataSource   *poDS = new OGRGPXDataSource();
      86                 : 
      87               2 :     if( !poDS->Create( pszName, papszOptions ) )
      88                 :     {
      89               0 :         delete poDS;
      90               0 :         poDS = NULL;
      91                 :     }
      92                 : 
      93               2 :     return poDS;
      94                 : }
      95                 : 
      96                 : /************************************************************************/
      97                 : /*                          DeleteDataSource()                          */
      98                 : /************************************************************************/
      99                 : 
     100               0 : OGRErr OGRGPXDriver::DeleteDataSource( const char *pszFilename )
     101                 : 
     102                 : {
     103               0 :     if( VSIUnlink( pszFilename ) == 0 )
     104               0 :         return OGRERR_NONE;
     105                 :     else
     106               0 :         return OGRERR_FAILURE;
     107                 : }
     108                 : 
     109                 : /************************************************************************/
     110                 : /*                           TestCapability()                           */
     111                 : /************************************************************************/
     112                 : 
     113               0 : int OGRGPXDriver::TestCapability( const char * pszCap )
     114                 : 
     115                 : {
     116               0 :     if( EQUAL(pszCap,ODrCCreateDataSource) )
     117               0 :         return TRUE;
     118               0 :     else if( EQUAL(pszCap,ODrCDeleteDataSource) )
     119               0 :         return TRUE;
     120                 :     else
     121               0 :         return FALSE;
     122                 : }
     123                 : 
     124                 : 
     125                 : /************************************************************************/
     126                 : /*                           RegisterOGRGPX()                           */
     127                 : /************************************************************************/
     128                 : 
     129              64 : void RegisterOGRGPX()
     130                 : 
     131                 : {
     132              64 :     if (! GDAL_CHECK_VERSION("OGR/GPX driver"))
     133               0 :         return;
     134              64 :     OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver( new OGRGPXDriver );
     135                 : }
     136                 : 

Generated by: LCOV version 1.7