Relacs Options Library  0.9.8
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
Parameter Class Reference

#include <parameter.h>

Public Types

enum  ValueType {
  NoType =0, Text =1, Number =2, Integer =4,
  Boolean =8, AnyNumber =14, Date =16, Time =32,
  Section =64
}
 

Public Member Functions

 Parameter (void)
 
 Parameter (const Parameter &p)
 
 Parameter (const string &name, const string &request, const string &strg, int flags=0, int style=0, Options *parentsection=0)
 
 Parameter (const string &name, const string &request, const char *strg, int flags=0, int style=0, Options *parentsection=0)
 
 Parameter (const string &name, const string &request, double number, double error, double minimum=-MAXDOUBLE, double maximum=MAXDOUBLE, double step=1.0, const string &internunit="", const string &outputunit="", const string &format="", int flags=0, int style=0, Options *parentsection=0)
 
 Parameter (const string &name, const string &request, double number, const string &unit="", const string &format="", int flags=0, int style=0, Options *parentsection=0)
 
 Parameter (const string &name, const string &request, const vector< double > &numbers, const vector< double > &errors, double minimum=-MAXDOUBLE, double maximum=MAXDOUBLE, double step=1.0, const string &internunit="", const string &outputunit="", const string &format="", int flags=0, int style=0, Options *parentsection=0)
 
 Parameter (const string &name, const string &request, long number, long error=-1, long minimum=LONG_MIN, long maximum=LONG_MAX, long step=1, const string &internunit="", const string &outputunit="", int width=0, int flags=0, int style=0, Options *parentsection=0)
 
 Parameter (const string &name, const string &request, bool dflt, int flags=0, int style=0, Options *parentsection=0)
 
 Parameter (const string &name, const string &request, ValueType type, int yearhour, int monthminutes, int dayseconds, int flags=0, int style=0, Options *parentsection=0)
 
 Parameter (const string &name, const string &request, int hour, int minutes, int seconds, int milliseconds, int flags=0, int style=0, Options *parentsection=0)
 
 Parameter (const string &name, const string &value)
 
 ~Parameter (void)
 
Parameterclear (const string &name="", const string &request="", ValueType type=NoType)
 
Parameteroperator= (const Parameter &p)
 
Parameterassign (const Parameter &p)
 
Parameteroperator= (const string &value)
 
Parameterassign (const string &value)
 
ParametersetValue (const Parameter &p)
 
OptionsparentSection (void)
 
const OptionsparentSection (void) const
 
void setParentSection (Options *parentsection)
 
bool nonDefault (void) const
 
Str warning (void) const
 
Str name (void) const
 
ParametersetName (const string &name)
 
Str request (void) const
 
ParametersetRequest (const string &request)
 
ValueType valueType (void) const
 
bool valueType (int mask) const
 
ParametersetValueType (ValueType type)
 
int flags (void) const
 
bool flags (int selectflag) const
 
ParametersetFlags (int flags)
 
ParameteraddFlags (int flags)
 
ParameterdelFlags (int flags)
 
ParameterclearFlags (void)
 
bool changed (void) const
 
int style (void) const
 
ParametersetStyle (int style)
 
ParameteraddStyle (int style)
 
ParameterdelStyle (int style)
 
Str format (void) const
 
ParametersetFormat (int width, int prec=-1, char fmt='-')
 
ParametersetFormat (const string &format="")
 
int formatWidth (void) const
 
int size (void) const
 
bool isText (void) const
 
Str text (int index, const string &format="", const string &unit="") const
 
Str text (const string &format="", const string &unit="") const
 
void texts (vector< string > &s, const string &format="", const string &unit="") const
 
Str allText (const string &format="", const string &unit="", const string &separator=", ") const
 
ParametersetText (const string &strg)
 
ParametersetText (const Parameter &p)
 
ParameteraddText (const string &strg, bool clear=false)
 
Str defaultText (int index, const string &format="", const string &unit="") const
 
Str defaultText (const string &format="", const string &unit="") const
 
ParametersetDefaultText (const string &strg)
 
ParameteraddDefaultText (const string &strg)
 
ParameterselectText (const string &strg, int add=0)
 
ParameterselectText (int index)
 
int index (void) const
 
int index (const string &strg) const
 
bool isAnyNumber (void) const
 
bool isNumber (void) const
 
double number (const string &unit="", int index=0, double dflt=0.0) const
 
double number (int index, const string &unit="", double dflt=0.0) const
 
double number (int index, double dflt, const string &unit="") const
 
void numbers (vector< double > &n, const string &unit="") const
 
double error (const string &unit="", int index=0) const
 
double error (int index, const string &unit="") const
 
void errors (vector< double > &n, const string &unit="") const
 
ParametersetNumber (double number, double error, const string &unit="")
 
ParametersetNumber (double number, const string &unit="")
 
ParametersetNumbers (const vector< double > &numbers, const vector< double > &errors, const string &unit="")
 
ParametersetNumbers (const vector< double > &numbers, double error, const string &unit="")
 
ParametersetNumbers (const vector< double > &numbers, const string &unit="")
 
ParametersetNumber (const Parameter &p)
 
ParameteraddNumber (double number, double error, const string &unit="", bool clear=false)
 
ParameteraddNumber (double number, const string &unit="")
 
ParameteraddNumber (const Str &s, const string &unit="")
 
bool isInteger (void) const
 
long integer (const string &unit="", int index=0, long dflt=0) const
 
long integer (int index, const string &unit="", long dflt=0) const
 
long integer (int index, long dflt, const string &unit="") const
 
void integers (vector< long > &n, const string &unit="") const
 
void integers (vector< int > &n, const string &unit="") const
 
ParametersetInteger (long number, long error, const string &unit="")
 
ParametersetInteger (long number, const string &unit="")
 
ParametersetInteger (const Parameter &p)
 
ParameteraddInteger (long number, long error, const string &unit="")
 
ParameteraddInteger (long number, const string &unit="")
 
double defaultNumber (const string &unit="", int index=0) const
 
double defaultNumber (int index, const string &unit="") const
 
ParametersetDefaultNumber (double number, const string &unit="")
 
ParameteraddDefaultNumber (double number, const string &unit="")
 
ParameteraddDefaultNumber (const Str &s, const string &unit="")
 
long defaultInteger (const string &unit="", int index=0) const
 
long defaultInteger (int index, const string &unit="") const
 
ParametersetDefaultInteger (long dflt, const string &unit="")
 
ParameteraddDefaultInteger (double number, const string &unit="")
 
double minimum (const string &unit="") const
 
double maximum (const string &unit="") const
 
double step (const string &unit="") const
 
ParametersetStep (double step, const string &unit="")
 
ParametersetStep (long step)
 
ParametersetMinMax (double minimum=-MAXDOUBLE, double maximum=MAXDOUBLE, double step=1.0, const string &unit="")
 
ParametersetMinMax (long minimum=LONG_MIN, long maximum=LONG_MAX, long step=1, const string &unit="")
 
ParametersetMinMax (int minimum, int maximum, int step=1, const string &unit="")
 
Str unit (void) const
 
Str outUnit (void) const
 
ParametersetUnit (const string &internunit, const string &outputunit="")
 
ParametersetOutUnit (const string &outputunit)
 
ParameterchangeUnit (string internunit)
 
bool isBoolean (void) const
 
bool boolean (int index=0) const
 
void booleans (vector< bool > &n) const
 
ParametersetBoolean (bool b)
 
ParametersetBoolean (const Parameter &p)
 
bool defaultBoolean (int index=0) const
 
ParametersetDefaultBoolean (bool dflt)
 
bool isDate (void) const
 
int year (int index=0) const
 
int month (int index=0) const
 
int day (int index=0) const
 
void date (int &year, int &month, int &day, int index=0) const
 
ParametersetDate (int year, int month, int day)
 
ParameteraddDate (int year, int month, int day)
 
ParametersetDate (const string &date)
 
ParametersetDate (const struct tm &date)
 
ParametersetDate (const time_t &time)
 
ParametersetCurrentDate (void)
 
ParametersetDate (const Parameter &p)
 
int defaultYear (int index=0) const
 
int defaultMonth (int index=0) const
 
int defaultDay (int index=0) const
 
void defaultDate (int &year, int &month, int &day, int index=0) const
 
ParametersetDefaultDate (int year, int month, int day)
 
ParameteraddDefaultDate (int year, int month, int day)
 
ParametersetDefaultDate (const string &date)
 
bool isTime (void) const
 
int hour (int index=0) const
 
int minutes (int index=0) const
 
int seconds (int index=0) const
 
int milliSeconds (int index=0) const
 
void time (int &hour, int &minutes, int &seconds, int &milliseconds, int index=0) const
 
ParametersetTime (int hour, int minutes, int seconds, int milliseconds=0)
 
ParameteraddTime (int hour, int minutes, int seconds, int milliseconds=0)
 
ParametersetTime (const string &time)
 
ParametersetTime (const struct tm &time)
 
ParametersetTime (const time_t &time)
 
ParametersetCurrentTime (void)
 
ParametersetTime (const Parameter &p)
 
int defaultHour (int index=0) const
 
int defaultMinutes (int index=0) const
 
int defaultSeconds (int index=0) const
 
int defaultMilliSeconds (int index=0) const
 
void defaultTime (int &hour, int &minutes, int &seconds, int &milliseconds, int index=0) const
 
ParametersetDefaultTime (int hour, int minutes, int seconds, int milliseconds=0)
 
ParameteraddDefaultTime (int hour, int minutes, int seconds, int milliseconds=0)
 
ParametersetDefaultTime (const string &time)
 
bool isNotype (void) const
 
bool empty (void) const
 
ParametersetDefault (void)
 
ParametersetToDefault (void)
 
ParametersetActivation (const string &name, const string &value, bool activate=true)
 
ParameteraddActivation (const string &name, const string &value, bool activate=true)
 
ParameterclearActivation (void)
 
int activations () const
 
string activationName (int index=0) const
 
string activationValue (int index=0) const
 
string activationValues (int index=0) const
 
double activationNumber (int index=0) const
 
string activationUnit (int index=0) const
 
int activationComparison (int index=0) const
 
bool activation (int index=0) const
 
bool testActivation (int index, const string &value)
 
bool testActivation (int index, double value, double tol=1e-8)
 
string save (int flags=0) const
 
ostream & save (ostream &str, int width=0, int flags=0) const
 
ostream & save (ostream &str, const string &textformat, const string &numberformat, const string &boolformat, const string &dateformat, const string &timeformat) const
 
ostream & saveXML (ostream &str, int level=0, int indent=4, int flags=0) const
 
bool read (const Str &s, const string &assignment=":=")
 
bool read (const Parameter &p)
 
ParameteraddSelectOption (const std::string &option)
 
ParameterremoveSelectOption (const std::string &option)
 
ParameterclearSelectOptions ()
 
const std::set< std::string > & selectOptions () const
 
std::string selectOption (int index) const
 
int selectOptionsSize () const
 

Static Public Member Functions

static int changedFlag (void)
 
static double floorLog10 (double v)
 
static double floor10 (double v, double scale=1.0)
 
static double ceil10 (double v, double scale=1.0)
 
static double changeUnit (double val, const Str &oldunit, const Str &newunit)
 

Static Public Attributes

static const int ChangedFlag = 16384
 
static const int NonDefault = -32768
 
static const long SelectText = 0x01000000
 
static const long MultipleSelection = 0x00800000
 
static const int ListAlways = 0x02000000
 
static const int Select = 0x00400000 | MultipleSelection
 

Friends

bool operator== (const Parameter &p1, const Parameter &p2)
 
bool operator== (const Parameter &p, const string &name)
 
ostream & operator<< (ostream &str, const Parameter &p)
 

Detailed Description

A Parameter has a name, value and unit.

Author
Jan Benda Parameter basically are name-value pairs. The parameter is uniquely identified by its name(). The value can be of different types (number(), boolean(), date(), time(), text(), etc., see setValueType() ). Number parameters have in addition a unit() and a format() string, which is used to generate pretty formatted output. The value can be changed by one of the setText(), setNumber(), etc. functions or set to a default value.

Member Enumeration Documentation

enum ValueType

Type of the parameter's value.

Enumerator
NoType 

No type specified yet.

Text 

The parameter's value is a string.

Number 

The parameter's value is a floating point number.

Integer 

The parameter's value is an integer.

Boolean 

The parameter's value is a boolean.

AnyNumber 

The parameter's value is a floating point number, an integer, or a boolean.

Date 

The parameter's value is a date that contains year, month, and day.

Time 

The parameter's value is a time that contains hour, minutes, and seconds.

Section 

A section.

Note
A Parameter cannot be a section. This type is for the typemask of the Options::setValueTypeFlags() functions.

Constructor & Destructor Documentation

Parameter ( void  )

Construct a single Parameter. Use setValueType() to define the type of the parameter, setRequest() to define the request string, which is used for dialogs, setName() to give the parameter a unique name. With the set*() functions, the values of the parameter can be initialized.

References Parameter::clear().

Parameter ( const Parameter p)

Copy constructor.

References Parameter::assign().

Parameter ( const string &  name,
const string &  request,
const string &  strg,
int  flags = 0,
int  style = 0,
Options parentsection = 0 
)

Construct and initialize a single Parameter of type Text. Its value an its default value are set to strg.

References Parameter::clear(), Parameter::setDefaultText(), Parameter::setFlags(), Parameter::setStyle(), Parameter::setText(), and Parameter::Text.

Parameter ( const string &  name,
const string &  request,
const char *  strg,
int  flags = 0,
int  style = 0,
Options parentsection = 0 
)

Construct and initialize a single Parameter of type Text. Its value an its default value are set to strg.

References Parameter::clear(), Parameter::setDefaultText(), Parameter::setFlags(), Parameter::setStyle(), Parameter::setText(), and Parameter::Text.

Parameter ( const string &  name,
const string &  request,
double  number,
double  error,
double  minimum = -MAXDOUBLE,
double  maximum = MAXDOUBLE,
double  step = 1.0,
const string &  internunit = "",
const string &  outputunit = "",
const string &  format = "",
int  flags = 0,
int  style = 0,
Options parentsection = 0 
)

Construct and initialize a single Parameter of type Number. Its value and its default value are set to number, its standard deviation to error. The allowed range for its value is defined by minimum and maximum. The unit of the number is interunit. For output and dialogs outputunit is used as unit.

References Parameter::clear(), Parameter::Number, Parameter::setDefaultNumber(), Parameter::setFlags(), Parameter::setFormat(), Parameter::setMinMax(), Parameter::setNumber(), Parameter::setStyle(), and Parameter::setUnit().

Parameter ( const string &  name,
const string &  request,
double  number,
const string &  unit = "",
const string &  format = "",
int  flags = 0,
int  style = 0,
Options parentsection = 0 
)

Construct and initialize a single Parameter of type Number. Its value and its default value are set to number, its standard deviation to 0.0. The unit of the number is unit.

References Parameter::clear(), Parameter::Number, Parameter::setDefaultNumber(), Parameter::setFlags(), Parameter::setFormat(), Parameter::setNumber(), Parameter::setStyle(), and Parameter::setUnit().

Parameter ( const string &  name,
const string &  request,
const vector< double > &  numbers,
const vector< double > &  errors,
double  minimum = -MAXDOUBLE,
double  maximum = MAXDOUBLE,
double  step = 1.0,
const string &  internunit = "",
const string &  outputunit = "",
const string &  format = "",
int  flags = 0,
int  style = 0,
Options parentsection = 0 
)

Construct and initialize a single Parameter of type Number. Its values are set to numbers, its default value is set to numbers[0], its standard deviation to error. The allowed range for its value is defined by minimum and maximum. The unit of the number is interunit. For output and dialogs outputunit is used as unit.

References Parameter::clear(), Parameter::Number, Parameter::setDefaultNumber(), Parameter::setFlags(), Parameter::setFormat(), Parameter::setMinMax(), Parameter::setNumbers(), Parameter::setStyle(), and Parameter::setUnit().

