libStatGen Software 1
Loading...
Searching...
No Matches
ListParameter Class Reference
Inheritance diagram for ListParameter:
Collaboration diagram for ListParameter:

Public Member Functions

 ListParameter (char c, const char *desc, int &v, OptionList *opt)
 
virtual void Status ()
 
- Public Member Functions inherited from Parameter
 Parameter (char c, const char *desc, void *v)
 
virtual bool Read (int argc, char **argv, int argn)
 
virtual void addParamsToString (String &params)
 
void SetWarningBuffer (String &buffer)
 
void warning (const char *format,...)
 

Protected Member Functions

virtual void Translate (const char *value)
 
- Protected Member Functions inherited from Parameter
virtual bool TranslateExtras (const char *value, const char *extras)
 

Protected Attributes

String key
 
OptionListoptions
 
- Protected Attributes inherited from Parameter
char ch
 
char * description
 
void * var
 
Stringwarnings
 
bool myNoPhoneHome
 
String myVersion
 

Additional Inherited Members

- Static Public Member Functions inherited from Parameter
static void SetNameLen (int len)
 
static void SetStatusLen (int len)
 
- Static Protected Member Functions inherited from Parameter
static bool CheckInteger (const char *value)
 
static bool CheckDouble (const char *value)
 
- Static Protected Attributes inherited from Parameter
static const char PARAM_STR_SEP = ','
 
static int nameCol = 30
 
static int statusCol = 15
 

Detailed Description

Definition at line 210 of file Parameters.h.

Constructor & Destructor Documentation

◆ ListParameter()

ListParameter::ListParameter ( char  c,
const char *  desc,
int &  v,
OptionList opt 
)

Definition at line 224 of file Parameters.cpp.

225 : Parameter(c, desc, &v)
226{
227 options = opt;
228
229 for (OptionList * l = options; l->ch != 0; l++)
230 {
231 key += l->ch;
232 key += '|';
233 }
234
235 key.SetLength(key.Length() - 1);
236}

Member Function Documentation

◆ Status()

void ListParameter::Status ( )
virtual

Implements Parameter.

Definition at line 197 of file Parameters.cpp.

198{
199 OptionList * l;
200
201 for (l = options; l->ch != 0; l++)
202 if (l->code == *((int *)var))
203 break;
204
205 fprintf(stderr, "%*s : %*s (-%c[%s])\n", nameCol, description,
206 statusCol, l->description, ch, (const char *) key);
207}

◆ Translate()

void ListParameter::Translate ( const char *  value)
protectedvirtual

Implements Parameter.

Definition at line 209 of file Parameters.cpp.

210{
211 OptionList * l;
212
213 for (l = options; l->ch != 0; l++)
214 if (tolower(l->ch) == tolower(value[0]))
215 break;
216
217 if (l->ch == 0 && tolower(value[0]) != 0)
218 warning("Command line parameter -%c%s: the option '%c' has no meaning\n",
219 ch, value, value[0], (const char *) key);
220
221 *((int*) var) = l->code;
222}

Member Data Documentation

◆ key

String ListParameter::key
protected

Definition at line 218 of file Parameters.h.

◆ options

OptionList* ListParameter::options
protected

Definition at line 219 of file Parameters.h.


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