CPluginArguments Class Reference

## CPluginArguments

- PluginArgs.h
- PluginArgs.cpp

### Purpose

The CPluginArguments class provides an encapsulation of the plug-in arguments passed in to NPP_New(). All argument names are "normalized" to lower-case. Argument values can be retrieved as boolean ("true" and "false" in any capitalization are translated to 1 or 0), string (capitalization is unchanged), or integer.

### Dependencies

- NetscapeMemObject.h (from the Plug-in Framework)

CPluginArguments can be easily used with any Plug-in, without needing any other part of the framework except for CNetscapeMemObject.

### Methods

- CPluginArguments
- ~CPluginArguments
- ArgumentValueAsString
- ArgumentValueAsInt
- ArgumentValueAsBool

### Members

No public or protected members.

### CPluginArguments::CPluginArguments()

#### Syntax

    CPluginArguments::CPluginArguments( short argc, const char* argn[], const char* argv[] )

#### Purpose

Constructor. Accepts the arguments parameter that were passed to NPP_New, and copies all of the data into a private data structure. (The arguments passed to NPP_New() do not live past that call, so the data must be copied.)

#### Parameters

argc | The number of arguments contained in the argn and argv arrays.
argn | An array of argument names, each of which corresponds to a field in argv.
argv | The array of argument values, each of which corresponds to a field in argn.

#### Return Value

None.

### CPluginArguments::~CPluginArguments

#### Syntax

    CPluginArguments::~CPluginArguments()

#### Purpose

Destructor.

#### Parameters

None.

#### Return Value

None.

### CPluginArguments::ArgumentValueAsString()

#### Syntax

    const char*
    CPluginArguments::ArgumentValueAsString( const char* argumentName )

#### Purpose

Retrieves the value associated with argumentName as a string, with no case conversion in the value.

#### Parameters

argumentName | The name of the argument whose value is to be retreived. Case is not important.

#### Return Value

A pointer to the value string, if found. NULL if the argument name was not found.

### CPluginArguments::ArgumentValueAsInt()

#### Syntax

    long
    CPluginArguments::ArgumentValueAsInt( const char* argumentName, long defaultValue = 0 )

#### Purpose

Retrieves the value associated with argumentName as a long.

#### Parameters

argumentName | The name of the argument whose value is to be retreived. Case is not important.
defaultValue | A default value to be returned if the argumentName is not found.

#### Return Value

The integer value associated with argumentName, or the defaultValue if the argumentName is not found.

### CPluginArguments::ArgumentValueAsBool()

#### Syntax

    Boolean
    CPluginArguments::ArgumentValueAsBool( const char* argumentName, Boolean defaultValue=false )

#### Purpose

Retrieves the value associated with argumentName as a boolean.

#### Parameters

argumentName | The name of the argument whose value is to be retreived. Case is not important.
defaultValue | A default value to be returned if the argumentName is not found.

#### Return Value

The Boolean value associated with argumentName, or the defaultValue if the argumentName is not found.