This struct is a simple attribute class that describes the information associated with an option, namely the associated tag (as a string, from which the short and long tags are extracted), the option name, the description used in printing usage, and optional associated TypeInfo and OccurrenceInfo objects.

Synopsis

Declared in <balcl_optioninfo.h>

struct OptionInfo;

Description

By design, this struct does not have any user‐defined constructors, so there is no provision for passing an allocator to its data members (all of which take an allocator). Consequently, all instances of this class use the default allocator. If proper allocator propagation is desired (e.g., for storage within an allocator‐aware container for which the use of the default allocator is counter‐indicated), one may use Option, which is both allocator‐aware and constructible from OptionInfo.

The main purpose of this struct is to provide a type whose values can be statically‐initialized. For example: ` const balcl::OptionInfo OPTIONS[]= { { "s|longTag", // s(hortTag) "optionName", "option description", balcl::TypeInfo(/* . . . */), // optional balcl::OccurrenceInfo(/* . . . */) // optional }, // ... }; ` Note that each of the first three fields can be default‐constructed, and thus omitted in such a declaration; however, such an object will be of limited use because, to avoid undefined behavior, the constructor of balcl::CommandLine requires that each of these fields be acceptable to the isDescriptionValid, isNameValid, and isTagValid methods of balcl::Option. The default string value is not acceptable to any of those methods. See the {Usage} section for an example of such initialization.

Enums

Name

Description

ArgType

Enumerate the categories of command‐line arguments.

Member Functions

Name

Description

OptionInfo [constructor]

Constructors

Data Members

Name

Description

d_defaultInfo

Optional default‐occurrence information: whether the option is required, optional, or hidden (default is optional), and optionally a default value.

d_description

description used in printing usage

d_environmentVariableName

Optional environment variable name supplying a default value.

d_name

accessing name

d_tag

tags (or "" for non‐option argument)

d_typeInfo

Optional type and linked‐variable information for the option value.

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs and rhs do not have the same value, and false otherwise. Two OptionInfo object do not have the same value if they do not have the same tag strings, or the same names, or the same descriptions, or the same type information, or the same occurrence information.

operator==

Return true if the specified lhs and rhs have the same value, and false otherwise. Two OptionInfo objects have the same value if they have the same tag string, the same name, the same description, the same type info, and the same occurrence info values.

Created with MrDocs