Parameter ( const string &  name,
const string &  request,
long  number,
long  error = -1,
long  minimum = LONG_MIN,
long  maximum = LONG_MAX,
long  step = 1,
const string &  internunit = "",
const string &  outputunit = "",
int  width = 0,
int  flags = 0,
int  style = 0,
Options parentsection = 0 
)

Construct and initialize a single Parameter of type Integer. Its value an its default value are set to number, its standard deviation to error. The allowed range for its value is defined by minimum and maximum. The unit of the number is interunit. For output and dialogs outputunit is used as unit.

References Parameter::clear(), Parameter::Integer, Parameter::setDefaultInteger(), Parameter::setFlags(), Parameter::setFormat(), Parameter::setInteger(), Parameter::setMinMax(), Parameter::setStyle(), and Parameter::setUnit().

Parameter ( const string &  name,
const string &  request,
bool  dflt,
int  flags = 0,
int  style = 0,
Options parentsection = 0 
)

Construct and initialize a single Parameter of type Boolean. Its value and its default value are set to dflt.

References Parameter::Boolean, Parameter::clear(), Parameter::setBoolean(), Parameter::setDefaultBoolean(), Parameter::setFlags(), and Parameter::setStyle().

Parameter ( const string &  name,
const string &  request,
ValueType  type,
int  yearhour,
int  monthminutes,
int  dayseconds,
int  flags = 0,
int  style = 0,
Options parentsection = 0 
)

Construct and initialize a single Parameter of type Date or Time. Its value and its default value are set to yearhour, monthminutes and dayseconds.

References Parameter::clear(), Parameter::Date, Parameter::isDate(), Parameter::setDate(), Parameter::setDefaultDate(), Parameter::setDefaultTime(), Parameter::setFlags(), Parameter::setStyle(), Parameter::setTime(), and Parameter::Time.

Parameter ( const string &  name,
const string &  request,
int  hour,
int  minutes,
int  seconds,
int  milliseconds,
int  flags = 0,
int  style = 0,
Options parentsection = 0 
)

Construct and initialize a single Parameter of type Time. Its value and its default value are set to hour, minutes, seconds, and milliseconds.

References Parameter::clear(), Parameter::setDefaultTime(), Parameter::setFlags(), Parameter::setFormat(), Parameter::setStyle(), Parameter::setTime(), and Parameter::Time.

Parameter ( const string &  name,
const string &  value 
)
~Parameter ( void  )

Deconstruct Parameter.

Member Function Documentation

Parameter & clear ( const string &  name = "",
const string &  request = "",
ValueType  type = NoType 
)

Clear the parameter. Set the identity string to name, the request string to request, and the type to type. The value of the parameter and the default value is cleared. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, Parameter::clearSelectOptions(), StrQueue::empty(), Str::empty(), Parameter::name(), Parameter::request(), StrQueue::resize(), and Parameter::setFormat().

Referenced by Parameter::Parameter().

Parameter & operator= ( const Parameter p)

Copy content of parameter p to this. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::assign().

Parameter & assign ( const Parameter p)

Copy content of parameter p to this. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, and StrQueue::empty().

Referenced by Parameter::operator=(), Parameter::Parameter(), and Parameter::read().

Parameter & operator= ( const string &  value)

Set the value of a parameter depending on its type to the content of the string value. If the type of the parameter is Number, Integer, or Boolean, value is first splitted into a number and a unit. If the parameter has no type, it is set to Number if value contains a floating point number or a unit, Integer if value is an integer number, Boolean if value equals either "true" or "false", otherwise it is set to Text. The warning message is set if value is invalid. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::assign().

Parameter & assign ( const string &  value)

Set the value of a parameter depending on its type to the content of the string value. If the type of the parameter is Number, Integer, or Boolean, value is first splitted into a number and a unit. If the parameter has no type, it is set to Number if value contains a floating point number or a unit, Integer if value is an integer number, Boolean if value equals either "true" or "false", otherwise it is set to Text. The warning message is set if value is invalid. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::addDate(), Parameter::addNumber(), Parameter::addSelectOption(), Parameter::addTime(), StrQueue::assign(), Parameter::Boolean, Parameter::ceil10(), Parameter::clearSelectOptions(), Parameter::Date, Str::date(), Parameter::date(), Parameter::day(), Str::Digit, Str::DoubleWhiteSpace, Str::empty(), StrQueue::erase(), Parameter::error(), StrQueue::find(), Parameter::hour(), Parameter::Integer, Parameter::integer(), Parameter::isNotype(), Parameter::isText(), Parameter::minutes(), Parameter::month(), Parameter::Number, Parameter::number(), StrQueue::resize(), Parameter::seconds(), Parameter::Select, Parameter::SelectText, Parameter::selectText(), Parameter::setFormat(), Parameter::setMinMax(), Parameter::setStep(), Parameter::setText(), Parameter::setUnit(), Parameter::setValueType(), StrQueue::size(), Parameter::size(), Parameter::step(), StrQueue::strip(), Parameter::style(), Parameter::Text, Parameter::Time, Str::time(), Parameter::time(), Parameter::unit(), and Parameter::year().

Parameter & setValue ( const Parameter p)

Assing the value of to this, but only if they have the same type. The warning message is set if p is of different type. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, StrQueue::empty(), and Parameter::valueType().

Options * parentSection ( void  )

Returns a pointer to the Options where this Parameter belongs to. If this Parameter does not belong to an Options, NULL is returned.

const Options * parentSection ( void  ) const

Returns a const pointer to the Options where this Parameter belongs to. If this Parameter does not belong to an Options, NULL is returned.

void setParentSection ( Options parentsection)

Set the parent Options of this Parameter to parent.

Referenced by Options::insert(), and Options::load().

bool nonDefault ( void  ) const

Returns true if the value differs from the default.

References Parameter::isAnyNumber(), Parameter::isDate(), Parameter::isText(), and Parameter::isTime().

Referenced by Parameter::flags().

Str warning ( void  ) const
Str name ( void  ) const
Parameter & setName ( const string &  name)

Set identity string to name.

References Parameter::name().

Str request ( void  ) const
Parameter & setRequest ( const string &  request)

Set request string to request.

References Parameter::request().

Parameter::ValueType valueType ( void  ) const

The type of the parameter.

Referenced by Parameter::setValue(), and Parameter::valueType().

bool valueType ( int  mask) const
Returns
true if one of the bits specified by mask corresponds to the parameter's type, or mask equals zero, or mask is negative and the parameter's type is not contained in abs( mask ).

References Parameter::valueType().

Parameter & setValueType ( ValueType  type)

Set type of parameter to typex.

Referenced by Parameter::addText(), and Parameter::assign().

int flags ( void  ) const

The flags of the parameter.

Referenced by Parameter::addFlags(), Parameter::flags(), and Parameter::setFlags().

bool flags ( int  selectflag) const

True if one of the bits specified by selectflag is set in the parameter's flags, or selectflag equals zero, or selectflag is negative and the parameter's value differs from the default value and abs(selectflag) is set in the parameter's flags, or selectflag equals NonDefault and the parameter's values differs from the default value.

References Parameter::flags(), Parameter::NonDefault, and Parameter::nonDefault().

Parameter & setFlags ( int  flags)

Set flags of parameter to flags.

References Parameter::flags().

Referenced by Parameter::Parameter().

Parameter & addFlags ( int  flags)

Add the bits specified by flags to the parameter's flags.

References Parameter::flags().

Referenced by Options::read().

Parameter & delFlags ( int  flags)

Clear the bits specified by flags of the parameter's flags.

Parameter & clearFlags ( void  )

Clear all bits of the parameter's flags.

int changedFlag ( void  )
static

The flag that is used to mark options whose value has been changed. It is preset to a constant value (16384) and cannot be changed by the user.

References Parameter::ChangedFlag.

bool changed ( void  ) const

Return true if the changedFlag() is set, i.e. whose value has been changed.

References Parameter::ChangedFlag.

int style ( void  ) const
Parameter & setStyle ( int  style)

Set style of parameter to style.

References Parameter::style().

Referenced by Parameter::Parameter().

