LCOV - code coverage report
Current view: top level - apps - gdalalg_convert.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 9 9 100.0 %
Date: 2025-06-19 12:30:01 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "convert" 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             : #include "cpl_error.h"
      14             : #include "gdalalgorithm.h"
      15             : #include "gdalalg_raster_convert.h"
      16             : #include "gdalalg_vector_convert.h"
      17             : #include "gdalalg_dispatcher.h"
      18             : #include "gdal_priv.h"
      19             : 
      20             : /************************************************************************/
      21             : /*                        GDALConvertAlgorithm                          */
      22             : /************************************************************************/
      23             : 
      24          18 : class GDALConvertAlgorithm
      25             :     : public GDALDispatcherAlgorithm<GDALRasterConvertAlgorithm,
      26             :                                      GDALVectorConvertAlgorithm>
      27             : {
      28             :   public:
      29             :     static constexpr const char *NAME = "convert";
      30             :     static constexpr const char *DESCRIPTION =
      31             :         "Convert a dataset (shortcut for 'gdal raster convert' or "
      32             :         "'gdal vector convert').";
      33             :     static constexpr const char *HELP_URL = "/programs/gdal_convert.html";
      34             : 
      35           9 :     GDALConvertAlgorithm()
      36           9 :         : GDALDispatcherAlgorithm(NAME, DESCRIPTION, HELP_URL)
      37             :     {
      38             :         // only for the help message
      39           9 :         AddProgressArg();
      40           9 :         AddOutputFormatArg(&m_format);
      41           9 :         AddInputDatasetArg(&m_inputDataset);
      42           9 :         AddOutputDatasetArg(&m_outputDataset);
      43             : 
      44             :         m_longDescription = "For all options, run 'gdal raster convert --help' "
      45           9 :                             "or 'gdal vector convert --help'";
      46           9 :     }
      47             : 
      48             :     ~GDALConvertAlgorithm() override;
      49             : 
      50             :   private:
      51             :     std::string m_format{};
      52             :     GDALArgDatasetValue m_inputDataset{};
      53             :     GDALArgDatasetValue m_outputDataset{};
      54             : };
      55             : 
      56             : GDALConvertAlgorithm::~GDALConvertAlgorithm() = default;
      57             : 
      58             : GDAL_STATIC_REGISTER_ALG(GDALConvertAlgorithm);

Generated by: LCOV version 1.14