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 a Unix command line using a standard interface. It is used by every ISIP utility. There are three types of entities found on a command line: arguments, options, and flags. Arguments are present in a pre-specified order and require no qualifiers. Options can appear anywhere on the command line, setting the specified data to the following token.

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

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

Certain option names are reserved for use across all ISIP utilities. These include:

There are also some parameters associated with file processing that used by the Sof database class Sdb. These are:

Sdb also reserves one more option name "-list" to identify Sdb files from the command line. The "-list" option allows command line processing to avoid gross inefficiencies in processing lists of files. All these options are described in more detail in the File class and Sdb.

dependencies:

public constants:

error codes:

protected data:

required public methods:

class-specific public methods:

private methods:

examples:

notes: