[#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&period; 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&period;

== Synopsis

Declared in `&lt;balcl&lowbar;commandline&period;h&gt;`

[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 &hyphen;1 if the handle has no option of that name&period; Note that, on success, the return values are in the range `&lsqb;0 &period;&period; numOptions() &hyphen; 1&rsqb;`&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/name.adoc[`name`] 
| Return the name of the option at the specified `index`&period; The behavior is undefined unless `index &lt; numOptions()`&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/numOptions.adoc[`numOptions`] 
| Return the number of parsed options&period;
| 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`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bool` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;BOOL &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theChar.adoc[`theChar`] 
| Return the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `char` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;CHAR &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theCharArray.adoc[`theCharArray`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsl&colon;&colon;vector&lt;char&gt;` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;CHAR&lowbar;ARRAY &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theDate.adoc[`theDate`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bdlt&colon;&colon;Date` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;DATE &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theDateArray.adoc[`theDateArray`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsl&colon;&colon;vector&lt;bdlt&colon;&colon;Date&gt;` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;DATE&lowbar;ARRAY &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theDatetime.adoc[`theDatetime`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bdlt&colon;&colon;Datetime` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;DATETIME &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theDatetimeArray.adoc[`theDatetimeArray`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsl&colon;&colon;vector&lt;bdlt&colon;&colon;Datetime&gt;` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;DATETIME&lowbar;ARRAY &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theDouble.adoc[`theDouble`] 
| Return the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `double` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;DOUBLE &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theDoubleArray.adoc[`theDoubleArray`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsl&colon;&colon;vector&lt;double&gt;` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;DOUBLE&lowbar;ARRAY &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theInt.adoc[`theInt`] 
| Return the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `int` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;INT &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theInt64.adoc[`theInt64`] 
| Return the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsls&colon;&colon;Types&colon;&colon;Int64` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;INT64 &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theInt64Array.adoc[`theInt64Array`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsl&colon;&colon;vector&lt;bsls&colon;&colon;Types&colon;&colon;Int64&gt;` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;INT64&lowbar;ARRAY &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theIntArray.adoc[`theIntArray`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsl&colon;&colon;vector&lt;int&gt;` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;INT&lowbar;ARRAY &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theString.adoc[`theString`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsl&colon;&colon;string` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;STRING &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theStringArray.adoc[`theStringArray`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsl&colon;&colon;vector&lt;bsl&colon;&colon;string&gt;` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;STRING&lowbar;ARRAY &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theTime.adoc[`theTime`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bdlt&colon;&colon;Time` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;TIME &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| xref:BloombergLP/balcl/CommandLineOptionsHandle/theTimeArray.adoc[`theTimeArray`] 
| Return a `const` reference to the value of the option having the specified `name`&period; The behavior is undefined unless this handle object has a `name` option (i&period;e&period;, `0 &lt;&equals; index(name)`), the option has type `bsl&colon;&colon;vector&lt;bdlt&colon;&colon;TIME&gt;` (i&period;e&period;, `OptionType&colon;&colon;e&lowbar;TIME&lowbar;ARRAY &equals;&equals; type(name)`), and the option has a value (i&period;e&period;, `false &equals;&equals; value(name)&period;isNull()`)&period;
| 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!&equals;]`
| Return `true` if the specified `lhs` and `rhs` do not have the same value, and `false` otherwise&period; 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 &apos;value (or null state)&period;
| `xref:BloombergLP/balcl/operator_eq-0e.adoc[BloombergLP::balcl::operator&equals;&equals;]`
| Return `true` if the specified `lhs` and `rhs` have the same value, and `false` otherwise&period; 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&period;
| `xref:BloombergLP/balcl/CommandLine.adoc[BloombergLP::balcl::CommandLine]`
| This value&hyphen;semantic `class` parses, validates, and provides access to command&hyphen;line arguments&period; The constructor takes the specification describing the command&hyphen;line arguments&period; Once created, `printUsage` can be invoked to print the usage syntax&period; The `parse` method takes command&hyphen;line arguments and validates them against the specification provided at creation, writing a suitable message to an optionally&hyphen;specified stream in case of a parsing error&period; Once parsed, options and values can be accessed using various accessors&period; The class has a set of `theType` methods (e&period;g&period;, `theString`, `theInt`) that provide access, by name, to the value of the indicated option&period; It is also possible to link a variable with an option in the specification&semi; doing so will cause the variable to be loaded with the option value once `parse` has been invoked&period; The `options` method returns a `balcl&colon;&colon;CommandLineOptionsHandle` object referring to the option names and their values&period; A similar but different method, `specifiedOptions`, is suitable for overwriting other configuration parameters (possibly obtained from a configuration file)&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
