LCOV - code coverage report
Current view: top level - ogr/ogrsf_frmts/mem - ogrmemdriver.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 38 38 100.0 %
Date: 2024-11-21 22:18:42 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  OpenGIS Simple Features Reference Implementation
       4             :  * Purpose:  Implements OGRMemDriver class.
       5             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2003, Frank Warmerdam <warmerdam@pobox.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #include "cpl_port.h"
      14             : #include "ogr_mem.h"
      15             : 
      16             : #include "cpl_conv.h"
      17             : #include "cpl_string.h"
      18             : #include "gdal.h"
      19             : #include "ogr_core.h"
      20             : #include "ogrsf_frmts.h"
      21             : 
      22             : /************************************************************************/
      23             : /*                                Open()                                */
      24             : /************************************************************************/
      25             : 
      26       27897 : static GDALDataset *OGRMemDriverOpen(GDALOpenInfo *)
      27             : {
      28       27897 :     return nullptr;
      29             : }
      30             : 
      31             : /************************************************************************/
      32             : /*                       OGRMemDriverCreate()                           */
      33             : /************************************************************************/
      34             : 
      35         758 : static GDALDataset *OGRMemDriverCreate(const char *pszName, int /* nXSize */,
      36             :                                        int /* nYSize */, int /* nBandCount */,
      37             :                                        GDALDataType, char **papszOptions)
      38             : 
      39             : {
      40         758 :     return new OGRMemDataSource(pszName, papszOptions);
      41             : }
      42             : 
      43             : /************************************************************************/
      44             : /*                           RegisterOGRMem()                           */
      45             : /************************************************************************/
      46             : 
      47        1595 : void RegisterOGRMEM()
      48             : 
      49             : {
      50        1595 :     if (GDALGetDriverByName("Memory") != nullptr)
      51         302 :         return;
      52             : 
      53        1293 :     GDALDriver *poDriver = new GDALDriver();
      54        1293 :     poDriver->SetDescription("Memory");
      55        1293 :     poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, "Memory");
      56        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_VECTOR, "YES");
      57        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_CREATE_LAYER, "YES");
      58        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_DELETE_LAYER, "YES");
      59        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_CREATE_FIELD, "YES");
      60        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_DELETE_FIELD, "YES");
      61        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_REORDER_FIELDS, "YES");
      62        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_CURVE_GEOMETRIES, "YES");
      63        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_MEASURED_GEOMETRIES, "YES");
      64        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_Z_GEOMETRIES, "YES");
      65        1293 :     poDriver->SetMetadataItem(GDAL_DMD_SUPPORTED_SQL_DIALECTS, "OGRSQL SQLITE");
      66             : 
      67        1293 :     poDriver->SetMetadataItem(
      68             :         GDAL_DMD_CREATIONFIELDDATATYPES,
      69             :         "Integer Integer64 Real String Date DateTime Time IntegerList "
      70        1293 :         "Integer64List RealList StringList Binary");
      71        1293 :     poDriver->SetMetadataItem(GDAL_DMD_CREATION_FIELD_DEFN_FLAGS,
      72             :                               "WidthPrecision Nullable Default Unique "
      73        1293 :                               "Comment AlternativeName Domain");
      74        1293 :     poDriver->SetMetadataItem(GDAL_DMD_ALTER_FIELD_DEFN_FLAGS,
      75             :                               "Name Type WidthPrecision Nullable Default "
      76        1293 :                               "Unique Domain AlternativeName Comment");
      77             : 
      78        1293 :     poDriver->SetMetadataItem(
      79             :         GDAL_DS_LAYER_CREATIONOPTIONLIST,
      80             :         "<LayerCreationOptionList>"
      81             :         "  <Option name='ADVERTIZE_UTF8' type='boolean' description='Whether "
      82             :         "the layer will contain UTF-8 strings' default='NO'/>"
      83             :         "  <Option name='FID' type='string' description="
      84             :         "'Name of the FID column to create' default='' />"
      85        1293 :         "</LayerCreationOptionList>");
      86             : 
      87        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_COORDINATE_EPOCH, "YES");
      88        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_MULTIPLE_VECTOR_LAYERS, "YES");
      89             : 
      90        1293 :     poDriver->SetMetadataItem(GDAL_DCAP_FIELD_DOMAINS, "YES");
      91        1293 :     poDriver->SetMetadataItem(GDAL_DMD_CREATION_FIELD_DOMAIN_TYPES,
      92        1293 :                               "Coded Range Glob");
      93             : 
      94        1293 :     poDriver->SetMetadataItem(GDAL_DMD_ALTER_GEOM_FIELD_DEFN_FLAGS,
      95        1293 :                               "Name Type Nullable SRS CoordinateEpoch");
      96             : 
      97        1293 :     poDriver->pfnOpen = OGRMemDriverOpen;
      98        1293 :     poDriver->pfnCreate = OGRMemDriverCreate;
      99             : 
     100        1293 :     GetGDALDriverManager()->RegisterDriver(poDriver);
     101             : }

Generated by: LCOV version 1.14