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 26 : bool CanBeLastStep() const override 36 : { 37 26 : 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_limit = 0; 50 : }; 51 : 52 : /************************************************************************/ 53 : /* GDALVectorInfoAlgorithmStandalone */ 54 : /************************************************************************/ 55 : 56 54 : class GDALVectorInfoAlgorithmStandalone final : public GDALVectorInfoAlgorithm 57 : { 58 : public: 59 27 : GDALVectorInfoAlgorithmStandalone() 60 27 : : GDALVectorInfoAlgorithm(/* standaloneStep = */ true) 61 : { 62 27 : } 63 : 64 : ~GDALVectorInfoAlgorithmStandalone() override; 65 : }; 66 : 67 : //! @endcond 68 : 69 : #endif