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-11-21 22:18:42 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             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #include "ogr_vfk.h"
      14             : #include "cpl_conv.h"
      15             : #include "cpl_string.h"
      16             : #include "ogrvfkdrivercore.h"
      17             : 
      18             : /*
      19             :   \brief Open existing data source
      20             :   \return NULL on failure
      21             : */
      22          17 : static GDALDataset *OGRVFKDriverOpen(GDALOpenInfo *poOpenInfo)
      23             : {
      24          17 :     if (poOpenInfo->eAccess == GA_Update || !OGRVFKDriverIdentify(poOpenInfo))
      25           0 :         return nullptr;
      26             : 
      27          17 :     OGRVFKDataSource *poDS = new OGRVFKDataSource();
      28             : 
      29          17 :     if (!poDS->Open(poOpenInfo) || poDS->GetLayerCount() == 0)
      30             :     {
      31           1 :         delete poDS;
      32           1 :         return nullptr;
      33             :     }
      34             :     else
      35          16 :         return poDS;
      36             : }
      37             : 
      38             : /*!
      39             :   \brief Register VFK driver
      40             : */
      41          10 : void RegisterOGRVFK()
      42             : {
      43          10 :     if (!GDAL_CHECK_VERSION("OGR/VFK driver"))
      44           0 :         return;
      45             : 
      46          10 :     if (GDALGetDriverByName(DRIVER_NAME) != nullptr)
      47           0 :         return;
      48             : 
      49          10 :     GDALDriver *poDriver = new GDALDriver();
      50          10 :     OGRVFKDriverSetCommonMetadata(poDriver);
      51          10 :     poDriver->pfnOpen = OGRVFKDriverOpen;
      52             : 
      53          10 :     GetGDALDriverManager()->RegisterDriver(poDriver);
      54             : }

Generated by: LCOV version 1.14