|
ActiveLib
|
#include <Value.h>


Public Types | |
| enum class | Status { undefined = 0 , bad , good } |
| The value status (defines whether a value has been explicitly set and (if so) if it's meaningful. | |
| enum class | Type { null = 0 , boolType , idType , intType , floatType , stringType , timeType } |
| Supported value types (broad groups, e.g. int32_t and int64_t are both intType) | |
| using | Unique = std::unique_ptr<Value> |
| Unique pointer. | |
| using | Shared = std::shared_ptr<Value> |
| Shared pointer. | |
| using | Option = std::optional<Value> |
| Optional. | |
Public Member Functions | |
| Value (Status stat=good) | |
| virtual | ~Value ()=default |
| virtual Value * | clonePtr () const override=0 |
| virtual bool | operator== (const Value &ref) const =0 |
| bool | operator!= (const Value &ref) const |
| virtual bool | operator< (const Value &ref) const =0 |
| virtual Value & | operator= (const Value &val)=0 |
| virtual Value & | operator= (bool val)=0 |
| virtual Value & | operator= (int32_t val)=0 |
| virtual Value & | operator= (uint32_t val)=0 |
| virtual Value & | operator= (int64_t val)=0 |
| virtual Value & | operator= (double val)=0 |
| virtual Value & | operator= (const active::utility::String &val)=0 |
| virtual Value & | operator= (const char *val) |
| virtual Value & | operator= (const active::utility::Guid &val)=0 |
| virtual Value & | operator= (const active::utility::Time &val)=0 |
| virtual | operator bool () const =0 |
| virtual | operator int32_t () const =0 |
| virtual | operator uint32_t () const =0 |
| virtual | operator int64_t () const =0 |
| virtual | operator double () const =0 |
| virtual | operator active::utility::String () const =0 |
| virtual | operator active::utility::Guid () const =0 |
| virtual | operator active::utility::Time () const =0 |
| virtual bool | isGood () const |
| virtual bool | isNull () const =0 |
| virtual Type | getType () const =0 |
| virtual void | setDefault ()=0 |
Public Member Functions inherited from active::utility::Cloner | |
| virtual | ~Cloner ()=default |
Static Public Member Functions | |
| static std::optional< Type > | typeFromName (const utility::String &text) |
| static utility::String | nameForType (Type type) |
Public Attributes | |
| Status | status |
| The value status. | |
Base class for all single-item values
This base class essentially anonymises the value type, allowing a setting sender and receiver to work with the type it expects, e.g. a sender may have numeric value that the receiver will display as a string. This helps facilitate loose coupling between modules. Settings/parameters can share a common identity, but the senders/receivers of these values do not need a shared understanding of value types, formatting or purpose (which may vary if there are multiple receivers). This is particulary relevant to the UI, where the app business logic understands value types and formatting, but the UI must facilitate display/entry of values. The UI code can read/write to the value as a string irrespective of its internal type and allow the Value to validate user entry (meaning that no business logic for the value type is replicated or exposed in the UI code).
There are many other uses for this type abstraction, e.g. data passed with an Event to Subscribers.
Subclasses should override the following functions as appropriate
|
inline |
Default constructor
| stat | The value status |
|
virtualdefault |
Destructor
|
overridepure virtual |
Clone method
Implements active::utility::Cloner.
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Get the value type
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
inlinevirtual |
Determine if the value has a good status

|
pure virtual |
Determine if the value is null, e.g. zero, empty, undefined
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.

|
static |
Get the text for a Value::Type
| type | The incoming type |


|
pure virtual |
Get a guid value
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Get a string value
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Get a time value
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Get a boolean value
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Get a double precision value
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Get a 32-bit integer value
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Get a 64-bit integer value
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Get an unsigned 32-bit integer value
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
inline |
Inequality operator
| ref | A value to compare with this |
|
pure virtual |
Less-than operator
| ref | A value to compare with this |
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Assignment operator
| val | A boolean value to assign |
Implemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Assignment operator
| val | A guid value to assign |
Implemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Assignment operator
| val | A string value to assign |
Implemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::NullValue, active::setting::ValueBase< T >, active::setting::AngleValue, active::setting::MeasuredValue< T >, and active::setting::MeasuredValue< active::measure::AngleUnit >.
|
pure virtual |
Assignment operator
| val | A time value to assign |
Implemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::NullValue, and active::setting::ValueBase< T >.
|
inlinevirtual |
Assignment operator
| val | A string value to assign |
Reimplemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, and active::setting::ValueBase< T >.


Assignment operator
| val | A value to assign |
Implemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::ValueBase< T >, active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::NullValue, and active::setting::ValueBase< T >.

|
pure virtual |
Assignment operator
| val | A double precision value to assign |
Implemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Assignment operator
| val | A 32-bit integer value to assign |
Implemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Assignment operator
| val | A 64-bit integer value to assign |
Implemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Assignment operator
| val | An unsigned 32-bit integer value to assign |
Implemented in active::setting::MeasuredValue< T >, active::setting::MeasuredValue< active::measure::AngleUnit >, active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Equality operator
| ref | A value to compare with this |
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
pure virtual |
Set a default value
Implemented in active::setting::NullValue, and active::setting::ValueBase< T >.
|
static |
Get a Value::Type enumerator from text
| text | The incoming text |