LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/xls - ogrxlsdrivercore.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 20 20 100.0 %
Date: 2024-05-03 15:49:35 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  XLS Translator
       4             :  * Purpose:  Implements OGRXLSDriver.
       5             :  * Author:   Even Rouault, even dot rouault at spatialys.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2011, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * Permission is hereby granted, free of charge, to any person obtaining a
      11             :  * copy of this software and associated documentation files (the "Software"),
      12             :  * to deal in the Software without restriction, including without limitation
      13             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      14             :  * and/or sell copies of the Software, and to permit persons to whom the
      15             :  * Software is furnished to do so, subject to the following conditions:
      16             :  *
      17             :  * The above copyright notice and this permission notice shall be included
      18             :  * in all copies or substantial portions of the Software.
      19             :  *
      20             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      21             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      22             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      23             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      24             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      25             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      26             :  * DEALINGS IN THE SOFTWARE.
      27             :  ****************************************************************************/
      28             : 
      29             : #include "ogrsf_frmts.h"
      30             : 
      31             : #include "ogrxlsdrivercore.h"
      32             : 
      33             : /************************************************************************/
      34             : /*                    OGRXLSDriverIdentify()                            */
      35             : /************************************************************************/
      36             : 
      37       42185 : static int OGRXLSDriverIdentify(GDALOpenInfo *poOpenInfo)
      38             : 
      39             : {
      40       42185 :     return EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "XLS");
      41             : }
      42             : 
      43             : /************************************************************************/
      44             : /*                  OGRXLSDriverSetCommonMetadata()                  */
      45             : /************************************************************************/
      46             : 
      47        1224 : void OGRXLSDriverSetCommonMetadata(GDALDriver *poDriver)
      48             : {
      49        1224 :     poDriver->SetDescription(DRIVER_NAME);
      50        1224 :     poDriver->SetMetadataItem(GDAL_DCAP_VECTOR, "YES");
      51             : 
      52        1224 :     poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, "MS Excel format");
      53        1224 :     poDriver->SetMetadataItem(GDAL_DMD_EXTENSION, "xls");
      54        1224 :     poDriver->SetMetadataItem(GDAL_DMD_HELPTOPIC, "drivers/vector/xls.html");
      55        1224 :     poDriver->SetMetadataItem(GDAL_DCAP_NONSPATIAL, "YES");
      56        1224 :     poDriver->SetMetadataItem(GDAL_DCAP_MULTIPLE_VECTOR_LAYERS, "YES");
      57        1224 :     poDriver->SetMetadataItem(GDAL_DMD_SUPPORTED_SQL_DIALECTS, "OGRSQL SQLITE");
      58             : 
      59        1224 :     poDriver->pfnIdentify = OGRXLSDriverIdentify;
      60        1224 :     poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES");
      61        1224 : }
      62             : 
      63             : /************************************************************************/
      64             : /*                   DeclareDeferredOGRXLSPlugin()                      */
      65             : /************************************************************************/
      66             : 
      67             : #ifdef PLUGIN_FILENAME
      68        1511 : void DeclareDeferredOGRXLSPlugin()
      69             : {
      70        1511 :     if (GDALGetDriverByName(DRIVER_NAME) != nullptr)
      71             :     {
      72         295 :         return;
      73             :     }
      74        1216 :     auto poDriver = new GDALPluginDriverProxy(PLUGIN_FILENAME);
      75             : #ifdef PLUGIN_INSTALLATION_MESSAGE
      76             :     poDriver->SetMetadataItem(GDAL_DMD_PLUGIN_INSTALLATION_MESSAGE,
      77             :                               PLUGIN_INSTALLATION_MESSAGE);
      78             : #endif
      79        1216 :     OGRXLSDriverSetCommonMetadata(poDriver);
      80        1216 :     GetGDALDriverManager()->DeclareDeferredPluginDriver(poDriver);
      81             : }
      82             : #endif

Generated by: LCOV version 1.14