This struct provides a namespace for enumerating types used for command‐line option values. See {Enumerators} for details.

Synopsis

Declared in <balcl_optiontype.h>

struct OptionType;

Description

This struct: * Supports a complete set of enumeration operations. * Provides several additional utility functions.

For terminology see bsldoc_glossary.

Types

Name

Description

EnumToType

EnumToType<TYPE_ENUMERATOR>::type is the (C++) type corresponding to the (template parameter) TYPE_ENUMERATOR Enum value. See TypeToEnum for the inverse metafunction.

TypeToEnum

TypeToEnum<TYPE>::value is the Enum value corresponding to the (template parameter) TYPE where TYPE matches one of the typedef`s defined above or `void. See EnumToType for the inverse metafunction.

Type Aliases

Name

Description

Bool

Alias for the bool command‐line option value type.

Char

Alias for the char command‐line option value type.

CharArray

Alias for an array of char command‐line option values.

Date

Alias for the Date command‐line option value type.

DateArray

Alias for an array of Date command‐line option values.

Datetime

Alias for the Datetime command‐line option value type.

DatetimeArray

Alias for an array of Datetime command‐line option values.

Double

Alias for the double command‐line option value type.

DoubleArray

Alias for an array of double command‐line option values.

Int

Alias for the int command‐line option value type.

Int64

Alias for the Int64 command‐line option value type.

Int64Array

Alias for an array of Int64 command‐line option values.

IntArray

Alias for an array of int command‐line option values.

String

Alias for the string command‐line option value type.

StringArray

Alias for an array of string command‐line option values.

Time

Alias for the Time command‐line option value type.

TimeArray

Alias for an array of Time command‐line option values.

Enums

Name

Description

Enum

Enumerates the supported command‐line option value types.

Static Member Functions

Name

Description

fromArrayType

If isArrayType(type) for the specified type, then return the type of the elements of that array type; otherwise return e_VOID.

isArrayType

Return true if the specified type corresponds to an array type, and false otherwise.

print

Write the string representation of the specified enumeration value to the specified output stream, and return a reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). See toAscii for what constitutes the string representation of a OptionType::Enum value.

toArrayType

If there is an array type whose elements have the specified type then return that array type; otherwise return e_VOID. e_VOID == toArrayType(e_BOOL) because an array of boolean values is not allowed as a command‐line‐option type. Note that type == fromArrayType(TYPE) when TYPE != e_VOID is returned.

toAscii

Return the (non‐modifiable) string representation corresponding to the specified enumeration value, if it exists, and a unique (error) string otherwise. The string representation of value matches its corresponding enumerator name with the e_ prefix elided. For example: ` bsl::cout << balcl::OptionType::toAscii( OptionType::e_STRING); ` will print the following on standard output: ` STRING ` Note that specifying a value that does not match any of the enumerators will result in a string representation that is distinct from any of those corresponding to the enumerators, but is otherwise unspecified.

Static Data Members

Name

Description

k_BOOL

Null pointer tag for the Bool option type.

k_CHAR

Null pointer tag for the Char option type.

k_CHAR_ARRAY

Null pointer tag for the CharArray option type.

k_DATE

Null pointer tag for the Date option type.

k_DATETIME

Null pointer tag for the Datetime option type.

k_DATETIME_ARRAY

Null pointer tag for the DatetimeArray option type.

k_DATE_ARRAY

Null pointer tag for the DateArray option type.

k_DOUBLE

Null pointer tag for the Double option type.

k_DOUBLE_ARRAY

Null pointer tag for the DoubleArray option type.

k_INT

Null pointer tag for the Int option type.

k_INT64

Null pointer tag for the Int64 option type.

k_INT64_ARRAY

Null pointer tag for the Int64Array option type.

k_INT_ARRAY

Null pointer tag for the IntArray option type.

k_STRING

Null pointer tag for the String option type.

k_STRING_ARRAY

Null pointer tag for the StringArray option type.

k_TIME

Null pointer tag for the Time option type.

k_TIME_ARRAY

Null pointer tag for the TimeArray option type.

Created with MrDocs