Loading...
Searching...
No Matches
Parameter Class Referenceabstract
Inheritance diagram for Parameter:
[legend]
Collaboration diagram for Parameter:
[legend]

## Public Member Functions

| Parameter (char c, const char *desc, void *v)
virtual bool | Read (int argc, char **argv, int argn)
virtual void | Status ()=0
virtual void | addParamsToString (String &params)
void | SetWarningBuffer (String &buffer)
void | warning (const char *format,...)

## Static Public Member Functions

static void | SetNameLen (int len)
static void | SetStatusLen (int len)

## Protected Member Functions

virtual void | Translate (const char *value)=0
virtual bool | TranslateExtras (const char *value, const char *extras)

## Static Protected Member Functions

static bool | CheckInteger (const char *value)
static bool | CheckDouble (const char *value)

## Protected Attributes

char | ch
char * | description
void * | var
String * | warnings
bool | myNoPhoneHome
String | myVersion

## Static Protected Attributes

static const char | PARAM_STR_SEP = ','
static int | nameCol = 30
static int | statusCol = 15

## Friends

class | ParameterList

## Detailed Description

Definition at line 29 of file Parameters.h.

## Constructor & Destructor Documentation

## Parameter()

Parameter::Parameter | ( | char | c,
|  | const char * | desc,
|  | void * | v )

Definition at line 33 of file Parameters.cpp.

{
ch = (char) tolower(c);
description = new char [strlen(desc) + 1];
strcpy(description, desc);
var = v;
warnings = NULL;
myNoPhoneHome = true;
myVersion.Clear();
}

## ~Parameter()

virtual Parameter::~Parameter | ( |  | ) |

inline virtual

Definition at line 55 of file Parameters.h.

{
delete [] description;
}

## Member Function Documentation

## addParamsToString()

virtual void Parameter::addParamsToString | ( | String & | params | ) |

inline virtual

Definition at line 62 of file Parameters.h.

{
if(var != NULL)
{
if(!params.IsEmpty())
{
params += PARAM_STR_SEP;
}
params += description;
}
}

## CheckDouble()

bool Parameter::CheckDouble | ( | const char * | value | ) |

static protected

Definition at line 796 of file Parameters.cpp.

{
if (value[0] != '+' && value[0] != '-' && value[0] != '.' &&
(value[0] < '0' || value[0] > '9'))
{
return false;
}
bool decimal = value[0] == '.';
for (int pos = 1; value[pos] != 0; pos++)
{
if (value[pos] < '0' || value[pos] > '9')
{
if (!decimal && value[pos] == '.')
{
decimal = true;
}
else if (value[pos] == 'e' || value[pos] == 'E')
{
return CheckInteger(value + pos + 1);
}
}
}
return true;
}

## CheckInteger()

bool Parameter::CheckInteger | ( | const char * | value | ) |

static protected

Definition at line 780 of file Parameters.cpp.

{
if (value[0] != '+' && value[0] != '-' &&
(value[0] < '0' || value[0] > '9'))
return false;
int pos = 1;
while (value[pos] != 0)
if (value[pos] < '0' || value[pos] > '9')
return false;
else
pos++;
return true;
}

## Read()

bool Parameter::Read | ( | int | argc,
|  | char ** | argv,
|  | int | argn )

virtual

Definition at line 45 of file Parameters.cpp.

{
int p = 0;
char c = (char) tolower(argv[argn][p]);
if ((c == '-') || (c == '/'))
{
p++;
c = (char) tolower(argv[argn][p]);
}
if (c == ch)
{
Translate(&(argv[argn][++p]));
return true;
}
return false;
}

## SetNameLen()

void Parameter::SetNameLen | ( | int | len | ) |

inline static

Definition at line 75 of file Parameters.h.

{
nameCol = len;
}

## SetStatusLen()

void Parameter::SetStatusLen | ( | int | len | ) |

inline static

Definition at line 79 of file Parameters.h.

{
statusCol = len;
}

## SetWarningBuffer()

void Parameter::SetWarningBuffer | ( | String & | buffer | ) |

inline

Definition at line 84 of file Parameters.h.

{
warnings = &buffer;
}

## TranslateExtras()

bool Parameter::TranslateExtras | ( | const char * | value,
|  | const char * | extras )

protected virtual

Definition at line 64 of file Parameters.cpp.

{
return false;
}

## warning()

void Parameter::warning | ( | const char * | format,
|  |  | ... )

Definition at line 69 of file Parameters.cpp.

{
String buffer;
va_list ap;
va_start(ap, format);
buffer.vprintf(format, ap);
va_end(ap);
if (warnings == NULL)
::warning(buffer);
else
(*warnings) += buffer;
}

## Friends And Related Symbol Documentation

## ParameterList

friend class ParameterList

friend

Definition at line 90 of file Parameters.h.

## Member Data Documentation

## ch

char Parameter::ch

protected

Definition at line 34 of file Parameters.h.

## description

char* Parameter::description

protected

Definition at line 35 of file Parameters.h.

## myNoPhoneHome

bool Parameter::myNoPhoneHome

protected

Definition at line 48 of file Parameters.h.

## myVersion

String Parameter::myVersion

protected

Definition at line 49 of file Parameters.h.

## nameCol

int Parameter::nameCol = 30

static protected

Definition at line 38 of file Parameters.h.

## PARAM_STR_SEP

const char Parameter::PARAM_STR_SEP = ','

static protected

Definition at line 33 of file Parameters.h.

## statusCol

int Parameter::statusCol = 15

static protected

Definition at line 39 of file Parameters.h.

## var

void* Parameter::var

protected

Definition at line 36 of file Parameters.h.

## warnings

String* Parameter::warnings

protected

Definition at line 47 of file Parameters.h.

The documentation for this class was generated from the following files:

- general/Parameters.h
- general/Parameters.cpp