DSParams : public DSHashTable


Superclass: DSHashTable

Discussion

The Params class is designed to make it simple to parse command-line arguments into meaningful information.

Member Functions


DSParams


public:

DSParams (void);
Discussion

Create a new Params class.


process


public:

BOOL process (     int argc,     char * argv[] );
Discussion

This function parses the parameters that have been previously registered using setFlagSwitch or setStringSwitch. These are entered into the HashTable which this class extends. To obtain the value of a parameter after parsing, use getNumericValue for flag arguments and getPtrValue for string arguments. Data passed without a flag is entered with a key of 0.

Parameter Descriptions
argc
argc from main()
argv
argv from main()
function result
Returns TRUE for success and FALSE for failure.

process


public:

BOOL process (     char * arg );
Discussion

This function parses the parameters that have been previously registered using setFlagSwitch or setStringSwitch. These are entered into the HashTable which this class extends. To obtain the value of a parameter after parsing, use getNumericValue for flag arguments and getPtrValue for string arguments. Data passed without a flag is entered with a key of 0.

Parameter Descriptions
arg
The complete command line, which is all some OSes give you.
function result
Returns TRUE for success and FALSE for failure.

setFlagSwitch


public:

BOOL setFlagSwitch (     char c );
Discussion

A flag argument is one which is either present or it isn't: a true/false combination. This function registers that the application knows how to handle the specified character as a flag parameter.

Parameter Descriptions
c
A character which is recognised as a flag argument.
function result
Returns TRUE for success and FALSE for failure.

setStringSwitch


public:

BOOL setStringSwitch (     char c );
Discussion

A string argument is one which contains its own data: A filename or pathname, something where data is passed on the command line. This function registers that an application knows how to handle the specified character as a string parameter.

Parameter Descriptions
c
A character which is recognised as a string argument.
function result
Returns TRUE for success and FALSE for failure.

(Last Updated 9/24/2004)