Parameter & addStyle ( int  style)

Add the bits specified by style to the parameter's style.

References Parameter::style().

Parameter & delStyle ( int  style)

Clear the bits specified by style of the parameter's style.

Str format ( void  ) const
Parameter & setFormat ( int  width,
int  prec = -1,
char  fmt = '-' 
)

Set format string for numbers to have a width of width and precision of prec. The width width can be negative to indicate left aligned output. The type is set to fmt which can be either 'f', 'g' or 'e', according to the ANSI C printf double formats or 's' for text. The default is 'g' for numbers and 's' for strings. The warning message is set if w, prec or fmt are invalid. Does nothing if the parameter is a date or time.

References Parameter::format(), Parameter::isBoolean(), Parameter::isDate(), Parameter::isInteger(), Parameter::isNumber(), and Parameter::isTime().

Referenced by Parameter::assign(), Parameter::clear(), and Parameter::Parameter().

Parameter & setFormat ( const string &  format = "")

Set format string to format (ANSI C printf() syntax, only 'g', 'f', 'e' formats are allowed, since the number is a double). For example, "%5.1f" is an valid format string. The warning message is set if format is invalid. See text() for an detailed description of formats.

References Parameter::format(), Parameter::isBoolean(), Parameter::isDate(), Parameter::isInteger(), Parameter::isNumber(), and Parameter::isTime().

int formatWidth ( void  ) const

Returns the width of the expanded format string.

References Str::totalWidth().

int size ( void  ) const
bool isText ( void  ) const
Str text ( int  index,
const string &  format = "",
const string &  unit = "" 
) const

Returns the index-th value of a parameter. It is formatted as specified by the format string. s is the text string. If the text string is a file path (e.g. example/data.tar.gz), then p is the path of the file (e.g. example/), d is the full file name (e.g. data.tar.gz), n is the basename of the file name (e.g. data), and x is the extension (e.g. tar.gz). If the parameter is a number (float, integer, boolean), then f, g, e is the number value, F, G, E is the number error, and b is a boolean value expressed as true or false. If the parameter is a time, then S: second (0..59), M: minute (0..59), H: hour (0..23). If the parameter is a date, then d: day of month (1..31), m: month (1..12), y: last two digits of year (0..99), Y: year (1970...). u is the unit string, i is the name (identifier) string, and r is the request string. T is the type of the parameter as a human readable string. If format is empty, the format set by setFormat() is used. If the parameter is a number, then its value is returned in the unit specified by unit. If unit is empty, the outUnit() is used.

References Parameter::changeUnit(), Str::dir(), Str::empty(), Str::extension(), Str::format(), Parameter::index(), Parameter::isAnyNumber(), Parameter::isBoolean(), Parameter::isDate(), Parameter::isInteger(), Parameter::isNumber(), Parameter::isText(), Parameter::isTime(), Str::name(), Str::notdir(), Str::replace(), and StrQueue::size().

Referenced by Parameter::allText(), Parameter::read(), Parameter::save(), Parameter::saveXML(), Parameter::text(), and Parameter::texts().

Str text ( const string &  format = "",
const string &  unit = "" 
) const

Returns the first value of a parameter. It is formatted as specified by the format string. See text() for more details. If the parameter is a number, then its value is returned in the unit specified by unit. If unit is empty, then outUnit() is used.

References Parameter::text().

void texts ( vector< string > &  s,
const string &  format = "",
const string &  unit = "" 
) const

Return in s all values of the parameter as a list of strings formatted according to format using unit. See text() for details.

References Parameter::size(), and Parameter::text().

Str allText ( const string &  format = "",
const string &  unit = "",
const string &  separator = ", " 
) const

Return all values of the parameter formatted according to format using unit, and concatenated using separator. See text() for details.

References Parameter::size(), and Parameter::text().

Parameter & setText ( const string &  strg)

Set value of text parameter to strg. The text is splitted into several strings at each '|'. Each of the strings is also converted into numbers. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::addText().

Referenced by Parameter::assign(), and Parameter::Parameter().

Parameter & setText ( const Parameter p)

Set value of text parameter to the one of p, if this and p are both of valueType() Text. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, Parameter::isText(), Parameter::name(), and StrQueue::size().

Parameter & addText ( const string &  strg,
bool  clear = false 
)
Str defaultText ( int  index,
const string &  format = "",
const string &  unit = "" 
) const
Str defaultText ( const string &  format = "",
const string &  unit = "" 
) const
Parameter & setDefaultText ( const string &  strg)

Set default value of text parameter to strg. The text is splitted into several strings at each '|'. Each of the strings is also converted into numbers.

References Parameter::addDefaultText(), and StrQueue::clear().

Referenced by Parameter::Parameter().

Parameter & addDefaultText ( const string &  strg)
Parameter & selectText ( const string &  strg,
int  add = 0 
)

If the text parameter has several values, then the value that is matched by strg is inserted as the first value. If strg does not match any of the text values strg is added to the text values and is marked as selected if add > 0, or if add == 0 and the SelectText - Bit in the Parameter's style is not set. If the value of the parameter is changing then the changedFlag() is set.

References StrQueue::add(), Parameter::addDate(), Parameter::addNumber(), Parameter::addTime(), StrQueue::assign(), Parameter::ChangedFlag, Parameter::day(), StrQueue::empty(), Parameter::empty(), StrQueue::erase(), StrQueue::find(), Parameter::hour(), StrQueue::insert(), Parameter::isDate(), Parameter::isText(), Parameter::isTime(), Parameter::minutes(), Parameter::month(), Str::preventFirst(), Str::preventLast(), Parameter::seconds(), Parameter::SelectText, StrQueue::size(), Parameter::size(), StrQueue::strip(), and Parameter::year().

Referenced by Parameter::assign(), and Parameter::read().

Parameter & selectText ( int  index)
int index ( void  ) const
int index ( const string &  strg) const

Returns the index of the value that matches strg.

References StrQueue::find(), and Parameter::isText().

bool isAnyNumber ( void  ) const
bool isNumber ( void  ) const

True if parameter is of type Number, i.e. its value is a floating-point number.

References Parameter::Number.

Referenced by Parameter::defaultText(), Parameter::save(), Parameter::saveXML(), Parameter::setFormat(), Parameter::setNumber(), and Parameter::text().

double number ( const string &  unit = "",
int  index = 0,
double  dflt = 0.0 
) const

Returns the index-th number value in the unit unit or in the internal standard unit, if unit is an empty string. If the Parameter is not a number, dflt is returned.

References Parameter::changeUnit(), Parameter::isAnyNumber(), and Parameter::isText().

Referenced by Parameter::assign(), Parameter::integer(), and Parameter::saveXML().

double number ( int  index,
const string &  unit = "",
double  dflt = 0.0 
) const
inline

Returns the index-th number value in the unit unit or in the internal standard unit, if unit is an empty string. If the Parameter is not a number, dflt is returned.

double number ( int  index,
double  dflt,
const string &  unit = "" 
) const
inline

Returns the index-th number value in the unit unit or in the internal standard unit, if unit is an empty string. If the Parameter is not a number, dflt is returned.

void numbers ( vector< double > &  n,
const string &  unit = "" 
) const

Return in n all number-values of the parameter in the unit unit.

References Parameter::changeUnit(), Parameter::isAnyNumber(), Parameter::isText(), and Parameter::size().

double error ( const string &  unit = "",
int  index = 0 
) const

Returns the standard deviation value of the index-th number in the unit unit or in the internal standard unit, if unit is an empty string. If no error value is set -1 is returned.

References Parameter::changeUnit(), Parameter::index(), Parameter::isAnyNumber(), and Parameter::isText().

Referenced by Parameter::assign(), Parameter::save(), and Parameter::saveXML().

double error ( int  index,
const string &  unit = "" 
) const
inline

Returns the standard deviation value of the index-th number in the unit unit or in the internal standard unit, if unit is an empty string. If no error value is set -1 is returned.

void errors ( vector< double > &  n,
const string &  unit = "" 
) const

Return in n all error-values of the parameter in the unit unit.

References Parameter::changeUnit(), Parameter::isAnyNumber(), Parameter::isText(), and Parameter::size().

