GDAL

gdalalg_main.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: gdal "main" command
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_MAIN_INCLUDED
14#define GDALALG_MAIN_INCLUDED
15
16#include "gdalalgorithm.h"
17
19
20/************************************************************************/
21/* GDALMainAlgorithm */
22/************************************************************************/
23
24 class GDALMainAlgorithm final : public GDALAlgorithm
25{
26 public:
27 static constexpr const char *NAME =
28 GDALGlobalAlgorithmRegistry::ROOT_ALG_NAME;
29 static constexpr const char *DESCRIPTION = "Main gdal entry point.";
30 static constexpr const char *HELP_URL = "/programs/index.html";
31
32 GDALMainAlgorithm();
33
34 bool
35 ParseCommandLineArguments(const std::vector<std::string> &args) override;
36
37 std::string GetUsageForCLI(bool shortUsage,
38 const UsageOptions &usageOptions) const override;
39
40 private:
41 std::unique_ptr<GDALAlgorithm> m_subAlg{};
42 std::string m_output{};
43 bool m_showUsage = true;
44 bool m_drivers = false;
45 bool m_version = false;
46
47 bool RunImpl(GDALProgressFunc, void *) override;
48};
49
51
52#endif // GDALALG_MAIN_INCLUDED
GDALAlgorithm
GDAL algorithm.
Definition gdalalgorithm_cpp.h:2261
GDALAlgorithm::GetUsageForCLI
virtual std::string GetUsageForCLI(bool shortUsage, const UsageOptions &usageOptions=UsageOptions()) const
Return the usage as a string appropriate for command-line interface --help output.
Definition gdalalgorithm.cpp:5909
GDALAlgorithm::ParseCommandLineArguments
virtual bool ParseCommandLineArguments(const std::vector< std::string > &args)
Parse a command line argument, which does not include the algorithm name, to set the value of corresp...
Definition gdalalgorithm.cpp:2003
GDALGlobalAlgorithmRegistry::ROOT_ALG_NAME
static constexpr const char * ROOT_ALG_NAME
Name of the root "gdal" algorithm.
Definition gdalalgorithm_cpp.h:3123