LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_info.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 6 6 100.0 %
Date: 2026-03-13 03:16:58 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          18 :     bool CanBeLastStep() const override
      36             :     {
      37          18 :         return true;
      38             :     }
      39             : 
      40             :   private:
      41             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      42             : 
      43             :     std::vector<std::string> m_layerNames{};
      44             :     bool m_listFeatures = false;
      45             :     bool m_summaryOnly = false;
      46             :     std::string m_sql{};
      47             :     std::string m_where{};
      48             :     std::string m_dialect{};
      49             :     int m_fid = -1;
      50             :     int m_limit = 0;
      51             : };
      52             : 
      53             : /************************************************************************/
      54             : /*                  GDALVectorInfoAlgorithmStandalone                   */
      55             : /************************************************************************/
      56             : 
      57          66 : class GDALVectorInfoAlgorithmStandalone final : public GDALVectorInfoAlgorithm
      58             : {
      59             :   public:
      60          33 :     GDALVectorInfoAlgorithmStandalone()
      61          33 :         : GDALVectorInfoAlgorithm(/* standaloneStep = */ true)
      62             :     {
      63          33 :     }
      64             : 
      65             :     ~GDALVectorInfoAlgorithmStandalone() override;
      66             : };
      67             : 
      68             : //! @endcond
      69             : 
      70             : #endif

Generated by: LCOV version 1.14