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.
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:
{
"s|longTag",
"optionName",
"option description",
},
};
Definition balcl_occurrenceinfo.h:120
Definition balcl_typeinfo.h:117
Definition balcl_optioninfo.h:132
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.