Scanframe Modular Application 0.1.0
|
Class for creating and referencing global or local created parameters or settings called variables. This class allows linking of member functions of other classes to handle events generated. See the Example on how to use this class and the 'TVariableHandler' template class. More...
#include <Variable.h>
Public Member Functions | |
Variable () | |
Default constructor for a default global variable. | |
Variable (const Variable &v) | |
Copy constructor. Copies also the Desired ID data member. | |
Variable (id_type id, bool set_desired) | |
Creates an instance having a reference with 'id'. | |
Variable (const std::string &definition, id_type id_ofs=0) | |
Creates a variable according to the definition std::string passed to it. | |
Variable (const Definition &def, id_type id_ofs=0) | |
Creates a variable using the passed definition structure. | |
~Variable () override | |
Virtual destructor. | |
bool | setup (const std::string &definition, id_type id_ofs=0) |
Creates a variable according to the definition std::string passed to it. | |
bool | setup (const Definition &definition, Variable::id_type id_ofs=0) |
Creates a variable using the definition structure. | |
bool | setup (const Variable &v) |
Sets reference to other variable. This is the only way for local variables. | |
bool | setup (id_type id, bool set_did=false) |
Sets reference to other by id. | |
bool | setId (id_type id, bool skip_self=false) |
Only for local non exported owning variables to set the id after setup is called using a string. | |
bool | isValid () const |
Checks validity of the attached reference and used after a setup call. | |
bool | isConverted () const |
Returns true is the current instance is converting floating point values. | |
bool | setConvert (bool enable) |
Enables or disables conversion of floating point values. | |
bool | isNumber () const |
Returns whether the value is a number or not. | |
void | makeOwner () |
Makes this instance owner of this variable instance and emits the appropriate events. | |
Variable & | getOwner () |
Gets a reference to the owner/server instance of this variable. | |
bool | isOwner () const |
Returns if this is the owner of this variable. | |
bool | isGlobal () const |
Returns true if this instance is a global variable or not. | |
bool | setGlobal (bool global) |
Sets the variable to be global. | |
bool | setExport (bool global) |
Makes an owning local variable appear globally. | |
bool | isExported () const |
Checks if the variable is an exported local variable. | |
bool | isTemporary () |
Checks if a temporary is used instead of current actual value. | |
void | setTemporary (bool on_off) |
When true is passed a local temporary value is used instead of current. | |
bool | applyTemporary (bool skip_self=true) |
Applies the temporary value of this instance. | |
bool | updateTemporary (bool skip_self=false) |
Updates the temporary value with the real value. | |
bool | isTemporaryDifferent () const |
Check if the temporary value differs from the actual value. | |
void | setHandler (VariableHandler *handler) |
Only one link is available at a time. | |
VariableHandler * | getHandler () const |
Returns the link Set by setHandler(). | |
VariableHandler * | getConvertHandler () const |
Returns the link to the global conversion handler. | |
Variable::size_type | emitEvent (EEvent event, bool skip_self=false) |
Initiate event for all instances of this variable depending on the event value. | |
void | setDesiredId () |
Sets the desired id member variable to the current attached reference id. | |
void | setDesiredId (id_type id) |
Sets the desired id member variable to the passed id. | |
template<typename T > | |
void | setData (T data) |
Sets the data for this instance for user purposes. | |
template<typename T = uint64_t> | |
T | getData () const |
Gets the data for this instance for user purposes Set with setData(). | |
bool | setCur (const Value &value, bool skip_self=false) |
Both return true if there was a change and notify all variables of the same variable id through an event. | |
bool | setCur (const Value &value, bool skip_self=false) const |
Same as setCur() but for const instances objects of this instance. | |
bool | loadCur (const Value &value) const |
Used in settings loading routines which use the owner to Set a new value. | |
bool | increase (int steps, bool skip_self=false) |
Increase current variable value by step increments also negative values. | |
bool | unsetFlag (flags_type flag, bool skip_self=false) |
Unsets a flag or multiple flags of the attached VariableReference. | |
bool | setFlag (flags_type flag, bool skip_self=false) |
Sets a flag or multiple flags on the reference. | |
bool | updateFlags (flags_type flags, bool skip_self=false) |
Replaces all flags with the passed flags. | |
flags_type | getFlags () const |
Returns the flags at the time the instance was created. | |
flags_type | getCurFlags () const |
Returns the current flags for this instance. | |
bool | setConvertValues (const std::string &unit, const Value &multiplier, const Value &offset, int digits=std::numeric_limits< int >::max()) |
Sets the global conversion values and signals the clients. | |
bool | setConvertValues (bool convert=true) |
Enables or disables unit conversion. | |
id_type | getId () const |
Returns the current attached ID. | |
id_type | getDesiredId () const |
Returns the desired id of this instance. | |
std::string | getName (int levels=0) const |
Gets the name or a part of the name of the attached variable. | |
int | getNameLevelCount () const |
Returns the amount of levels of the full name path. | |
std::string | getUnit () const |
Returns variable unit. | |
std::string | getUnit (bool converted) const |
Returns variable unit of converted or non-converted value. | |
std::string | getConvertOption () const |
Returns the conversion option string. | |
EStringType | getStringType () const |
The type is determined by the character in the unit field of the setup string. | |
std::string | getDescription () const |
Gets the purpose description of the attached variable. | |
bool | isFlag (int flag) const |
Returns if a flag or flags has been set. | |
std::string | getCurFlagsString () const |
Returns the current flags in a std::string form. | |
std::string | getFlagsString () const |
bool | isReadOnly () const |
Returns if variable is allowed to change its value. | |
int | getSigDigits () const |
Gets the normalized decimal point location for this instance. | |
int | getSigDigits (bool converted) const |
Gets the normalized decimal point location for this instance converted or not converted. | |
int | getRequiredDigits () const |
Gets the required digits for this instance based on round, min and max values. Converted or not the value is the same. This method is useful for drawing a scale using numberString() | |
const Value & | getDef () const |
Return the variable default value. | |
const Value & | getMin () const |
Return the variable Minimum value. | |
const Value & | getMax () const |
Return the variable Maximum value. | |
const Value & | getRnd () const |
Return the variable Rounding value. | |
const Value & | getCur () const |
Return the variable current value. | |
const Value & | getDef (bool converted) const |
Gets the default value converted or not Is converted independent of the conversion flag. | |
const Value & | getMin (bool converted) const |
Gets the Minimum value converted or not converted independent of the conversion flag. | |
const Value & | getMax (bool converted) const |
Gets the Maximum value converted or not converted independent of the conversion flag. | |
const Value & | getRnd (bool converted) const |
Gets the Rounding value converted or not converted independent of the conversion flag. | |
const Value & | getCur (bool converted) const |
Gets the current value converted or not converted independent of the conversion flag. | |
const State::Vector & | getStates () const |
Returns the complete state vector as a reference. | |
size_type | getUsageCount () const |
Returns the usage count of this variable reference. | |
size_type | getStateCount () const |
Returns the state count. | |
size_type | getState (const Value &v) const |
Returns the state index of passed value when it exists. | |
std::string | getStateName (size_type state) const |
Return the display name of the passed state's index. | |
const Value & | getStateValue (size_type state) const |
Return the value of the passed state index. | |
Value::EType | getType () const |
Returns type enumerate of this variable instance. | |
Variable & | operator= (const Variable &v) |
Assignment operator that attaches this instance to the same VariableReference as 'v'. | |
int | operator== (const Variable &v) const |
Comparison operator. | |
std::string | getCurString (bool states=true) const |
Returns current converted value in default formatted string or state. | |
std::string | getSetupString () const |
Gets the setup std::string for this variable. | |
void | clipRound (Value &value) const |
Clips the passed value between min and max values. | |
Value | convert (const Value &value, bool to_org=false) const |
Returns the passed value converted to new units or back again. | |
bool | writeUpdate (std::ostream &os) const |
Writes id and current value and flags to the stream. | |
bool | write (std::ostream &os) const |
void | operator delete (void *) |
Public Member Functions inherited from sf::InformationBase | |
virtual | ~InformationBase ()=default |
Virtual destructor so derived classes can be destroyed by a pointer of this type. | |
Static Public Member Functions | |
static void | initialize () |
Must be called to initialize the statics which this class depends on. | |
static void | uninitialize () |
Called when terminating the application. | |
static void | setConvertHandler (VariableHandler *handler) |
Special handler for converting float variables globally. | |
static const char * | getStringType (EStringType type) |
Gets the name for passed string type. | |
static Value::EType | getType (const char *type) |
Returns enumerate value of the passed string. | |
static const char * | getType (Value::EType type) |
Returns type string of given enumerate value. | |
static size_type | getCount () |
Gets the amount of variables having different ID's in the system. | |
static size_type | getInstanceCount (bool global_only=true) |
Gets the total amount of variable instances in the system. | |
static PtrVector | getList () |
Retrieves a list of instances available (global + exported). | |
static std::string | getFieldName (int field) |
Gets the name of the passed field enumerate EField. | |
static const Variable & | getInstanceById (id_type id) |
Returns variable with the given id. | |
static Variable & | getInstanceById (id_type id, PtrVector &list) |
Returns variable with the given id. | |
static const Variable & | getInstanceById (id_type id, const PtrVector &list) |
Returns variable with the given id. | |
static bool | readUpdate (std::istream &is, bool skip_self=false, PtrVector &list=null_ref< PtrVector >()) |
load single current value and flags from stream. | |
static Definition | getDefinition (const std::string &str) |
static bool | read (std::istream &is, bool skip_self=false, PtrVector &list=null_ref< PtrVector >()) |
static bool | create (std::istream &is, PtrVector &list=null_ref< PtrVector >(), bool global=true, int &err_line=null_ref< int >()) |
static Variable::flags_type | toFlags (const std::string &flags) |
static std::string | getFlagsString (flags_type flags) |
static const char * | getEventName (EEvent event) |
Protected Member Functions | |
Variable (bool global) | |
Creates global or local variable instance depending on the value passed. | |
Friends | |
class | VariableHandler |
class | VariableReference |
class | VariableStatic |
Additional Inherited Members | |
Public Types inherited from sf::VariableTypes | |
enum | EEvent : int { veConvert = 64000 , veNewId = -32000 , veUserGlobal , veFirstLocal = 0 , veFlagsChange = 1 , veValueChange = 2 , veInvalid = 3 , veConverted = 4 , veUserLocal = 5 , veFirstPrivate = 16000 , veIdChanged = 16001 , veDesiredId = 16002 , veRemove = 16003 , veGetOwner = 16004 , veLostOwner = 16005 , veLinked = 16006 , veUnlinked = 16007 , veSetup = 16008 , veUserPrivate = 16009 } |
Events send to the handler set with sf::Variable::setHandler. More... | |
enum | EField : int { vfId = 0 , vfName , vfUnit , vfFlags , vfDescription , vfType , vfConversionType , vfRound , vfDefault , vfMinimum , vfMaximum , vfFirstState } |
enum | EFlag : flags_type { flgReadonly = 1 << 0 , flgArchive = 1 << 1 , flgShare = 1 << 2 , flgLink = 1 << 3 , flgFunction = 1 << 4 , flgParameter = 1 << 5 , flgHidden = 1 << 6 , flgExport = 1 << 7 , flgWriteable = 1 << 8 } |
enum | EStringType : int { stNoString = -1 , stNormal = 0 , stMulti , stPath , stDirectory , stFilename , stSubdirectory } |
typedef TVector< Variable * > | PtrVector |
Vector for pointers to variables. | |
typedef TVector< Variable > | Vector |
Vector for instances of variables. | |
typedef TVector< VariableReference * > | ReferenceVector |
Types for internal use. | |
Public Types inherited from sf::InformationTypes | |
typedef unsigned long long | id_type |
Type used for the identifying integer (64-bits). | |
typedef int32_t | flags_type |
Type used for the flag integer. | |
typedef size_t | size_type |
Type used for size of vectors. | |
typedef uint64_t | data_type |
Type used for containing a single data element which is the largest integer. | |
typedef int64_t | sdata_type |
Type used for containing a single data element which is the largest signed integer. | |
typedef TVector< id_type > | IdVector |
Vector for lists of information ID's. | |
typedef TVector< InformationBase * > | Vector |
Vector for containing different information base derived classes. | |
Static Public Attributes inherited from sf::InformationTypes | |
static constexpr size_t | npos = std::numeric_limits<size_type>::max() |
Unsigned size value indicating not found or no index. | |
Class for creating and referencing global or local created parameters or settings called variables. This class allows linking of member functions of other classes to handle events generated. See the Example on how to use this class and the 'TVariableHandler' template class.
sf::Variable::Variable | ( | ) |
Default constructor for a default global variable.
|
inline |
Copy constructor. Copies also the Desired ID data member.
|
inline |
Creates an instance having a reference with 'id'.
id | Identifying number. |
set_desired | When true the desired id data member is set to the passed id as well. |
|
explicit |
Creates a variable according to the definition std::string passed to it.
The "id" from the definition string is the passed id offset added to form a final id. This used when instances are created from resource strings for multiple instances of the same module.
definition | Definition string. |
id_ofs | Offset for the 'id'. |
|
inlineexplicit |
Creates a variable using the passed definition structure.
def | Definition structure. |
id_ofs | Offset for the 'id'. |
|
override |
Virtual destructor.
|
explicitprotected |
Creates global or local variable instance depending on the value passed.
global | True when global, false when local. |
bool sf::Variable::applyTemporary | ( | bool | skip_self = true | ) |
Applies the temporary value of this instance.
Used mainly in dialogs to apply the changed value to become the actual current one. The 'skip_self' flag is set to true by default because an event was already sent using setCur().
skip_self | When 'true' this instance is skipped in emission of events. |
void sf::Variable::clipRound | ( | Value & | value | ) | const |
Clips the passed value between min and max values.
value | Value to be clipped. |
Returns the passed value converted to new units or back again.
value | Value to be converted. |
to_org | Direction of conversion. |
|
static |
Reads multiple variable setup strings from stream separated by newline characters. Returns true when no error occurred during the process. On error returns false and line returns the error line in the stream. If 'list' is other than a NULL_REF the created variables are added to that list.
is | |
list | |
global | |
err_line |
Variable::size_type sf::Variable::emitEvent | ( | EEvent | event, |
bool | skip_self = false |
||
) |
Initiate event for all instances of this variable depending on the event value.
Returns the amount of effected variables by this call.
event | |
skip_self | When 'true' this instance is skipped in emission of events. |
VariableHandler * sf::Variable::getConvertHandler | ( | ) | const |
Returns the link to the global conversion handler.
std::string sf::Variable::getConvertOption | ( | ) | const |
Returns the conversion option string.
This string determines how the value is to be converted when exporting.
|
static |
Gets the amount of variables having different ID's in the system.
const Value & sf::Variable::getCur | ( | ) | const |
Return the variable current value.
Is converted when converted flag is true.
const Value & sf::Variable::getCur | ( | bool | converted | ) | const |
Gets the current value converted or not converted independent of the conversion flag.
converted | True when getting the converted value. |
flags_type sf::Variable::getCurFlags | ( | ) | const |
Returns the current flags for this instance.
std::string sf::Variable::getCurFlagsString | ( | ) | const |
Returns the current flags in a std::string form.
std::string sf::Variable::getCurString | ( | bool | states = true | ) | const |
Returns current converted value in default formatted string or state.
When a temporary value is used that value is returned.
states | Determines if a state string name is to be used. |
|
inline |
Gets the data for this instance for user purposes Set with setData().
const Value & sf::Variable::getDef | ( | ) | const |
Return the variable default value.
Is converted when converted flag is true.
const Value & sf::Variable::getDef | ( | bool | converted | ) | const |
Gets the default value converted or not Is converted independent of the conversion flag.
converted | True when getting the converted value. |
|
static |
Fills a definition structure from a string. On failure the _valid field is set to false.
str | Definition string |
std::string sf::Variable::getDescription | ( | ) | const |
Gets the purpose description of the attached variable.
|
inline |
Returns the desired id of this instance.
|
static |
Returns the event name to make debugging easier.
|
static |
Gets the name of the passed field enumerate EField.
flags_type sf::Variable::getFlags | ( | ) | const |
Returns the flags at the time the instance was created.
std::string sf::Variable::getFlagsString | ( | ) | const |
Returns the flags at setup in a std::string form.
|
static |
Returns the passed flags in a std::string form
flags |
|
inline |
Returns the link Set by setHandler().
id_type sf::Variable::getId | ( | ) | const |
Returns the current attached ID.
Returns variable with the given id.
When not found it returns the zero variable.
id | Variable id to seek. |
Returns variable with the given id.
When not found it returns the zero variable.
id | Variable id to seek. |
list | Vector to use for lookup. |
Returns variable with the given id.
When not found it returns the zero variable.
id | Variable id to seek. |
list | Vector to use for lookup. |
|
static |
Gets the total amount of variable instances in the system.
global_only | When true, count only the global ones. |
|
static |
Retrieves a list of instances available (global + exported).
Useful in populating a selection dialog.
const Value & sf::Variable::getMax | ( | ) | const |
Return the variable Maximum value.
Is converted when converted flag is true.
const Value & sf::Variable::getMax | ( | bool | converted | ) | const |
Gets the Maximum value converted or not converted independent of the conversion flag.
converted | True when getting the converted value. |
const Value & sf::Variable::getMin | ( | ) | const |
Return the variable Minimum value.
Is converted when converted flag is true.
const Value & sf::Variable::getMin | ( | bool | converted | ) | const |
Gets the Minimum value converted or not converted independent of the conversion flag.
converted | True when getting the converted value. |
std::string sf::Variable::getName | ( | int | levels = 0 | ) | const |
Gets the name or a part of the name of the attached variable.
Returns the variable name which is default (level 0) the full variable path name. When levels is 'n' and larger than zero the last 'n' levels are returned. When levels is 'n' and smaller than zero the first 'n' levels are omitted.
levels | Amount of required levels. |
int sf::Variable::getNameLevelCount | ( | ) | const |
Returns the amount of levels of the full name path.
Variable & sf::Variable::getOwner | ( | ) |
Gets a reference to the owner/server instance of this variable.
int sf::Variable::getRequiredDigits | ( | ) | const |
Gets the required digits for this instance based on round, min and max values. Converted or not the value is the same. This method is useful for drawing a scale using numberString()
const Value & sf::Variable::getRnd | ( | ) | const |
Return the variable Rounding value.
Converted when converted flag is true.
const Value & sf::Variable::getRnd | ( | bool | converted | ) | const |
Gets the Rounding value converted or not converted independent of the conversion flag.
converted | True when getting the converted value. |
std::string sf::Variable::getSetupString | ( | ) | const |
Gets the setup std::string for this variable.
int sf::Variable::getSigDigits | ( | ) | const |
Gets the normalized decimal point location for this instance.
int sf::Variable::getSigDigits | ( | bool | converted | ) | const |
Gets the normalized decimal point location for this instance converted or not converted.
converted | True when needing the converted amount. |
size_type sf::Variable::getStateCount | ( | ) | const |
Returns the state count.
std::string sf::Variable::getStateName | ( | size_type | state | ) | const |
Return the display name of the passed state's index.
state | Index of the state. |
const State::Vector & sf::Variable::getStates | ( | ) | const |
Returns the complete state vector as a reference.
Return the value of the passed state index.
state | Index of the state. |
EStringType sf::Variable::getStringType | ( | ) | const |
The type is determined by the character in the unit field of the setup string.
|
static |
Gets the name for passed string type.
type | Enumerate value. |
Value::EType sf::Variable::getType | ( | ) | const |
Returns type enumerate of this variable instance.
|
inlinestatic |
Returns enumerate value of the passed string.
type |
|
inlinestatic |
Returns type string of given enumerate value.
type |
std::string sf::Variable::getUnit | ( | ) | const |
Returns variable unit.
std::string sf::Variable::getUnit | ( | bool | converted | ) | const |
Returns variable unit of converted or non-converted value.
converted | True when getting the converted value. |
size_type sf::Variable::getUsageCount | ( | ) | const |
Returns the usage count of this variable reference.
bool sf::Variable::increase | ( | int | steps, |
bool | skip_self = false |
||
) |
Increase current variable value by step increments also negative values.
Emits event veValueChange when a change is flags occurred.
steps | Amount of increments (>0) or decrements (<0) |
skip_self | Skip event on this instance. |
|
static |
Must be called to initialize the statics which this class depends on.
bool sf::Variable::isConverted | ( | ) | const |
Returns true is the current instance is converting floating point values.
bool sf::Variable::isExported | ( | ) | const |
Checks if the variable is an exported local variable.
bool sf::Variable::isFlag | ( | int | flag | ) | const |
Returns if a flag or flags has been set.
flag | Single value or a multiple of EFlag values. |
|
inline |
Returns true if this instance is a global variable or not.
bool sf::Variable::isNumber | ( | ) | const |
Returns whether the value is a number or not.
Result is true when the value type is either Value::vitFloat or Value::vitInteger.
bool sf::Variable::isOwner | ( | ) | const |
Returns if this is the owner of this variable.
bool sf::Variable::isReadOnly | ( | ) | const |
Returns if variable is allowed to change its value.
bool sf::Variable::isTemporary | ( | ) |
Checks if a temporary is used instead of current actual value.
bool sf::Variable::isTemporaryDifferent | ( | ) | const |
Check if the temporary value differs from the actual value.
Used mainly in dialogs to enable an apply button.
bool sf::Variable::isValid | ( | ) | const |
Checks validity of the attached reference and used after a setup call.
bool sf::Variable::loadCur | ( | const Value & | value | ) | const |
Used in settings loading routines which use the owner to Set a new value.
Checks if clients have write access and is global before applying the new value.
value |
void sf::Variable::makeOwner | ( | ) |
Makes this instance owner of this variable instance and emits the appropriate events.
When the owner really changes instances the new owner handler receives a veGetOwner event and the previous one veLostOwner.
void sf::Variable::operator delete | ( | void * | ) |
During events no instances should be deleted. The destructor will be called but the data still exist
Assignment operator that attaches this instance to the same VariableReference as 'v'.
|
inline |
Comparison operator.
|
static |
load single current values from stream. If 'list' is other than a NULL_REF that list is used to seek the according variable instead of the global list.
is | |
skip_self | When 'true' this instance is skipped in emission of events. |
list |
|
static |
load single current value and flags from stream.
If 'list' is other than the default that list is used to seek the according variable instead of the global list.
is | |
skip_self | When 'true' this instance is skipped in emission of events. |
list |
bool sf::Variable::setConvert | ( | bool | enable | ) |
Enables or disables conversion of floating point values.
If a change was triggered a veConverted event was emitted.
enable | To enable pass 'true'. to disable 'false'. |
|
static |
Special handler for converting float variables globally.
Sets an event handler for this variable, passing NULL wil disable the handler
handler | Handler from conversion interface. |
bool sf::Variable::setConvertValues | ( | bool | convert = true | ) |
Enables or disables unit conversion.
Only owners can make this call successfully.
Depending on the globally set handler using setConvertHandler() this function calls the handler with event veConvert which then should apply the conversion values using setConvertValues() on the 'call_var' passed.
When the global conversion handler has not been set the Makes a call to the unit conversion interface and tries to get conversion values from it.
When the global conversion handler not set it uses the locally available conversion values.
convert | When true conversion is enabled and false disabled. |
bool sf::Variable::setConvertValues | ( | const std::string & | unit, |
const Value & | multiplier, | ||
const Value & | offset, | ||
int | digits = std::numeric_limits< int >::max() |
||
) |
Sets the global conversion values and signals the clients.
Only with owners a call is successful and effective. The formula is: converted = (current * multiplier) + offset When successful event veConverted emitted.
unit | New unit string. |
multiplier | Multiplier value. |
offset | Offset value. |
digits | Significant digits for the new unit. |
bool sf::Variable::setCur | ( | const Value & | value, |
bool | skip_self = false |
||
) |
Both return true if there was a change and notify all variables of the same variable id through an event.
value | Sets a new current value. |
skip_self | When 'true' this instance is skipped in emission of events. |
|
inline |
Same as setCur() but for const instances objects of this instance.
value | Sets a new current value. |
skip_self | When 'true' this instance is skipped in emission of events. |
|
inline |
Sets the data for this instance for user purposes.
data | Could be a pointer cast value. |
void sf::Variable::setDesiredId | ( | ) |
Sets the desired id member variable to the current attached reference id.
void sf::Variable::setDesiredId | ( | id_type | id | ) |
Sets the desired id member variable to the passed id.
If the passed 'id' is zero the automatic attachment mechanism is disabled.
bool sf::Variable::setExport | ( | bool | global | ) |
Makes an owning local variable appear globally.
Useful when reading/creating instances from stored files. First as local instances and then making them global.
global | True to export as global and False to revert it. |
bool sf::Variable::setFlag | ( | flags_type | flag, |
bool | skip_self = false |
||
) |
Sets a flag or multiple flags on the reference.
Only for an owner can call this function successful. Emits event veFlagsChange when a change in flags occurred.
flag | Single or multiple values of EFlag. |
skip_self | Skip event on this instance. |
bool sf::Variable::setGlobal | ( | bool | global | ) |
Sets the variable to be global.
This can only happen if it attached to Zero Variable so when the id is zero.
global | True when global and False when local. |
void sf::Variable::setHandler | ( | VariableHandler * | handler | ) |
Only one link is available at a time.
Sets an event handler for this variable, passing NULL wil disable the link.
handler |
bool sf::Variable::setId | ( | id_type | id, |
bool | skip_self = false |
||
) |
Only for local non exported owning variables to set the id after setup is called using a string.
The id can not be zero and attached local variables are notify with a veNewId event.
id | Variable identifier |
skip_self | When false the event to its own handler is skipped to be emitted. |
void sf::Variable::setTemporary | ( | bool | on_off | ) |
When true is passed a local temporary value is used instead of current.
on_off |
bool sf::Variable::setup | ( | const Definition & | definition, |
Variable::id_type | id_ofs = 0 |
||
) |
Creates a variable using the definition structure.
definition | Definition structure. |
id_ofs | Offset for the 'id'. |
|
inline |
Creates a variable according to the definition std::string passed to it.
The passed identifier offset 'id_ofs' is added to the id in the string. This used when instances are created from resource strings for multiple instances of the same module.
definition | Comma separated definition string. |
id_ofs | Offset for the 'id'. |
|
inline |
Sets reference to other variable. This is the only way for local variables.
v |
|
inline |
Sets reference to other by id.
The global list of references is searched for the passed id and referenced when found. When found event veIdChanged is emitted. When the desired id was set and changed the veDesiredId event is emitted. Cannot be used for local variables.
id | Identifier. |
set_did | When true the desired id is set to the passed 'id'. |
|
static |
Converts a std::string with flag characters to an integer
flags |
|
static |
Called when terminating the application.
bool sf::Variable::unsetFlag | ( | flags_type | flag, |
bool | skip_self = false |
||
) |
Unsets a flag or multiple flags of the attached VariableReference.
Emits event veValueChange when a change in flags occurred.
flag | Single or multiple values of EFlag. |
skip_self | When 'true' this instance is skipped in emission of events. |
bool sf::Variable::updateFlags | ( | flags_type | flags, |
bool | skip_self = false |
||
) |
Replaces all flags with the passed flags.
Only for an owner can call this function successful. Emits event veFlagsChange when a change in flags occurred.
flags | Single or multiple values of EFlag. |
skip_self | When 'true' this instance is skipped in emission of events. |
bool sf::Variable::updateTemporary | ( | bool | skip_self = false | ) |
Updates the temporary value with the real value.
Used mainly in dialogs to update the temporary value with real/actual value.
skip_self | When 'true' this instance is skipped in emission of events. |
bool sf::Variable::write | ( | std::ostream & | os | ) | const |
Writes id and current value to the stream.
os |
bool sf::Variable::writeUpdate | ( | std::ostream & | os | ) | const |
Writes id and current value and flags to the stream.
|
friend |
|
friend |
|
friend |