Constructors

Synopses

Declared in <balcl_commandline.h>

Create a command‐line object having the value of the specified original command line, if the original is parsed, and otherwise having a state such that parsing command‐line arguments results in the same value as parsing the same command‐line arguments with the original. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless original is valid (i.e., original.isValid() returns true).

CommandLine(
    CommandLine const& original,
    bslma::Allocator* basicAllocator = 0);

Same as the overload taking const OptionInfo (&)[LENGTH], but accepts a non‐const specTable whose entries may be updated in place.

template<int LENGTH>
explicit
CommandLine(
    OptionInfo(& specTable)[],
    bslma::Allocator* basicAllocator = 0);

Create an object accepting the command‐line options described by the specified (statically‐initialized) specTable. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless specTable satisfies the isValidOptionSpecificationTable function. Note that an appropriate error message is written to bsl::cerr.

template<int LENGTH>
explicit
CommandLine(
    OptionInfo const(& specTable)[],
    bslma::Allocator* basicAllocator = 0);

Create an object accepting the command‐line options described by the specified specTable of the specified length. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless specTable satisfies the isValidOptionSpecificationTable function. Note that an appropriate error message is written to bsl::cerr. Also note that specTable need not be statically initialized.

CommandLine(
    OptionInfo const* specTable,
    int length,
    bslma::Allocator* basicAllocator = 0);

Same as the preceding overload, but accepts a non‐const specTable whose entries may be updated in place.

template<int LENGTH>
CommandLine(
    OptionInfo(& specTable)[],
    std::ostream& errorStream,
    bslma::Allocator* basicAllocator = 0);

Create an object accepting the command‐line options described by the specified (statically‐initialized) specTable. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless specTable satisfies the isValidOptionSpecificationTable function. Note that an appropriate error message is written to the specified errorStream.

template<int LENGTH>
CommandLine(
    OptionInfo const(& specTable)[],
    std::ostream& errorStream,
    bslma::Allocator* basicAllocator = 0);

Create an object accepting the command‐line options described by the specified specTable of the specified length. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined unless specTable satisfies the isValidOptionSpecificationTable function. Note that an appropriate error message is written to the specified errorStream. Also note that specTable need not be statically initialized.

CommandLine(
    OptionInfo const* specTable,
    int length,
    std::ostream& errorStream,
    bslma::Allocator* basicAllocator = 0);

Created with MrDocs