Parameter & setNumber ( double  number,
double  error,
const string &  unit = "" 
)

Set number value to number and its standard deviation to error (only if it is non negative). The text value is set according to the specified format. The warning message is set if number is invalid. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::addNumber(), Parameter::isAnyNumber(), and Parameter::isText().

Referenced by Options::addNumber(), Parameter::Parameter(), Parameter::setBoolean(), Parameter::setInteger(), and Parameter::setNumbers().

Parameter& setNumber ( double  number,
const string &  unit = "" 
)
inline

Set number value to number. The text value is set according to the specified format. The warning message is set if number is invalid. If the value of the parameter is changing then the changedFlag() is set.

Parameter & setNumbers ( const vector< double > &  numbers,
const vector< double > &  errors,
const string &  unit = "" 
)

Set values to numbers and their standard deviations to errors. The text values are set according to the specified format. The warning message is set if numbers is invalid. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::addNumber(), Parameter::isAnyNumber(), Parameter::isText(), StrQueue::resize(), and Parameter::setNumber().

Referenced by Parameter::Parameter().

Parameter& setNumbers ( const vector< double > &  numbers,
double  error,
const string &  unit = "" 
)
inline

Set values to numbers and their standard deviation to error. The text values are set according to the specified format. The warning message is set if numbers is invalid. If the value of the parameter is changing then the changedFlag() is set.

Parameter& setNumbers ( const vector< double > &  numbers,
const string &  unit = "" 
)
inline

Set values to numbers and their standard deviation to -1.0. The text values are set according to the specified format. The warning message is set if numbers is invalid. If the value of the parameter is changing then the changedFlag() is set.

Parameter & setNumber ( const Parameter p)

Set number value, error, and unit to the ones of p, if this and p are both of valueType() Number. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, Parameter::isNumber(), and Parameter::name().

Parameter & addNumber ( double  number,
double  error,
const string &  unit = "",
bool  clear = false 
)

Add number to the number values and their standard deviation to error (only if it is non negative). A text value is added according to the specified format. The warning message is set if number is invalid. If the value of the parameter is changing then the changedFlag() is set. clear clears all values before adding the number (for internal use)

References Parameter::ChangedFlag, Parameter::changeUnit(), StrQueue::clear(), Str::empty(), Parameter::isAnyNumber(), Parameter::isBoolean(), Parameter::isText(), and Parameter::setUnit().

Referenced by Parameter::addInteger(), Parameter::addNumber(), Parameter::addText(), Parameter::assign(), Parameter::selectText(), Parameter::setNumber(), and Parameter::setNumbers().

Parameter& addNumber ( double  number,
const string &  unit = "" 
)
inline

Add number to the number values. A text value is added according to the specified format. The warning message is set if number is invalid. If the value of the parameter is changing then the changedFlag() is set.

Parameter & addNumber ( const Str s,
const string &  unit = "" 
)

Interpret s as a number and add it to the number values. The warning message is set if s is invalid. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::addNumber(), Parameter::isAnyNumber(), Parameter::isText(), Str::number(), and Parameter::unit().

bool isInteger ( void  ) const

True if parameter is of type Integer, i.e. its value is a integer number.

References Parameter::Integer.

Referenced by Parameter::defaultText(), Parameter::save(), Parameter::saveXML(), Parameter::setFormat(), Parameter::setInteger(), and Parameter::text().

long integer ( const string &  unit = "",
int  index = 0,
long  dflt = 0 
) const

Returns the index-th integer value in the unit unit or in the internal standard unit, if unit is an empty string. If the Parameter is not a number, dflt is returned.

References Parameter::isAnyNumber(), Parameter::isText(), and Parameter::number().

Referenced by Parameter::assign().

long integer ( int  index,
const string &  unit = "",
long  dflt = 0 
) const
inline

Returns the index-th integer value in the unit unit or in the internal standard unit, if unit is an empty string. If the Parameter is not a number, dflt is returned.

long integer ( int  index,
long  dflt,
const string &  unit = "" 
) const
inline

Returns the index-th integer value in the unit unit or in the internal standard unit, if unit is an empty string. If the Parameter is not a number, dflt is returned.

void integers ( vector< long > &  n,
const string &  unit = "" 
) const

Return in n all integer-values of the parameter in the unit unit.

References Parameter::changeUnit(), Parameter::isAnyNumber(), Parameter::isText(), and Parameter::size().

void integers ( vector< int > &  n,
const string &  unit = "" 
) const

Return in n all integer-values of the parameter in the unit unit.

References Parameter::changeUnit(), Parameter::isAnyNumber(), Parameter::isText(), and Parameter::size().

Parameter & setInteger ( long  number,
long  error,
const string &  unit = "" 
)

Set integer value to number and its standard deviation to error. The warning message is set if number is invalid. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::isAnyNumber(), Parameter::isText(), and Parameter::setNumber().

Referenced by Parameter::Parameter().

Parameter& setInteger ( long  number,
const string &  unit = "" 
)
inline

Set integer value to number. The warning message is set if number is invalid. If the value of the parameter is changing then the changedFlag() is set.

Parameter & setInteger ( const Parameter p)

Set integer value, error, and unit to the ones of p, if this and p are both of valueType() Integer. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, Parameter::isInteger(), and Parameter::name().

Parameter & addInteger ( long  number,
long  error,
const string &  unit = "" 
)

Add number and error to the integer values. The warning message is set if number is invalid.

References Parameter::addNumber(), Parameter::isAnyNumber(), and Parameter::isText().

Parameter& addInteger ( long  number,
const string &  unit = "" 
)
inline

Add number to the integer values. The warning message is set if number is invalid.

double defaultNumber ( const string &  unit = "",
int  index = 0 
) const

Returns the default number value in the unit unit or in the internal standard unit, if unit is an empty string.

References Parameter::changeUnit(), Parameter::isAnyNumber(), and Parameter::isText().

Referenced by Parameter::defaultInteger().

double defaultNumber ( int  index,
const string &  unit = "" 
) const
inline
Parameter & setDefaultNumber ( double  number,
const string &  unit = "" 
)

Set default number value to number. The default text value is set according to the specified format. The warning message is set if number is invalid.

References Parameter::addDefaultNumber(), StrQueue::clear(), Parameter::isAnyNumber(), and Parameter::isText().

Referenced by Parameter::Parameter(), Parameter::setDefaultBoolean(), and Parameter::setDefaultInteger().

Parameter & addDefaultNumber ( double  number,
const string &  unit = "" 
)

Add number to the default number values. A text value is added according to the specified format. The warning message is set if number is invalid.

References Parameter::changeUnit(), Str::empty(), Parameter::isAnyNumber(), Parameter::isBoolean(), Parameter::isText(), and Parameter::setUnit().

Referenced by Parameter::addDefaultInteger(), Parameter::addDefaultNumber(), Parameter::addDefaultText(), and Parameter::setDefaultNumber().

Parameter & addDefaultNumber ( const Str s,
const string &  unit = "" 
)

Interpret s as a number and add it to the default number values. The warning message is set if s is invalid.

References Parameter::addDefaultNumber(), Str::DoubleWhiteSpace, Parameter::isAnyNumber(), Parameter::isText(), Str::number(), and Parameter::unit().

long defaultInteger ( const string &  unit = "",
int  index = 0 
) const

Returns the default ineger value in the unit unit or in the internal standard unit, if unit is an empty string.

References Parameter::defaultNumber(), Parameter::isAnyNumber(), and Parameter::isText().

long defaultInteger ( int  index,
const string &  unit = "" 
) const
inline
Parameter & setDefaultInteger ( long  dflt,
const string &  unit = "" 
)

Set default integer value to dflt. The default text value is also set. The warning message is set if dflt is invalid.

References Parameter::isAnyNumber(), Parameter::isText(), and Parameter::setDefaultNumber().

Referenced by Parameter::Parameter().

Parameter & addDefaultInteger ( double  number,
const string &  unit = "" 
)

Add number to the default integer values. A text value is added according to the specified format. The warning message is set if number is invalid.

References Parameter::addDefaultNumber(), Parameter::isAnyNumber(), and Parameter::isText().

double minimum ( const string &  unit = "") const

Returns the minimum value allowed for number or integer parameter values in the unit unit or in the internal standard unit, if unit is an empty string.

References Parameter::changeUnit(), and Parameter::isAnyNumber().

Referenced by Parameter::setMinMax().

double maximum ( const string &  unit = "") const

Returns the maximum value allowed for number or integer parameter values in the unit unit or in the internal standard unit, if unit is an empty string.

References Parameter::changeUnit(), and Parameter::isAnyNumber().

Referenced by Parameter::setMinMax().

double step ( const string &  unit = "") const

Returns the step size of number or integer parameters in the unit unit or in the internal standard unit, if unit is an empty string.

References Parameter::changeUnit(), and Parameter::isAnyNumber().

Referenced by Parameter::assign(), Parameter::setMinMax(), and Parameter::setStep().

Parameter & setStep ( double  step,
const string &  unit = "" 
)
Parameter & setStep ( long  step)
Parameter & setMinMax ( double  minimum = -MAXDOUBLE,
double  maximum = MAXDOUBLE,
double  step = 1.0,
const string &  unit = "" 
)

Set minimum and maximum values of a number parameter to minimum and maximum, respectively. The warning message is set if minimum or maximum is invalid.

References Parameter::changeUnit(), Parameter::isAnyNumber(), Parameter::maximum(), Parameter::minimum(), and Parameter::setStep().

Referenced by Parameter::assign(), Parameter::Parameter(), and Parameter::setMinMax().

Parameter & setMinMax ( long  minimum = LONG_MIN,
long  maximum = LONG_MAX,
long  step = 1,
const string &  unit = "" 
)

Set minimum and maximum values of an integer parameter to minimum and maximum, respectively. The warning message is set if minimum or maximum is invalid.

References Parameter::isAnyNumber(), Parameter::maximum(), Parameter::minimum(), Parameter::setMinMax(), and Parameter::step().

Parameter& setMinMax ( int  minimum,
int  maximum,
int  step = 1,
const string &  unit = "" 
)
inline

Set minimum and maximum values of an integer parameter to minimum and maximum, respectively. The warning message is set if minimum or maximum is invalid.

double floorLog10 ( double  v)
static

Returns the largest power of ten smaller or equal to v.

Referenced by Parameter::ceil10(), and Parameter::floor10().

double floor10 ( double  v,
double  scale = 1.0 
)
static

Returns the next smaller multiple of floorLog10( v ). This is flooring to the leading digit. For example: 23.7 -> 20, 1.45 -> 1. scale determines to which digit the number should be floored. For example with scale = 0.1 you get 23.7 -> 23, 1.45 -> 1.4

References Parameter::floorLog10().

double ceil10 ( double  v,
double  scale = 1.0 
)
static

Returns the next larger multiple of floorLog10( v ). This is ceiling to the leading digit. For example: 23.7 -> 30, 1.45 -> 2. scale determines to which digit the number should be ceiled. For example with scale = 0.1 you get 23.7 -> 24, 1.45 -> 1.5

References Parameter::floorLog10().

Referenced by Parameter::assign().

Str unit ( void  ) const

Returns the internal unit of the numbers.

Referenced by Parameter::addDefaultNumber(), Parameter::addNumber(), Parameter::assign(), and Parameter::saveXML().

Str outUnit ( void  ) const

Returns the unit to be used for output.

Referenced by Parameter::save(), and Parameter::saveXML().

Parameter & setUnit ( const string &  internunit,
const string &  outputunit = "" 
)

Set unit of numbers to internunit. The unit used for output and dialogs is set to outputunit. If outputunit is empty it is set to internunit.

Referenced by Parameter::addDefaultNumber(), Parameter::addNumber(), Parameter::assign(), and Parameter::Parameter().

Parameter & setOutUnit ( const string &  outputunit)

Set the unit used for output and dialogs to outputunit.

Parameter & changeUnit ( string  internunit)
bool isBoolean ( void  ) const
bool boolean ( int  index = 0) const

Returns the index-th boolean value.

References Parameter::isAnyNumber(), and Parameter::isText().

Referenced by Parameter::save(), and Parameter::saveXML().

void booleans ( vector< bool > &  n) const

Return in n all boolean-values of the parameter.

References Parameter::isAnyNumber(), Parameter::isText(), and Parameter::size().

Parameter & setBoolean ( bool  b)

Set value of boolean parameter to b. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::isAnyNumber(), Parameter::isText(), and Parameter::setNumber().

Referenced by Parameter::Parameter().

Parameter & setBoolean ( const Parameter p)

Set boolean value to the one of p, if this and p are both of valueType() Boolean. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, Parameter::isBoolean(), and Parameter::name().

bool defaultBoolean ( int  index = 0) const

Returns the index-th default boolean value.

References Parameter::isAnyNumber(), and Parameter::isText().

Parameter & setDefaultBoolean ( bool  dflt)

Set default boolean value to dflt.

References Parameter::isAnyNumber(), Parameter::isText(), and Parameter::setDefaultNumber().

Referenced by Parameter::Parameter().

bool isDate ( void  ) const
int year ( int  index = 0) const
int month ( int  index = 0) const
int day ( int  index = 0) const
void date ( int &  year,
int &  month,
int &  day,
int  index = 0 
) const

Returns the index-th date.

Parameters
[out]yearIf Parameter is not a Date or index is invalid, 0 is returned.
[out]monthIf Parameter is not a Date or index is invalid, 0 is returned.
[out]dayIf Parameter is not a Date or index is invalid, 0 is returned.
[in]indexdetermines which one of the size() stored date values is returned in year, month, and day.
See Also
year(), month(), day(), setDate()

References Parameter::index(), and Parameter::isDate().

Referenced by Parameter::assign().

Parameter & setDate ( int  year,
int  month,
int  day 
)

Set date of date parameter to year, month, and day. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, StrQueue::clear(), Parameter::day(), and Parameter::isDate().

Referenced by Parameter::Parameter(), Parameter::setCurrentDate(), and Parameter::setDate().

Parameter & addDate ( int  year,
int  month,
int  day 
)

Add date year, month, and day to date parameter. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, and Parameter::isDate().

Referenced by Parameter::addText(), Parameter::assign(), and Parameter::selectText().

Parameter & setDate ( const string &  date)

Set date of date parameter to date. See Str::date() for valid date strings. If the value of the parameter is changing then the changedFlag() is set.

References Str::date(), Parameter::day(), Parameter::month(), Parameter::setDate(), and Parameter::year().

Parameter & setDate ( const struct tm &  date)

Set date of date parameter to date. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::day(), Parameter::month(), Parameter::setDate(), and Parameter::year().

Parameter & setDate ( const time_t &  time)

Set date of date parameter to the date of time. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::setDate().

Parameter & setCurrentDate ( void  )

Set date of date parameter to the current date. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::setDate(), and Parameter::time().

Parameter & setDate ( const Parameter p)

Set date value to the one of p, if this and p are both of valueType() Date. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, Parameter::isDate(), and Parameter::name().

int defaultYear ( int  index = 0) const
Returns
the index-th default year.
See Also
defaultMonth(), defaultDay(), defaultText()

References Parameter::index(), and Parameter::isDate().

int defaultMonth ( int  index = 0) const
Returns
the index-th default month.
See Also
defaultYear(), defaultDay(), defaultText()

References Parameter::index(), and Parameter::isDate().

int defaultDay ( int  index = 0) const
Returns
the index-th default day of the month.
See Also
defaultYear(), defaultMonth(), defaultText()

References Parameter::index(), and Parameter::isDate().

void defaultDate ( int &  year,
int &  month,
int &  day,
int  index = 0 
) const

Returns the index-th default date.

Parameters
[out]yearIf Parameter is not a Date or index is invalid, 0 is returned.
[out]monthIf Parameter is not a Date or index is invalid, 0 is returned.
[out]dayIf Parameter is not a Date or index is invalid, 0 is returned.
[in]indexdetermines which one of the size() stored default date values is returned in year, month, and day.
See Also
defaultYear(), defaultMonth(), defaultDay(), setDefaultDate()

