[#BloombergLP-balcl-CommandLineOptionsHandle] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balcl.adoc[balcl]::CommandLineOptionsHandle :relfileprefix: ../../ :mrdocs: This class provides access to the parsed options (if any) of its creating `CommandLine` object. The behavior is undefined if any of the methods of this class (accessors all) are invoked after a subsequent invocation of the `parse` method of the creating object or after the destruction of the creating object. == Synopsis Declared in `<balcl_commandline.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class CommandLineOptionsHandle; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balcl/CommandLineOptionsHandle/index.adoc[`index`] | Return the position in this handle object of the option having the specified `name`, and ‐1 if the handle has no option of that name. Note that, on success, the return values are in the range `[0 .. numOptions() ‐ 1]`. | xref:BloombergLP/balcl/CommandLineOptionsHandle/name.adoc[`name`] | Return the name of the option at the specified `index`. The behavior is undefined unless `index < numOptions()`. | xref:BloombergLP/balcl/CommandLineOptionsHandle/numOptions.adoc[`numOptions`] | Return the number of parsed options. | xref:BloombergLP/balcl/CommandLineOptionsHandle/the-02.adoc[`the`] | `the` overloads | xref:BloombergLP/balcl/CommandLineOptionsHandle/theBool.adoc[`theBool`] | Return the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bool` (i.e., `OptionType::e_BOOL == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theChar.adoc[`theChar`] | Return the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `char` (i.e., `OptionType::e_CHAR == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theCharArray.adoc[`theCharArray`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsl::vector<char>` (i.e., `OptionType::e_CHAR_ARRAY == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theDate.adoc[`theDate`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bdlt::Date` (i.e., `OptionType::e_DATE == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theDateArray.adoc[`theDateArray`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsl::vector<bdlt::Date>` (i.e., `OptionType::e_DATE_ARRAY == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theDatetime.adoc[`theDatetime`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bdlt::Datetime` (i.e., `OptionType::e_DATETIME == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theDatetimeArray.adoc[`theDatetimeArray`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsl::vector<bdlt::Datetime>` (i.e., `OptionType::e_DATETIME_ARRAY == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theDouble.adoc[`theDouble`] | Return the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `double` (i.e., `OptionType::e_DOUBLE == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theDoubleArray.adoc[`theDoubleArray`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsl::vector<double>` (i.e., `OptionType::e_DOUBLE_ARRAY == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theInt.adoc[`theInt`] | Return the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `int` (i.e., `OptionType::e_INT == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theInt64.adoc[`theInt64`] | Return the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsls::Types::Int64` (i.e., `OptionType::e_INT64 == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theInt64Array.adoc[`theInt64Array`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsl::vector<bsls::Types::Int64>` (i.e., `OptionType::e_INT64_ARRAY == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theIntArray.adoc[`theIntArray`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsl::vector<int>` (i.e., `OptionType::e_INT_ARRAY == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theString.adoc[`theString`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsl::string` (i.e., `OptionType::e_STRING == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theStringArray.adoc[`theStringArray`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsl::vector<bsl::string>` (i.e., `OptionType::e_STRING_ARRAY == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theTime.adoc[`theTime`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bdlt::Time` (i.e., `OptionType::e_TIME == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/theTimeArray.adoc[`theTimeArray`] | Return a `const` reference to the value of the option having the specified `name`. The behavior is undefined unless this handle object has a `name` option (i.e., `0 <= index(name)`), the option has type `bsl::vector<bdlt::TIME>` (i.e., `OptionType::e_TIME_ARRAY == type(name)`), and the option has a value (i.e., `false == value(name).isNull()`). | xref:BloombergLP/balcl/CommandLineOptionsHandle/type-0e.adoc[`type`] | `type` overloads | xref:BloombergLP/balcl/CommandLineOptionsHandle/value-0f.adoc[`value`] | `value` overloads |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/balcl/operator_not_eq-008.adoc[BloombergLP::balcl::operator!=]` | Return `true` if the specified `lhs` and `rhs` do not have the same value, and `false` otherwise. Two `CommandLineOptionsHandle` objects do not have the same value if they do not have the same `numOptions` or if any of their options differ in `name`, `type`, or 'value (or null state). | `xref:BloombergLP/balcl/operator_eq-0e.adoc[BloombergLP::balcl::operator==]` | Return `true` if the specified `lhs` and `rhs` have the same value, and `false` otherwise. Two `CommandLineOptionsHandle` objects have the same value if they have the same `numOptions` and each of those options have the same `name`, `type`, and `value` or are in the null state. | `xref:BloombergLP/balcl/CommandLine.adoc[BloombergLP::balcl::CommandLine]` | This value‐semantic `class` parses, validates, and provides access to command‐line arguments. The constructor takes the specification describing the command‐line arguments. Once created, `printUsage` can be invoked to print the usage syntax. The `parse` method takes command‐line arguments and validates them against the specification provided at creation, writing a suitable message to an optionally‐specified stream in case of a parsing error. Once parsed, options and values can be accessed using various accessors. The class has a set of `theType` methods (e.g., `theString`, `theInt`) that provide access, by name, to the value of the indicated option. It is also possible to link a variable with an option in the specification; doing so will cause the variable to be loaded with the option value once `parse` has been invoked. The `options` method returns a `balcl::CommandLineOptionsHandle` object referring to the option names and their values. A similar but different method, `specifiedOptions`, is suitable for overwriting other configuration parameters (possibly obtained from a configuration file). |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#