name: CommandLine

synopsis:

g++ [flags ...] commandline ... -l /isip/tools/lib/$ISIP_BINARY/lib_shell.a

#include <CommandLine.h>

~CommandLine();
CommandLine();
CommandLine(const CommandLine& arg);
boolean setHelp(const unichar* help_message);
String& addOptionParam(Long& var, const String& param, long def_value);
boolean parse(int argc, const char** argv);
long getOptionIndex(const String& param_name);
quick start:

String com_str(L"foo.exe -swap -sf 7000.0 -help");

CommandLine cmdl;

// add an swap flag
//
String flag_param(L"swap");
Boolean swap;
cmdl.addFlagParam(swap, flag_param);

// add a sample frequency
//
String sf_param(L"sf");
Float sf;
cmdl.addOptionParam(sf, sf_param, (float)8000.0);

// parse the commandline
//
cmdl.parse(com_str);

// test the swap flag
//
if (swap) {
 Console::put(L"swap flag specified");
}

// print the sample frequency
//
sf.debug(L"sample frequency");
description:

The CommandLine class is designed to parse commandline options in a regular format. It is used by every ISIP utility. There are three types of entities found on a commandline, arguments, options, and flags. Arguments are present in a pre-specified order and require no qualifiers. Options can appear anywhere on the commandline, setting the specified data to the following token.

Flags, like options, can appear anywhere on the commandline, yet they are used for boolean data. Any flag not present on the commandline is assumed false.

The commandline considers partial name completions. If any option is specified partially on commandline and it is the single match then commandline accepts this option. If there are more than one match, it is specified as an error.

dependencies:

public constants:

error codes:

protected data:

required public methods:

class-specific public methods:

private methods:

examples:

notes: