LCOV - code coverage report
Current view: top level - apps - gdalalg_convert.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 8 8 100.0 %
Date: 2025-05-15 18:21:54 Functions: 1 1 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             : 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           8 :     GDALConvertAlgorithm()
      36           8 :         : GDALDispatcherAlgorithm(NAME, DESCRIPTION, HELP_URL)
      37             :     {
      38             :         // only for the help message
      39           8 :         AddProgressArg();
      40           8 :         AddOutputFormatArg(&m_format);
      41           8 :         AddInputDatasetArg(&m_inputDataset);
      42           8 :         AddOutputDatasetArg(&m_outputDataset);
      43             : 
      44             :         m_longDescription = "For all options, run 'gdal raster convert --help' "
      45           8 :                             "or 'gdal vector convert --help'";
      46           8 :     }
      47             : 
      48             :   private:
      49             :     std::string m_format{};
      50             :     GDALArgDatasetValue m_inputDataset{};
      51             :     GDALArgDatasetValue m_outputDataset{};
      52             : };
      53             : 
      54             : GDAL_STATIC_REGISTER_ALG(GDALConvertAlgorithm);

Generated by: LCOV version 1.14