|
GDAL
|
Argument declaration. More...
#include <gdalalgorithm_cpp.h>
Public Member Functions | |
| GDALAlgorithmArgDecl (const std::string &longName, char chShortName, const std::string &description, GDALAlgorithmArgType type) | |
| Constructor. | |
| GDALAlgorithmArgDecl & | AddAlias (const std::string &alias) |
| Declare an alias. | |
| GDALAlgorithmArgDecl & | AddShortNameAlias (char shortNameAlias) |
| Declare a shortname alias. | |
| GDALAlgorithmArgDecl & | AddHiddenAlias (const std::string &alias) |
| Declare an hidden alias (i.e. | |
| GDALAlgorithmArgDecl & | SetPositional () |
| Declare that the argument is positional. | |
| GDALAlgorithmArgDecl & | SetRequired () |
| Declare that the argument is required. | |
| GDALAlgorithmArgDecl & | SetMetaVar (const std::string &metaVar) |
| Declare the "meta-var" hint. | |
| GDALAlgorithmArgDecl & | SetCategory (const std::string &category) |
| Declare the argument category: GAAC_COMMON, GAAC_BASE, GAAC_ADVANCED, GAAC_ESOTERIC or a custom category. | |
| template<class T> | |
| GDALAlgorithmArgDecl & | SetDefault (const T &value) |
| Declare a default value for the argument. | |
| GDALAlgorithmArgDecl & | SetDefault (const char *value) |
| Declare a default value for the argument. | |
| GDALAlgorithmArgDecl & | SetMinCount (int count) |
| Declare the minimum number of values for the argument. | |
| GDALAlgorithmArgDecl & | SetMaxCount (int count) |
| Declare the maximum number of values for the argument. | |
| GDALAlgorithmArgDecl & | SetDisplayHintAboutRepetition (bool displayHint) |
| Declare whether in --help message one should display hints about the minimum/maximum number of values. | |
| GDALAlgorithmArgDecl & | SetPackedValuesAllowed (bool allowed) |
| Declares whether, for list type of arguments, several values, comma separated, may be specified. | |
| GDALAlgorithmArgDecl & | SetRepeatedArgAllowed (bool allowed) |
| Declares whether, for list type of arguments, the argument may be repeated. | |
| template<typename T, typename... U, typename std::enable_if<!std::is_same_v< T, std::vector< std::string > & >, bool >::type = true> | |
| GDALAlgorithmArgDecl & | SetChoices (T &&first, U &&...rest) |
| Declares the allowed values (as strings) for the argument. | |
| GDALAlgorithmArgDecl & | SetChoices (const std::vector< std::string > &choices) |
| Declares the allowed values (as strings) for the argument. | |
| GDALAlgorithmArgDecl & | SetMinValueIncluded (double min) |
| Set the minimum (included) value allowed. | |
| GDALAlgorithmArgDecl & | SetMinValueExcluded (double min) |
| Set the minimum (excluded) value allowed. | |
| GDALAlgorithmArgDecl & | SetMaxValueIncluded (double max) |
| Set the maximum (included) value allowed. | |
| GDALAlgorithmArgDecl & | SetMaxValueExcluded (double max) |
| Set the maximum (excluded) value allowed. | |
| GDALAlgorithmArgDecl & | SetMinCharCount (int count) |
| Sets the minimum number of characters (for arguments of type GAAT_STRING and GAAT_STRING_LIST). | |
| template<typename T, typename... U> | |
| GDALAlgorithmArgDecl & | SetHiddenChoices (T &&first, U &&...rest) |
| Declares the, hidden, allowed values (as strings) for the argument. | |
| GDALAlgorithmArgDecl & | SetHiddenForCLI (bool hiddenForCLI=true) |
| Declare that the argument must not be mentioned in CLI usage. | |
| GDALAlgorithmArgDecl & | SetHiddenForAPI (bool hiddenForAPI=true) |
| Declare that the argument is hidden in the context of an API use. | |
| GDALAlgorithmArgDecl & | SetHidden () |
| Declare that the argument is hidden. | |
| GDALAlgorithmArgDecl & | SetIsInput (bool isInput=true) |
| Indicate whether the value of the argument is read-only during the execution of the algorithm. | |
| GDALAlgorithmArgDecl & | SetIsOutput (bool isOutput=true) |
| Indicate whether (at least part of) the value of the argument is set during the execution of the algorithm. | |
| GDALAlgorithmArgDecl & | SetMutualExclusionGroup (const std::string &group) |
| Set the name of the mutual exclusion group to which this argument belongs to. | |
| GDALAlgorithmArgDecl & | AddMetadataItem (const std::string &name, const std::vector< std::string > &values) |
| Set user-defined metadata item. | |
| GDALAlgorithmArgDecl & | SetReadFromFileAtSyntaxAllowed () |
| Set that this (string) argument accepts the @filename syntax to mean that the content of the specified file should be used as the value of the argument. | |
| GDALAlgorithmArgDecl & | SetRemoveSQLCommentsEnabled () |
| Sets that SQL comments must be removed from a (string) argument. | |
| GDALAlgorithmArgDecl & | SetAutoOpenDataset (bool autoOpen) |
| Sets whether the dataset should be opened automatically by GDALAlgorithm. | |
| GDALAlgorithmArgDecl & | SetUserProvided () |
| Declares that this argument has been created on-the-fly from user-provided argument. | |
| const std::string & | GetName () const |
| Return the (long) name. | |
| const std::string & | GetShortName () const |
| Return the short name, or empty string if there is none. | |
| const std::vector< std::string > & | GetAliases () const |
| Return the aliases (potentially none). | |
| const std::vector< char > & | GetShortNameAliases () const |
| Return the shortname aliases (potentially none). | |
| const std::string & | GetDescription () const |
| Return the description. | |
| const std::string & | GetMetaVar () const |
| Return the "meta-var" hint. | |
| const std::string & | GetCategory () const |
| Return the argument category: GAAC_COMMON, GAAC_BASE, GAAC_ADVANCED, GAAC_ESOTERIC or a custom category. | |
| GDALAlgorithmArgType | GetType () const |
| Return the type. | |
| const std::vector< std::string > & | GetChoices () const |
| Return the allowed values (as strings) for the argument. | |
| const std::vector< std::string > & | GetHiddenChoices () const |
| Return the allowed hidden values (as strings) for the argument. | |
| std::pair< double, bool > | GetMinValue () const |
| Return the minimum value and whether it is included. | |
| std::pair< double, bool > | GetMaxValue () const |
| Return the maximum value and whether it is included. | |
| int | GetMinCharCount () const |
| Return the minimum number of characters (for arguments of type GAAT_STRING and GAAT_STRING_LIST). | |
| bool | IsRequired () const |
| Return whether the argument is required. | |
| int | GetMinCount () const |
| Return the minimum number of values for the argument. | |
| int | GetMaxCount () const |
| Return the maximum number of values for the argument. | |
| bool | GetDisplayHintAboutRepetition () const |
| Returns whether in --help message one should display hints about the minimum/maximum number of values. | |
| bool | GetPackedValuesAllowed () const |
| Return whether, for list type of arguments, several values, space separated, may be specified. | |
| bool | GetRepeatedArgAllowed () const |
| Return whether, for list type of arguments, the argument may be repeated. | |
| bool | IsPositional () const |
| Return if the argument is a positional one. | |
| bool | HasDefaultValue () const |
| Return if the argument has a declared default value. | |
| bool | IsHidden () const |
| Return whether the argument is hidden. | |
| bool | IsHiddenForCLI () const |
| Return whether the argument must not be mentioned in CLI usage. | |
| bool | IsOnlyForCLI () const |
| Return whether the argument is only for CLI usage. | |
| bool | IsHiddenForAPI () const |
| Return whether the argument is hidden for API usage For example "--help". | |
| bool | IsInput () const |
| Indicate whether the value of the argument is read-only during the execution of the algorithm. | |
| bool | IsOutput () const |
| Return whether (at least part of) the value of the argument is set during the execution of the algorithm. | |
| const std::string & | GetMutualExclusionGroup () const |
| Return the name of the mutual exclusion group to which this argument belongs to, or empty string if it does not belong to any exclusion group. | |
| bool | IsReadFromFileAtSyntaxAllowed () const |
| Return if this (string) argument accepts the @filename syntax to mean that the content of the specified file should be used as the value of the argument. | |
| bool | IsRemoveSQLCommentsEnabled () const |
| Returns whether SQL comments must be removed from a (string) argument. | |
| bool | AutoOpenDataset () const |
| Returns whether the dataset should be opened automatically by GDALAlgorithm. | |
| bool | IsUserProvided () const |
| Returns whether the argument has been user-provided. | |
| const std::map< std::string, std::vector< std::string > > | GetMetadata () const |
| Get user-defined metadata. | |
| const std::vector< std::string > * | GetMetadataItem (const std::string &name) const |
| Get user-defined metadata by item name. | |
| template<class T> | |
| const T & | GetDefault () const |
| Return the default value of the argument. | |
| GDALArgDatasetType | GetDatasetType () const |
| Get which type of dataset is allowed / generated. | |
| void | SetDatasetType (GDALArgDatasetType type) |
| Set which type of dataset is allowed / generated. | |
| int | GetDatasetInputFlags () const |
| Indicates which components among name and dataset are accepted as input, when this argument serves as an input. | |
| int | GetDatasetOutputFlags () const |
| Indicates which components among name and dataset are modified, when this argument serves as an output. | |
| void | SetDatasetInputFlags (int flags) |
| Set which components among name and dataset are accepted as input, when this argument serves as an input. | |
| void | SetDatasetOutputFlags (int flags) |
| Set which components among name and dataset are modified when this argument serves as an output. | |
Static Public Attributes | |
| static constexpr int | UNBOUNDED = std::numeric_limits<int>::max() |
| Special value for the SetMaxCount() / GetMaxCount() to indicate unlimited number of values. | |
Argument declaration.
It does not hold its value.
| GDALAlgorithmArgDecl::GDALAlgorithmArgDecl | ( | const std::string & | longName, |
| char | chShortName, | ||
| const std::string & | description, | ||
| GDALAlgorithmArgType | type ) |
Constructor.
| longName | Long name. Must be 2 characters at least. Must not start with dash. |
| chShortName | 1-letter short name, or NUL character |
| description | Description. |
| type | Type of the argument. |
|
inline |
Declare an alias.
Must be 2 characters at least.
|
inline |
Declare an hidden alias (i.e.
not exposed in usage). Must be 2 characters at least.
|
inline |
Returns whether the dataset should be opened automatically by GDALAlgorithm.
Only applies to GAAT_DATASET and GAAT_DATASET_LIST.
|
inline |
Return the allowed values (as strings) for the argument.
Only honored for GAAT_STRING and GAAT_STRING_LIST types.
|
inline |
Indicates which components among name and dataset are accepted as input, when this argument serves as an input.
If the GADV_NAME bit is set, it indicates a dataset name is accepted as input. If the GADV_OBJECT bit is set, it indicates a dataset object is accepted as input. If both bits are set, the algorithm can accept either a name or a dataset object. Only applies to arguments of type GAAT_DATASET or GAAT_DATASET_LIST.
|
inline |
Indicates which components among name and dataset are modified, when this argument serves as an output.
If the GADV_NAME bit is set, it indicates a dataset name is generated as output (that is the algorithm will generate the name. Rarely used). If the GADV_OBJECT bit is set, it indicates a dataset object is generated as output, and available for use after the algorithm has completed. Only applies to arguments of type GAAT_DATASET or GAAT_DATASET_LIST.
|
inline |
Get which type of dataset is allowed / generated.
Binary-or combination of GDAL_OF_RASTER, GDAL_OF_VECTOR and GDAL_OF_MULTIDIM_RASTER, possibly combined with GDAL_OF_UPDATE. Only applies to arguments of type GAAT_DATASET or GAAT_DATASET_LIST.
|
inline |
Return the default value of the argument.
Must be called with T consistent of the type of the algorithm, and only if HasDefaultValue() is true. Valid T types are:
|
inline |
Returns whether in --help message one should display hints about the minimum/maximum number of values.
Defaults to true.
|
inline |
Return the allowed hidden values (as strings) for the argument.
Only honored for GAAT_STRING and GAAT_STRING_LIST types.
|
inline |
Return the maximum number of values for the argument.
Defaults to 1 for scalar types, and UNBOUNDED for list types. Only applies to list type of arguments.
|
inline |
Return the "meta-var" hint.
By default, the meta-var value is the long name of the argument in upper case.
|
inline |
Return the minimum number of values for the argument.
Defaults to 0. Only applies to list type of arguments.
|
inline |
Return whether, for list type of arguments, several values, space separated, may be specified.
That is "--foo=bar,baz". The default is true.
|
inline |
Return whether, for list type of arguments, the argument may be repeated.
That is "--foo=bar --foo=baz". The default is true.
|
inline |
Return whether the argument must not be mentioned in CLI usage.
For example, "output-value" for "gdal raster info", which is only meant when the algorithm is used from a non-CLI context.
|
inline |
Indicate whether the value of the argument is read-only during the execution of the algorithm.
Default is true.
|
inline |
Return whether the argument is only for CLI usage.
For example "--help" This is an alias for IsHiddenForAPI()
|
inline |
Return whether (at least part of) the value of the argument is set during the execution of the algorithm.
For example, "output-value" for "gdal raster info" Default is false. An argument may return both IsInput() and IsOutput() as true. For example the "gdal raster convert" algorithm consumes the dataset name of its "output" argument, and sets the dataset object during its execution.
|
inline |
Return whether the argument is required.
Defaults to false.
|
inline |
Sets whether the dataset should be opened automatically by GDALAlgorithm.
Only applies to GAAT_DATASET and GAAT_DATASET_LIST.
|
inline |
Declares the allowed values (as strings) for the argument.
Only honored for GAAT_STRING and GAAT_STRING_LIST types.
|
inline |
Declares the allowed values (as strings) for the argument.
Only honored for GAAT_STRING and GAAT_STRING_LIST types.
|
inline |
Set which components among name and dataset are accepted as input, when this argument serves as an input.
Only applies to arguments of type GAAT_DATASET or GAAT_DATASET_LIST.
|
inline |
Set which components among name and dataset are modified when this argument serves as an output.
Only applies to arguments of type GAAT_DATASET or GAAT_DATASET_LIST.
|
inline |
Set which type of dataset is allowed / generated.
Binary-or combination of GDAL_OF_RASTER, GDAL_OF_VECTOR and GDAL_OF_MULTIDIM_RASTER. Only applies to arguments of type GAAT_DATASET or GAAT_DATASET_LIST.
|
inline |
Declare whether in --help message one should display hints about the minimum/maximum number of values.
Defaults to true.
|
inline |
Declare that the argument is hidden.
Default is no. This is equivalent to calling SetHiddenForCLI() and SetHiddenForAPI()
|
inline |
Declares the, hidden, allowed values (as strings) for the argument.
Only honored for GAAT_STRING and GAAT_STRING_LIST types.
|
inline |
Declare that the argument is hidden in the context of an API use.
Said otherwise, if it is only for CLI usage. For example "--help"
|
inline |
Declare that the argument must not be mentioned in CLI usage.
For example, "output-value" for "gdal raster info", which is only meant when the algorithm is used from a non-CLI context.
|
inline |
Indicate whether the value of the argument is read-only during the execution of the algorithm.
Default is true.
|
inline |
Indicate whether (at least part of) the value of the argument is set during the execution of the algorithm.
For example, "output-value" for "gdal raster info" Default is false. An argument may return both IsInput() and IsOutput() as true. For example the "gdal raster convert" algorithm consumes the dataset name of its "output" argument, and sets the dataset object during its execution.
| GDALAlgorithmArgDecl & GDALAlgorithmArgDecl::SetMaxCount | ( | int | count | ) |
Declare the maximum number of values for the argument.
Defaults to 1 for scalar types, and UNBOUNDED for list types. Only applies to list type of arguments.
|
inline |
Declare the "meta-var" hint.
By default, the meta-var value is the long name of the argument in upper case.
| GDALAlgorithmArgDecl & GDALAlgorithmArgDecl::SetMinCount | ( | int | count | ) |
Declare the minimum number of values for the argument.
Defaults to 0. Only applies to list type of arguments. Setting it to non-zero does not make the argument required. It just sets the minimum number of values when it is specified. To also make it required, use SetRequired().
|
inline |
Set the minimum (excluded) value allowed.
Only taken into account on GAAT_INTEGER, GAAT_INTEGER_LIST, GAAT_REAL and GAAT_REAL_LIST arguments.
|
inline |
Set the minimum (included) value allowed.
Only taken into account on GAAT_INTEGER, GAAT_INTEGER_LIST, GAAT_REAL and GAAT_REAL_LIST arguments.
|
inline |
Set the name of the mutual exclusion group to which this argument belongs to.
At most one argument in a group can be specified.
|
inline |
Declares whether, for list type of arguments, several values, comma separated, may be specified.
That is "--foo=bar,baz". The default is true.
|
inline |
Declare that the argument is positional.
Typically input / output files
|
inline |
Declares whether, for list type of arguments, the argument may be repeated.
That is "--foo=bar --foo=baz". The default is true.
|
inline |
Declare that the argument is required.
Default is no