ML Reference
|
Field to encapsulate a boolean value as integer. More...
#include <mlFields.h>
Public Member Functions | |
ToggleField () | |
Default constructor, do not use it. | |
ToggleField (const std::string &name) | |
Constructor, creates a field with a name to hold an integer value representing a true or false value (0 = false, all other values are true). | |
void | setStringValue (const std::string &value) |
Sets value of the field to value . | |
void | setIntValue (int intValue) |
Sets field value to intValue . | |
void | setToggleValue (bool b) |
Sets field value to 1 if true, otherwise to false. | |
void | toggleValue () |
If field value is non 0 (=true) then it is set to 0 (=false). | |
std::string | getStringValue () const |
Returns the value of the field as a string value. | |
int | getIntValue () const |
Returns the value of the field as an integer. | |
bool | isOn () const |
Returns field value as a Boolean value (false if 0 and true if non zero). | |
Deprecated | |
void | switch_Value () |
ToggleField (const std::string &name, int *valuePtr) | |
Protected Member Functions | |
virtual void | setValueFromField (const Field &field) |
Reimplementation from Field which copies the field value more efficiently. |
Field to encapsulate a boolean value as integer.
Definition at line 246 of file mlFields.h.
ml::ToggleField::ToggleField | ( | ) |
Default constructor, do not use it.
ml::ToggleField::ToggleField | ( | const std::string & | name | ) |
Constructor, creates a field with a name
to hold an integer value representing a true or false value (0 = false, all other values are true).
Default value is 0 (false).
ml::ToggleField::ToggleField | ( | const std::string & | name, |
int * | valuePtr | ||
) |
int ml::ToggleField::getIntValue | ( | ) | const |
Returns the value of the field as an integer.
std::string ml::ToggleField::getStringValue | ( | ) | const [virtual] |
Returns the value of the field as a string value.
setStringValue must be able to reinterpret this returned string correctly.
Implements ml::Field.
bool ml::ToggleField::isOn | ( | ) | const |
Returns field value as a Boolean value (false if 0 and true if non zero).
void ml::ToggleField::setIntValue | ( | int | intValue | ) |
Sets field value to intValue
.
void ml::ToggleField::setStringValue | ( | const std::string & | value | ) | [virtual] |
Sets value of the field to value
.
Implements ml::Field.
void ml::ToggleField::setToggleValue | ( | bool | b | ) |
Sets field value to 1 if true, otherwise to false.
virtual void ml::ToggleField::setValueFromField | ( | const Field & | field | ) | [protected, virtual] |
void ml::ToggleField::switch_Value | ( | ) |
void ml::ToggleField::toggleValue | ( | ) |
If field value is non 0 (=true) then it is set to 0 (=false).
If field value is 0 (=false) then it is set to 1 (=true).