References Parameter::index(), and Parameter::isDate().

Parameter & setDefaultDate ( int  year,
int  month,
int  day 
)

Set default date of date parameter to year, month, and day.

References StrQueue::clear(), and Parameter::isDate().

Referenced by Parameter::Parameter(), and Parameter::setDefaultDate().

Parameter & addDefaultDate ( int  year,
int  month,
int  day 
)

Add year, month, and day to default date of date parameter.

References Parameter::isDate().

Referenced by Parameter::addDefaultText().

Parameter & setDefaultDate ( const string &  date)

Set default date of date parameter to date. See Str::date() for valid date strings.

References Str::date(), Parameter::day(), Parameter::month(), Parameter::setDefaultDate(), and Parameter::year().

bool isTime ( void  ) const
int hour ( int  index = 0) const
int minutes ( int  index = 0) const
int seconds ( int  index = 0) const
int milliSeconds ( int  index = 0) const
Returns
the index-th milliseconds.
See Also
hour(), minutes(), seconds(), text()

References Parameter::index(), and Parameter::isTime().

void time ( int &  hour,
int &  minutes,
int &  seconds,
int &  milliseconds,
int  index = 0 
) const

Returns the index-th time.

Parameters
[out]hourIf Parameter is not a Time or index is invalid, 0 is returned.
[out]minutesIf Parameter is not a Time or index is invalid, 0 is returned.
[out]secondsIf Parameter is not a Time or index is invalid, 0 is returned.
[out]millisecondsIf Parameter is not a Time or index is invalid, 0 is returned.
[in]indexdetermines which one of the size() stored time values is returned in hour, minutes, and seconds.
See Also
hour(), minutes(), seconds(), milliSeconds(), setTime()

References Parameter::index(), and Parameter::isTime().

Referenced by Parameter::assign(), Parameter::setCurrentDate(), and Parameter::setCurrentTime().

Parameter & setTime ( int  hour,
int  minutes,
int  seconds,
int  milliseconds = 0 
)

Set time of time parameter to hour, minutes, seconds, and milliseconds. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, StrQueue::clear(), and Parameter::isTime().

Referenced by Parameter::Parameter(), Parameter::setCurrentTime(), and Parameter::setTime().

Parameter & addTime ( int  hour,
int  minutes,
int  seconds,
int  milliseconds = 0 
)

Add time hour, minutes, seconds, and milliseconds to time parameter. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, and Parameter::isTime().

Referenced by Parameter::addText(), Parameter::assign(), and Parameter::selectText().

Parameter & setTime ( const string &  time)

Set time of time parameter to time. See Str::time() for valid date strings. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::hour(), Parameter::minutes(), Parameter::seconds(), Parameter::setTime(), and Str::time().

Parameter & setTime ( const struct tm &  time)

Set time of time parameter to time. If the value of the parameter is changing then the changedFlag() is set.

Note
the milliseconds are set to 0.

References Parameter::hour(), Parameter::minutes(), Parameter::seconds(), and Parameter::setTime().

Parameter & setTime ( const time_t &  time)

Set time of time parameter to time. If the value of the parameter is changing then the changedFlag() is set.

Note
the milliseconds are set to 0.

References Parameter::setTime().

Parameter & setCurrentTime ( void  )

Set time of time parameter to the current time. If the value of the parameter is changing then the changedFlag() is set.

Note
the milliseconds are set to 0.

References Parameter::setTime(), and Parameter::time().

Parameter & setTime ( const Parameter p)

Set time value to the one of p, if this and p are both of valueType() Time. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::ChangedFlag, Parameter::isTime(), and Parameter::name().

int defaultHour ( int  index = 0) const
Returns
the index-th default hour.
See Also
defaultMinutes(), defaultSeconds(), defaultMilliSeconds(), defaultText()

References Parameter::index(), and Parameter::isTime().

int defaultMinutes ( int  index = 0) const
Returns
the index-th default minutes.
See Also
defaultHour(), defaultSeconds(), defaultMilliSeconds(), defaultText()

References Parameter::index(), and Parameter::isTime().

int defaultSeconds ( int  index = 0) const
Returns
the index-th default seconds.
See Also
defaultHour(), defaultMinutes(), defaultMilliSeconds(), defaultText()

References Parameter::index(), and Parameter::isTime().

int defaultMilliSeconds ( int  index = 0) const
Returns
the index-th default milliseconds.
See Also
defaultHour(), defaultMinutes(), defaultSeconds(), defaultText()

References Parameter::index(), and Parameter::isTime().

void defaultTime ( int &  hour,
int &  minutes,
int &  seconds,
int &  milliseconds,
int  index = 0 
) const

Returns the index-th default time.

Parameters
[out]hourIf Parameter is not a Time or index is invalid, 0 is returned.
[out]minutesIf Parameter is not a Time or index is invalid, 0 is returned.
[out]secondsIf Parameter is not a Time or index is invalid, 0 is returned.
[out]millisecondsIf Parameter is not a Time or index is invalid, 0 is returned.
[in]indexdetermines which one of the size() stored default time values is returned in hour, minutes, seconds, and milliseconds.
See Also
defaultHour(), defaultMinutes(), defaultSeconds(), defaultMilliSeconds(), setDefaultTime()

References Parameter::index(), and Parameter::isDate().

Parameter & setDefaultTime ( int  hour,
int  minutes,
int  seconds,
int  milliseconds = 0 
)

Set default time of time parameter to hour, minutes, milliseconds, and seconds.

References StrQueue::clear(), and Parameter::isTime().

Referenced by Parameter::Parameter(), and Parameter::setDefaultTime().

Parameter & addDefaultTime ( int  hour,
int  minutes,
int  seconds,
int  milliseconds = 0 
)

Add time hour, minutes, seconds, and milliseconds to default of time parameter to.

References Parameter::isTime().

Referenced by Parameter::addDefaultText().

Parameter & setDefaultTime ( const string &  time)

Set default time of time parameter to time. See Str::time() for valid date strings.

References Parameter::hour(), Parameter::minutes(), Parameter::seconds(), Parameter::setDefaultTime(), and Str::time().

bool isNotype ( void  ) const

True if parameter is of no type.

References Parameter::NoType.

Referenced by Parameter::addText(), Parameter::assign(), and Parameter::save().

bool empty ( void  ) const

True if parameter is of no type and has no name.

References Str::empty(), and Parameter::NoType.

Referenced by Parameter::addDefaultText(), Parameter::addText(), Parameter::saveXML(), and Parameter::selectText().

Parameter & setDefault ( void  )

Set value of parameter to its default.

References Parameter::ChangedFlag, Parameter::isDate(), Parameter::isTime(), and StrQueue::size().

Parameter & setToDefault ( void  )

Set default of parameter to its value.

References Parameter::isDate(), and Parameter::isTime().

Referenced by Parameter::Parameter().

Parameter & setActivation ( const string &  name,
const string &  value,
bool  activate = true 
)

Connect this Parameter to another Parameter with identifyer name. Such that in a dialog (like OptWidget) setting the value of the parameter name to value will activate (activate = true) or inactivate (activate = false) this Parameter. Several values can be supplied by seperating them by '|'. A numerical value can be preceeded by '=', '>', '>=', '<', '<=', '<>' to determine the way of a numerical comparison. Numerical values can be supplied with a unit. If no unit is given, then the internally used unit is assumed.

See Also
addActivation(), clearActivation(), activations(), activationName(), activationValue(), activationValues(), activationNumber(), activationComparison(), activation()

References Parameter::addActivation(), and Parameter::clearActivation().

Parameter & addActivation ( const string &  name,
const string &  value,
bool  activate = true 
)

Connect this Parameter to an additional Parameter with identifyer name. Such that in a dialog (like OptWidget) setting the value of the parameter name to value will activate (activate = true) or inactivate (activate = false) this Parameter. Several values can be supplied by seperating them by '|'. A numerical value can be preceeded by '=', '>', '>=', '<', '<=', '<>' to determine the way of a numerical comparison. Numerical values can be supplied with a unit. If no unit is given, then the internally used unit is assumed.

