LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/bna - ogrbnadriver.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 29 17 58.6 %
Date: 2010-01-09 Functions: 8 6 75.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogrbnadriver.cpp
       3                 :  *
       4                 :  * Project:  BNA Translator
       5                 :  * Purpose:  Implements OGRBNADriver.
       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_bna.h"
      31                 : #include "cpl_conv.h"
      32                 : 
      33                 : /************************************************************************/
      34                 : /*                           ~OGRBNADriver()                            */
      35                 : /************************************************************************/
      36                 : 
      37              96 : OGRBNADriver::~OGRBNADriver()
      38                 : 
      39                 : {
      40              96 : }
      41                 : 
      42                 : /************************************************************************/
      43                 : /*                              GetName()                               */
      44                 : /************************************************************************/
      45                 : 
      46            1931 : const char *OGRBNADriver::GetName()
      47                 : 
      48                 : {
      49            1931 :     return "BNA";
      50                 : }
      51                 : 
      52                 : /************************************************************************/
      53                 : /*                                Open()                                */
      54                 : /************************************************************************/
      55                 : 
      56             171 : OGRDataSource *OGRBNADriver::Open( const char * pszFilename, int bUpdate )
      57                 : 
      58                 : {
      59             171 :     OGRBNADataSource   *poDS = new OGRBNADataSource();
      60                 : 
      61             171 :     if( !poDS->Open( pszFilename, bUpdate ) )
      62                 :     {
      63             163 :         delete poDS;
      64             163 :         poDS = NULL;
      65                 :     }
      66                 : 
      67             171 :     return poDS;
      68                 : }
      69                 : 
      70                 : /************************************************************************/
      71                 : /*                          CreateDataSource()                          */
      72                 : /************************************************************************/
      73                 : 
      74               3 : OGRDataSource *OGRBNADriver::CreateDataSource( const char * pszName,
      75                 :                                                  char **papszOptions )
      76                 : 
      77                 : {
      78               3 :     OGRBNADataSource   *poDS = new OGRBNADataSource();
      79                 : 
      80               3 :     if( !poDS->Create( pszName, papszOptions ) )
      81                 :     {
      82               0 :         delete poDS;
      83               0 :         poDS = NULL;
      84                 :     }
      85                 : 
      86               3 :     return poDS;
      87                 : }
      88                 : 
      89                 : /************************************************************************/
      90                 : /*                          DeleteDataSource()                          */
      91                 : /************************************************************************/
      92                 : 
      93               0 : OGRErr OGRBNADriver::DeleteDataSource( const char *pszFilename )
      94                 : 
      95                 : {
      96               0 :     if( VSIUnlink( pszFilename ) == 0 )
      97               0 :         return OGRERR_NONE;
      98                 :     else
      99               0 :         return OGRERR_FAILURE;
     100                 : }
     101                 : 
     102                 : /************************************************************************/
     103                 : /*                           TestCapability()                           */
     104                 : /************************************************************************/
     105                 : 
     106               0 : int OGRBNADriver::TestCapability( const char * pszCap )
     107                 : 
     108                 : {
     109               0 :     if( EQUAL(pszCap,ODrCCreateDataSource) )
     110               0 :         return TRUE;
     111               0 :     else if( EQUAL(pszCap,ODrCDeleteDataSource) )
     112               0 :         return TRUE;
     113                 :     else
     114               0 :         return FALSE;
     115                 : }
     116                 : 
     117                 : 
     118                 : /************************************************************************/
     119                 : /*                           RegisterOGRBNA()                           */
     120                 : /************************************************************************/
     121                 : 
     122              64 : void RegisterOGRBNA()
     123                 : 
     124                 : {
     125              64 :     OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver( new OGRBNADriver );
     126              64 : }
     127                 : 

Generated by: LCOV version 1.7