GDAL
Public Member Functions | List of all members
GDALArgumentParser Class Reference

Parse command-line arguments for GDAL utilities. More...

#include <gdalargumentparser.h>

Inheritance diagram for GDALArgumentParser:

Public Member Functions

 GDALArgumentParser (const std::string &program_name, bool bForBinary)
 Constructor.
 
void display_error_and_usage (const std::exception &err)
 Format an exception as an error message and display the program usage.
 
void add_quiet_argument (bool *pVar)
 Add -q/–quiet argument, and store its value in *pVar (if pVar not null)
 
void add_input_format_argument (CPLStringList *pvar)
 Add "-if format_name" argument for input format, and store its value into *pvar.
 
void add_output_format_argument (std::string &var)
 Add "-of format_name" argument for output format, and store its value into var.
 
void add_creation_options_argument (CPLStringList &var)
 Add "-co KEY=VALUE" argument for creation options, and store its value into var.
 
void add_metadata_item_options_argument (CPLStringList &var)
 Add "-mo KEY=VALUE" argument for metadata item options, and store its value into var.
 
void add_open_options_argument (CPLStringList &var)
 Add "-oo KEY=VALUE" argument for open options, and store its value into var.
 
void add_open_options_argument (CPLStringList *pvar)
 Add "-oo KEY=VALUE" argument for open options, and store its value into *pvar.
 
void add_output_type_argument (GDALDataType &eDT)
 Add "-ot data_type" argument for output type, and store its value into eDT.
 
void parse_args_without_binary_name (CSLConstList papszArgs)
 Parse command line arguments, without the initial program name.
 
void parse_args (const CPLStringList &aosArgs)
 Parse command line arguments, with the initial program name.
 
CPLStringList get_non_positional_arguments (const CPLStringList &aosArgs)
 Return the non positional arguments.
 
Argument & add_inverted_logic_flag (const std::string &name, bool *store_into=nullptr, const std::string &help="")
 Add an inverted logic (default true, false when set) flag. More...
 

Detailed Description

Parse command-line arguments for GDAL utilities.

Add helpers over the standard argparse::ArgumentParser class

Since
GDAL 3.9

Member Function Documentation

◆ add_inverted_logic_flag()

Argument & GDALArgumentParser::add_inverted_logic_flag ( const std::string &  name,
bool *  store_into = nullptr,
const std::string &  help = "" 
)

Add an inverted logic (default true, false when set) flag.

Parameters
nameflag name
store_intooptional pointer to a bool variable where to store the value
helpoptional help text

The documentation for this class was generated from the following files: