LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_info.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 13 13 100.0 %
Date: 2025-08-01 10:10:57 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "vector info" subcommand
       5             :  * Author:   Even Rouault <even dot rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2024, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_VECTOR_INFO_INCLUDED
      14             : #define GDALALG_VECTOR_INFO_INCLUDED
      15             : 
      16             : #include "gdalalg_vector_pipeline.h"
      17             : 
      18             : //! @cond Doxygen_Suppress
      19             : 
      20             : /************************************************************************/
      21             : /*                       GDALVectorInfoAlgorithm                        */
      22             : /************************************************************************/
      23             : 
      24             : class GDALVectorInfoAlgorithm /* non final */
      25             :     : public GDALVectorPipelineStepAlgorithm
      26             : {
      27             :   public:
      28             :     static constexpr const char *NAME = "info";
      29             :     static constexpr const char *DESCRIPTION =
      30             :         "Return information on a vector dataset.";
      31             :     static constexpr const char *HELP_URL = "/programs/gdal_vector_info.html";
      32             : 
      33             :     explicit GDALVectorInfoAlgorithm(bool standaloneStep = false);
      34             : 
      35           6 :     void SetDataset(GDALDataset *poDS)
      36             :     {
      37           6 :         auto arg = GetArg(GDAL_ARG_NAME_INPUT);
      38           6 :         if (arg && poDS)
      39             :         {
      40           6 :             auto &val = arg->Get<std::vector<GDALArgDatasetValue>>();
      41           6 :             val.resize(1);
      42           6 :             val[0].Set(poDS);
      43           6 :             arg->NotifyValueSet();
      44           6 :             arg->SetSkipIfAlreadySet();
      45             :         }
      46           6 :     }
      47             : 
      48             :   private:
      49             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      50             : 
      51             :     std::vector<std::string> m_layerNames{};
      52             :     bool m_listFeatures = false;
      53             :     bool m_summaryOnly = false;
      54             :     std::string m_sql{};
      55             :     std::string m_where{};
      56             :     std::string m_dialect{};
      57             : };
      58             : 
      59             : /************************************************************************/
      60             : /*                 GDALVectorInfoAlgorithmStandalone                    */
      61             : /************************************************************************/
      62             : 
      63          48 : class GDALVectorInfoAlgorithmStandalone final : public GDALVectorInfoAlgorithm
      64             : {
      65             :   public:
      66          24 :     GDALVectorInfoAlgorithmStandalone()
      67          24 :         : GDALVectorInfoAlgorithm(/* standaloneStep = */ true)
      68             :     {
      69          24 :     }
      70             : 
      71             :     ~GDALVectorInfoAlgorithmStandalone() override;
      72             : };
      73             : 
      74             : //! @endcond
      75             : 
      76             : #endif

Generated by: LCOV version 1.14