LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/vfk - ogrvfkdriver.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 14 17 82.4 %
Date: 2024-05-04 12:52:34 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  OpenGIS Simple Features Reference Implementation
       4             :  * Purpose:  Implements OGRVFKDriver class.
       5             :  * Author:   Martin Landa, landa.martin gmail.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2009-2018, Martin Landa <landa.martin gmail.com>
       9             :  *
      10             :  * Permission is hereby granted, free of charge, to any person
      11             :  * obtaining a copy of this software and associated documentation
      12             :  * files (the "Software"), to deal in the Software without
      13             :  * restriction, including without limitation the rights to use, copy,
      14             :  * modify, merge, publish, distribute, sublicense, and/or sell copies
      15             :  * of the Software, and to permit persons to whom the Software is
      16             :  * furnished to do so, subject to the following conditions:
      17             :  *
      18             :  * The above copyright notice and this permission notice shall be
      19             :  * included in all copies or substantial portions of the Software.
      20             :  *
      21             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
      22             :  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
      23             :  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
      24             :  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
      25             :  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
      26             :  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
      27             :  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      28             :  * SOFTWARE.
      29             :  ****************************************************************************/
      30             : 
      31             : #include "ogr_vfk.h"
      32             : #include "cpl_conv.h"
      33             : #include "cpl_string.h"
      34             : #include "ogrvfkdrivercore.h"
      35             : 
      36             : /*
      37             :   \brief Open existing data source
      38             :   \return NULL on failure
      39             : */
      40          17 : static GDALDataset *OGRVFKDriverOpen(GDALOpenInfo *poOpenInfo)
      41             : {
      42          17 :     if (poOpenInfo->eAccess == GA_Update || !OGRVFKDriverIdentify(poOpenInfo))
      43           0 :         return nullptr;
      44             : 
      45          17 :     OGRVFKDataSource *poDS = new OGRVFKDataSource();
      46             : 
      47          17 :     if (!poDS->Open(poOpenInfo) || poDS->GetLayerCount() == 0)
      48             :     {
      49           1 :         delete poDS;
      50           1 :         return nullptr;
      51             :     }
      52             :     else
      53          16 :         return poDS;
      54             : }
      55             : 
      56             : /*!
      57             :   \brief Register VFK driver
      58             : */
      59           8 : void RegisterOGRVFK()
      60             : {
      61           8 :     if (!GDAL_CHECK_VERSION("OGR/VFK driver"))
      62           0 :         return;
      63             : 
      64           8 :     if (GDALGetDriverByName(DRIVER_NAME) != nullptr)
      65           0 :         return;
      66             : 
      67           8 :     GDALDriver *poDriver = new GDALDriver();
      68           8 :     OGRVFKDriverSetCommonMetadata(poDriver);
      69           8 :     poDriver->pfnOpen = OGRVFKDriverOpen;
      70             : 
      71           8 :     GetGDALDriverManager()->RegisterDriver(poDriver);
      72             : }

Generated by: LCOV version 1.14