BDE 4.14.0 Production release
Loading...
Searching...
No Matches
balcl::OptionInfo Struct Reference

#include <balcl_optioninfo.h>

Public Types

enum  ArgType { e_FLAG = 0 , e_OPTION = 1 , e_NON_OPTION = 2 }
 Enumerate the categories of command-line arguments. More...
 

Public Attributes

bsl::string d_tag
 
bsl::string d_name
 
bsl::string d_description
 
TypeInfo d_typeInfo
 
OccurrenceInfo d_defaultInfo
 
bsl::string d_environmentVariableName
 

Detailed Description

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:

const balcl::OptionInfo OPTIONS[] = {
{
"s|longTag", // s(hortTag)
"optionName",
"option description",
balcl::TypeInfo(/* . . . */), // optional
balcl::OccurrenceInfo(/* . . . */) // optional
},
// ...
};
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.

Member Enumeration Documentation

◆ ArgType

Enumerator
e_FLAG 
e_OPTION 
e_NON_OPTION 

Member Data Documentation

◆ d_defaultInfo

OccurrenceInfo balcl::OptionInfo::d_defaultInfo

◆ d_description

bsl::string balcl::OptionInfo::d_description

◆ d_environmentVariableName

bsl::string balcl::OptionInfo::d_environmentVariableName

◆ d_name

bsl::string balcl::OptionInfo::d_name

◆ d_tag

bsl::string balcl::OptionInfo::d_tag

◆ d_typeInfo

TypeInfo balcl::OptionInfo::d_typeInfo

The documentation for this struct was generated from the following file: