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

Generated by: LCOV version 1.14