PCL
|
A command-line argument. More...
#include <Arguments.h>
Public Member Functions | |
Argument () | |
Argument (const Argument &)=default | |
Argument (const char16_type *argv) | |
Argument (const String &argv) | |
Argument (const String &argv, const StringList &items) | |
String | Id () const |
bool | IsItemList () const |
bool | IsLiteral () const |
bool | IsNumeric () const |
bool | IsString () const |
bool | IsSwitch () const |
bool | IsValid () const |
StringList & | Items () |
const StringList & | Items () const |
double | NumericValue () const |
Argument & | operator= (const Argument &)=default |
bool | operator== (const Argument &x) const |
String | StringValue () const |
bool | SwitchState () const |
String | Token () const |
Argument implements a command-line argument that can be used with the ParseArguments() function.
Command-line arguments can be parametric and non-parametric arguments (also known as item arguments).
1. Parametric Arguments
Parametric arguments specify modifiers or parameter values of different types to their receiving processes. Syntactically, parametric arguments are formalized as:
-<arg_id>[<arg_value>]
where the starting hypen character '-' is the standard parameter prefix. <arg_id> is the argument identifier and <arg_value> is an optional argument value specification. For example, in the following parametric arguments:
-n=17 –use-all-processors
the argument identifiers are 'n' and '-use-all-processors', respectively, and '=17' is an argument value specification.
We consider four types of parametric arguments: literal, switch, numeric and string arguments.
1.1 Literal Arguments
Literal arguments are parametric arguments that don't have a particular value. They are modifiers that act as functions of their existence. For example, in the following arguments:
-c -x=10 -b="none" –verbose
'-c' and '–verbose' are literal arguments.
1.2 Switch Arguments
Switch arguments are parametric arguments that can only have a boolean enabled/disabled state. Switch arguments are of the form:
-<arg_id>+|-
where the + suffix means 'enabled' and the - suffix means 'disabled'. For example, here are some switch arguments:
-u+ -color- –mySwitchArgument+
It is customary to allow the use of switch arguments also as literal arguments. When switch arguments are used as literal arguments, a default 'enabled' or 'disabled' state is assumed, depending on the functionality and purpose of each argument. When switch arguments can also be literal, they are formalized as:
-<arg_id>[+|-]
indicating that the + and - suffixes are optional.
1.3 Numeric Arguments
A numeric argument has an integer or floating-point numeric value. Numeric arguments are formalized as:
-<arg_id>=<numeric_constant>
where <numeric_constant> is a valid representation of an integer or floating-point real constant, following the applicable syntax rules of the C language. Integer constants can have the '0x' standard prefix to indicate hexadecimal values.
1.4 String Arguments
A string argument has a literal value represented as a string of ISO 8859-1 characters. String arguments are formalized as:
-<arg_id>=<string_constant>
where <string_constant> is any sequence of ISO 8859-1 characters, optionally enclosed by double quotes. For example:
-s=foo -s1="bar"
are two string arguments with 'foo' and 'bar' values, respectively. When the <string_constant> string includes white spaces, the enclosing quotes are not optional, as in:
-aStringArg="this is a string literal"
or otherwise the above sequence would be interpreted as a single string argument (aStringArg=this) and four additional, non-parametric arguments.
2. Non-Parametric Arguments
Non-parametric arguments specify objects that their receiving processes can act on or use in any way. Non-parametric arguments are formalized as:
<arg_value>
where <arg_value> is any sequence of ISO 8859-1 characters. Note that the absence of a standard parameter prefix (the hypen character, '-') characterizes non-parametric arguments. For example, in the following arguments:
-mode="auto" *.js -z foo.scp
'*.js' and 'foo.scp' are two non-parametric arguments.
Each non-parametric argument can be expanded into a list of items. For example, the '*.js' argument above would be expanded into a list of all files with the .js suffix in the current directory, provided that the argument is parsed as a wild file path specification.
Definition at line 195 of file Arguments.h.
|
inline |
Constructs an empty Argument object.
Definition at line 202 of file Arguments.h.
|
inline |
Constructs an Argument object and parses the specified argv string.
Definition at line 210 of file Arguments.h.
References pcl::GenericString< T, R, A >::c_str().
|
inline |
Constructs an Argument object and parses the specified argv string.
Definition at line 218 of file Arguments.h.
|
inline |
Constructs an Argument object and interprets that the specified argv string corresponds to a non-parametric argument corresponding to the items list of items.
Definition at line 228 of file Arguments.h.
|
default |
Copy constructor.
|
inline |
Returns the argument's parameter identifier, if this argument has been parsed and it is a parametric argument, or an empty string otherwise.
Definition at line 290 of file Arguments.h.
|
inline |
Returns true iff this argument has been parsed and it is a non-parametric argument, also known as an item argument.
Definition at line 300 of file Arguments.h.
|
inline |
Returns true iff this argument has been parsed and it is a literal argument.
Definition at line 331 of file Arguments.h.
|
inline |
Returns true iff this argument has been parsed and it is a numeric argument.
Definition at line 358 of file Arguments.h.
|
inline |
Returns true iff this argument has been parsed and it is a string argument.
Definition at line 376 of file Arguments.h.
|
inline |
Returns true iff this argument has been parsed and it is a switch argument.
Definition at line 340 of file Arguments.h.
|
inline |
Returns true iff this argument has successfully parsed a token string.
Definition at line 270 of file Arguments.h.
|
inline |
Returns a reference to the list of items that have been generated after expansion of a non-parametric argument. The returned list can be freely modified, and it's empty if this argument is parametric, or if it has not been parsed yet.
Definition at line 322 of file Arguments.h.
|
inline |
Returns a reference to the (constant) list of items that have been generated after expansion of a non-parametric argument. The returned list cannot be modified, and it's empty if this argument is parametric, or if it has not been parsed yet.
Definition at line 311 of file Arguments.h.
|
inline |
Returns the numeric value of this argument, if it has been parsed and it is a numeric argument, or zero otherwise.
Definition at line 367 of file Arguments.h.
Copy assignment operator. Returns a reference to this object.
|
inline |
Equality operator. Returns true if this Argument object is equal to the specified x instance.
Definition at line 249 of file Arguments.h.
References pcl::ProcessParameterType::IsNumeric().
|
inline |
Returns the string value of this argument, if it has been parsed and it is a string argument, or an empty string otherwise.
Definition at line 385 of file Arguments.h.
|
inline |
Returns the switch state of this argument, if it has been parsed and it is a switch argument, or false otherwise.
Definition at line 349 of file Arguments.h.
|
inline |
Returns the token string corresponding to this argument. The token is the exact string that has been parsed by this Argument instance. If no token has been parsed by this instance, an empty string is returned.
Definition at line 280 of file Arguments.h.