libStatGen Software 1
StringParameter Class Reference
Inheritance diagram for StringParameter:
Collaboration diagram for StringParameter:

Public Member Functions

 StringParameter (char c, const char *desc, String &v, bool allowBlank=true)
 
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 Status ()=0
 
virtual void addParamsToString (String &params)
 
void SetWarningBuffer (String &buffer)
 
void warning (const char *format,...)
 

Protected Member Functions

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

Protected Attributes

bool required
 
- 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 172 of file Parameters.h.

Constructor & Destructor Documentation

◆ StringParameter()

StringParameter::StringParameter ( char  c,
const char *  desc,
String v,
bool  allowBlank = true 
)
inline

Definition at line 175 of file Parameters.h.

176 : Parameter(c, desc, &v)
177 {
178 required = !allowBlank;
179 }

Member Function Documentation

◆ Status()

void StringParameter::Status ( )
virtual

Implements Parameter.

Definition at line 191 of file Parameters.cpp.

192{
193 fprintf(stderr, "%*s : %*s (-%cname)\n", nameCol, description,
194 statusCol, (const char *)(*(String *) var), ch);
195}

◆ Translate()

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

Implements Parameter.

Definition at line 172 of file Parameters.cpp.

173{
174 String * s = (String *) var;
175
176 *s = value;
177}

◆ TranslateExtras()

bool StringParameter::TranslateExtras ( const char *  value,
const char *  extras 
)
protectedvirtual

Reimplemented from Parameter.

Definition at line 179 of file Parameters.cpp.

180{
181 if ((value[0] != 0) || ((!required) && (extras[0] == '-')))
182 return false;
183
184 String * s = (String *) var;
185
186 *s = extras;
187
188 return true;
189}

Member Data Documentation

◆ required

bool StringParameter::required
protected

Definition at line 184 of file Parameters.h.


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