LCOV - code coverage report
Current view: top level - frmts/pcraster - pcrasterdrivercore.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 24 24 100.0 %
Date: 2024-11-25 13:07:18 Functions: 5 5 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  PCRaster Integration
       4             :  * Purpose:  PCRaster driver support functions.
       5             :  * Author:   Kor de Jong, Oliver Schmitz
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) PCRaster owners
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #include "pcrasterdrivercore.h"
      14             : 
      15             : /* value for first 27 bytes of MAIN_HEADER.signature */
      16             : #ifndef CSF_SIG
      17             : #define CSF_SIG "RUU CROSS SYSTEM MAP FORMAT"
      18             : #define CSF_SIZE_SIG (sizeof(CSF_SIG) - 1)
      19             : #endif
      20             : 
      21             : /************************************************************************/
      22             : /*                     PCRasterDriverIdentify()                         */
      23             : /************************************************************************/
      24             : 
      25       55489 : int PCRasterDriverIdentify(GDALOpenInfo *poOpenInfo)
      26             : 
      27             : {
      28       61973 :     return (poOpenInfo->fpL &&
      29       61638 :             poOpenInfo->nHeaderBytes >= static_cast<int>(CSF_SIZE_SIG) &&
      30        6149 :             strncmp(reinterpret_cast<char *>(poOpenInfo->pabyHeader), CSF_SIG,
      31       55489 :                     CSF_SIZE_SIG) == 0);
      32             : }
      33             : 
      34             : #undef CSF_SIG
      35             : #undef CSF_SIZE_SIG
      36             : 
      37             : /************************************************************************/
      38             : /*                    PCRasterDriverSetCommonMetadata()                 */
      39             : /************************************************************************/
      40             : 
      41        1302 : void PCRasterDriverSetCommonMetadata(GDALDriver *poDriver)
      42             : {
      43        1302 :     poDriver->SetDescription(DRIVER_NAME);
      44        1302 :     poDriver->SetMetadataItem(GDAL_DCAP_RASTER, "YES");
      45             : 
      46        1302 :     poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, "PCRaster Raster File");
      47        1302 :     poDriver->SetMetadataItem(GDAL_DMD_CREATIONDATATYPES, "Byte Int32 Float32");
      48        1302 :     poDriver->SetMetadataItem(GDAL_DMD_HELPTOPIC,
      49        1302 :                               "drivers/raster/pcraster.html");
      50        1302 :     poDriver->SetMetadataItem(GDAL_DMD_EXTENSION, "map");
      51             : 
      52        1302 :     poDriver->pfnIdentify = PCRasterDriverIdentify;
      53        1302 :     poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES");
      54        1302 :     poDriver->SetMetadataItem(GDAL_DCAP_CREATE, "YES");
      55        1302 :     poDriver->SetMetadataItem(GDAL_DCAP_CREATECOPY, "YES");
      56        1302 : }
      57             : 
      58             : /************************************************************************/
      59             : /*                  DeclareDeferredPCRasterPlugin()                     */
      60             : /************************************************************************/
      61             : 
      62             : #ifdef PLUGIN_FILENAME
      63        1595 : void DeclareDeferredPCRasterPlugin()
      64             : {
      65        1595 :     if (GDALGetDriverByName(DRIVER_NAME) != nullptr)
      66             :     {
      67         302 :         return;
      68             :     }
      69        1293 :     auto poDriver = new GDALPluginDriverProxy(PLUGIN_FILENAME);
      70             : #ifdef PLUGIN_INSTALLATION_MESSAGE
      71             :     poDriver->SetMetadataItem(GDAL_DMD_PLUGIN_INSTALLATION_MESSAGE,
      72             :                               PLUGIN_INSTALLATION_MESSAGE);
      73             : #endif
      74        1293 :     PCRasterDriverSetCommonMetadata(poDriver);
      75        1293 :     GetGDALDriverManager()->DeclareDeferredPluginDriver(poDriver);
      76             : }
      77             : #endif

Generated by: LCOV version 1.14