See Also
setActivation(), clearActivation(), activations(), activationName(), activationValue(), activationValues(), activationNumber(), activationComparison(), activation()

References Str::number(), and Str::unit().

Referenced by Parameter::setActivation().

Parameter & clearActivation ( void  )

Disconnect this Parameter from other Parameters that can activate or inactivate it.

See Also
setActivation(), addActivation(), activations(), activationName(), activationValue(), activationValues(), activation()

Referenced by Parameter::setActivation().

int activations ( void  ) const
string activationName ( int  index = 0) const

The name of the index-th Parameter that might activate or inactivate this Parameter.

See Also
setActivation(), addActivation(), clearActivation(), activations(), activationValue(), activationValues(), activation()

References Parameter::index().

string activationValue ( int  index = 0) const

The first value of the index-th Parameter on which this Parameter is activated or inactivated.

See Also
setActivation(), addActivation(), clearActivation(), activations(), activationValues(), activationNumber(), activationName(), activation()

References Parameter::index().

string activationValues ( int  index = 0) const

All values of the index-th Parameter on which this Parameter is activated or inactivated separated by '|'.

See Also
setActivation(), addActivation(), clearActivation(), activations(), activationValue(), activationNumber(), activationName(), activation()

References Parameter::index().

double activationNumber ( int  index = 0) const

The numerical value of the index-th Parameter on which this Parameter is activated or inactivated according to activationComparison( index ).

See Also
activationUnit(), setActivation(), addActivation(), clearActivation(), activations(), activationComparison(), activationValue(), activationName(), activation()

References Parameter::index().

string activationUnit ( int  index = 0) const

The unit corresponding to the numerical value of the index-th Parameter on which this Parameter is activated or inactivated according to activationComparison( index ).

See Also
activationNumber(), setActivation(), addActivation(), clearActivation(), activations(), activationComparison(), activationValue(), activationName(), activation()

References Parameter::index().

int activationComparison ( int  index = 0) const

The type of numerical comparison used for activating or inactivating this Parameter by the index-th Parameter.

See Also
setActivation(), addActivation(), clearActivation(), activations(), activationNumber(), activationValue(), activationName(), activation()

References Parameter::index().

bool activation ( int  index = 0) const

If true, this Parameter is activated, otherwise inactivated, whenever the Parameter with identifier activationName( index ) takes on the value activationValue( index).

See Also
setActivation(), addActivation(), clearActivation(), activations(), activationNumber(), activationName(), activationValue(), activationValues()

References Parameter::index().

bool testActivation ( int  index,
const string &  value 
)

Set the status of comparisopn index to true if value matches one of the activation values activationValues( index ).

Returns
true if all the test have their status set to true.
See Also
setActivation(), addActivation(), activations(), activationValue(), activationValues()

References Parameter::index().

Referenced by Parameter::testActivation().

bool testActivation ( int  index,
double  value,
double  tol = 1e-8 
)

Set the status of comparisopn index to true true if value matches the activation number and type of comparison within the given tolerance tol.

Returns
true if all the test have their status set to true.
See Also
setActivation(), addActivation(), activations(), activationNumber(), activationComparison()

References Parameter::changeUnit(), Parameter::format(), Str::format(), Parameter::index(), and Parameter::testActivation().

string save ( int  flags = 0) const

Return string in the format "name: value". Use for flags values from Options::SaveFlags to modify the way how the Parameter is written to the string.

Referenced by relacs::operator<<().

ostream & save ( ostream &  str,
int  width = 0,
int  flags = 0 
) const
ostream & save ( ostream &  str,
const string &  textformat,
const string &  numberformat,
const string &  boolformat,
const string &  dateformat,
const string &  timeformat 
) const

Write parameter to stream str according to the formats textformat, numberformat, boolformat, dateformat, and timeformat.

Note
No newline is added to the stream.

References Parameter::isBoolean(), Parameter::isDate(), Parameter::isInteger(), Parameter::isNotype(), Parameter::isNumber(), Parameter::isText(), Parameter::isTime(), and Parameter::text().

ostream & saveXML ( ostream &  str,
int  level = 0,
int  indent = 4,
int  flags = 0 
) const

Write parameter in XML format to output stream.

Parameters
[in]strthe output stream
[in]levelthe level of indentation
[in]indentthe indentation depth, i.e. number of white space characters per level
[in]flagsmodify the way how the Parameter is written to the stream. See Options::SaveFlags for possible values
Returns
the output stream str

References Parameter::boolean(), Parameter::empty(), Parameter::error(), Options::FirstOnly, Parameter::format(), Parameter::isBoolean(), Parameter::isDate(), Parameter::isInteger(), Parameter::isNumber(), Parameter::isText(), Parameter::isTime(), Parameter::ListAlways, Parameter::name(), Parameter::number(), Parameter::outUnit(), Options::PrintRequest, Options::PrintType, Parameter::request(), Parameter::size(), Str::strip(), Parameter::text(), and Parameter::unit().

bool read ( const Str s,
const string &  assignment = ":=" 
)

Read parameter value from string s if it has the same name. Uses assign() to assign the value of the parameter. Returns true if a value was assigned. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::assign(), Str::ident(), and Str::value().

bool read ( const Parameter p)

Read parameter value from p if it has the same name. Numbers and Errors are converted from p's unit to the internal unit of the parameter. Returns true if a value was assigned. If the value of the parameter is changing then the changedFlag() is set.

References Parameter::addText(), Parameter::ChangedFlag, Parameter::changeUnit(), StrQueue::clear(), StrQueue::empty(), Parameter::isAnyNumber(), Parameter::isDate(), Parameter::isText(), Parameter::isTime(), Parameter::name(), Parameter::SelectText, Parameter::selectText(), Parameter::size(), Parameter::style(), and Parameter::text().

double changeUnit ( double  val,
const Str oldunit,
const Str newunit 
)
static

Returns the value of val given in oldunit in the unit newunit. oldunit and newunit both are strings containing an optional number and an unit. if oldUnit or newUnit does not contain an unit, it is assumed that the units are both the same.

References Str::number(), relacs::NUnits, Str::unit(), relacs::UnitFac, and relacs::UnitPref.

Parameter & addSelectOption ( const std::string &  option)

Adds a selectable option

Referenced by Parameter::assign().

Parameter & removeSelectOption ( const std::string &  option)

Removes a selectable option

Parameter & clearSelectOptions ( )

Clears selectable option list

Referenced by Parameter::assign(), and Parameter::clear().

const std::set< std::string > & selectOptions ( ) const

Returns list of all selectable options

std::string selectOption ( int  index) const

Returns the selectable option at a cetain index

Referenced by Parameter::save().

int selectOptionsSize ( ) const

Returns number of selectable options

Friends And Related Function Documentation

bool operator== ( const Parameter p1,
const Parameter p2 
)
friend

Returns true if the two Parameters p1 and p2 are equal, i.e. they have the same name.

bool operator== ( const Parameter p,
const string &  name 
)
friend

Returns true if the Parameter p has an name equal to name.

ostream& operator<< ( ostream &  str,
const Parameter p 
)
friend

Write parameter to stream str using save()

Member Data Documentation

const int ChangedFlag = 16384
static
const int NonDefault = -32768
static

Use this flag to select Parameter whose value differs from their default value.

Referenced by Parameter::flags().

const long SelectText = 0x01000000
static

If this bit is set in the Parameter's style you can only select from text options with multiple values, but not add new values.

Referenced by Options::addSelection(), Parameter::assign(), Options::insertSelection(), Parameter::read(), and Parameter::selectText().

const long MultipleSelection = 0x00800000
static

If this bit is set in the Parameter's style you can select multiple values.

const int ListAlways = 0x02000000
static

If this bit is set in the Parameter's style all values of the parameter get saved even if only the first value is requested to be saved.

Referenced by Parameter::save(), and Parameter::saveXML().

const int Select = 0x00400000 | MultipleSelection
static

If this bit is set in the Parameter's style it acts like a combo box in combination with MultipleSelection bit

Referenced by Parameter::assign(), and Parameter::save().


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