![]() |
Scanframe Modular Application 0.1.0
|
Value container class able to performing arithmetic functions. More...
#include <Value.h>

Public Types | |
| enum | EType { vitReference = -1 , vitInvalid = 0 , vitUndefined , vitInteger , vitFloat , vitString , vitBinary , vitCustom } |
| Enumerate for available types. More... | |
| enum | { maxString = 0xFFFF , maxBinary = 0xFFFF , maxCustom = 0xFFFF } |
| Limits on content sizes. More... | |
| typedef int64_t | int_type |
| Type used internally for storing integers. | |
| typedef double | flt_type |
| Type used internally for storing floating point value. | |
| typedef TVector< Value > | vector_type |
Public Member Functions | |
| Value () | |
| Default constructor. | |
| Value & | operator= (Value &&) noexcept |
| Move assignment operator is default. | |
| Value (Value &&) noexcept | |
| Move constructor. | |
| Value (const Value &v) | |
| Copy constructor. Copies the content and type of the passed instance. | |
| Value (const Value *v) | |
| Reference constructor. Creates an alias instance to reference the instance passed by pointer. | |
| Value (EType type) | |
| Constructs an empty but typed value. | |
| Value (flt_type v) | |
| Floating point type constructor for implicit vitFloat. | |
| Value (const char *v) | |
| Double type constructor for implicit vitString. | |
| Value (const std::string &v) | |
| Double type constructor for implicit vitString. | |
| Value (bool v) | |
| Boolean type constructor for implicit vitInteger. | |
| Value (int v) | |
| 32bit integer type constructor for implicit vitInteger. | |
| Value (unsigned v) | |
| 32-bit unsigned integer type constructor for implicit vitInteger. | |
| Value (int_type v) | |
| # 64bit int_type type constructor for implicit vitInteger. | |
| Value (const void *v, size_t size) | |
| Binary type constructor for implicit vitBinary. | |
| Value (EType type, const void *content, size_t size=0) | |
| Specific type constructor. | |
| ~Value () | |
| Destructor. Frees the allocated memory if some was allocated. | |
| Value & | set (const Value *v) |
| Set this instance to references to the instance passed here as pointer. Makes this instance an alias for another instance. | |
| Value & | set (const Value &v) |
| Copies the content and type of the passed value. An existing reference type is undone. | |
| Value & | set (bool v) |
| Sets the type and content. An existing type is undone. | |
| Value & | set (int v) |
| Sets the type and content. An existing type is undone. | |
| Value & | set (unsigned v) |
| Sets the type and content. An existing type is undone. | |
| Value & | set (int_type v) |
| Sets the type and content. An existing type is undone. | |
| Value & | set (flt_type v) |
| Sets the type and content. An existing type is undone. | |
| Value & | set (const char *v) |
| Sets the type and content. An existing type is undone. | |
| Value & | set (const std::string &v) |
| Sets the type and content. An existing type is undone. | |
| Value & | set (int type, const void *content, size_t size=0) |
| Sets the instance type and content. Called by constructors and all set functions. | |
| Value & | set (const void *v, size_t size) |
| Sets the type implicitly to vitBinary. An existing type is undone. | |
| Value & | assign (const Value &v) |
| Assigns a value of an instance but not changing the current type. Except for vitUndefined and vitInvalid type. | |
| Value & | assign (bool v) |
| Assigns a boolean value but not changing the current type. Except for vitUndefined and vitInvalid type. | |
| Value & | assign (int v) |
| Assigns an integer value but not changing the current type. Except for vitUndefined and vitInvalid type. | |
| Value & | assign (unsigned v) |
| Assigns an unsigned integer value but not changing the current type. Except for vitUndefined and vitInvalid type. | |
| Value & | assign (flt_type v) |
| Assigns a floating point value but not changing the current type. Except for vitUndefined and vitInvalid type. | |
| Value & | assign (const char *v) |
| Assigns a string value but not changing the current type. Except for vitUndefined and vitInvalid type. | |
| Value & | assign (const std::string &v) |
| Assigns a string value but not changing the current type. Except for vitUndefined and vitInvalid type. | |
| Value & | assign (const void *v, size_t size) |
| Assigns raw binary data but not changing the current type. Except for vitUndefined and vitInvalid type. | |
| EType | getType () const |
| Gets the current type for this instance. | |
| bool | setType (EType type) |
| Convert the instance to the passed type. | |
| bool | isValid () const |
| Checks if the instance is valid. If the type is equals vitInvalid. | |
| bool | isNumber () const |
| Checks if this is a numeric type (vitFloat or vitInteger) of instance. | |
| flt_type | getFloat (int *cnv_err) const |
| Returns a floating point value of the current value if possible. When the current type is a string the 'cnv_err' is Set to the error position and is zero on success. | |
| flt_type | getFloat () const |
| Gets a floating point value of the current value if possible. | |
| int_type | getInteger (int *cnv_err) const |
| Gets an integer value of the current value if possible. if the current type is a string the 'cnv_err' is Set to the error position and is zero on success. | |
| int_type | getInteger () const |
| Returns an integer value of the current value if possible. | |
| size_t | getSize () const |
| Gets the size of the occupied space. | |
| const void * | getBinary () const |
| Gets the pointer to the binary buffer if vitBinary. | |
| const char * | getData () const |
| Gets pointer to the data. Only when the type is vitString, vitBinary or vitCustom. | |
| std::string | getString (int precision=std::numeric_limits< int >::max()) const |
| Gets the string of the value with the specified precision. | |
| Value & | round (const Value &v) |
| Rounds the current instance to a multiple of the passed value. | |
| bool | isZero () const |
| Returns if the instance is type is zero. For non-numeric values this is when the data length is zero. For numerical values this is when the value itself is zero. For floating point value a special approach is taken because floating point values are approximations by default. So the absolute value is compared to the minimum positive subnormal value. | |
| operator std::string () const | |
| Type operator returning a string. | |
| operator bool () const | |
| Type operator returning a boolean. | |
| bool | operator! () const |
| Boolean invert operator. | |
| int | operator== (const Value &v) const |
| Equal operator. | |
| int | operator!= (const Value &v) const |
| Not equal operator. | |
| int | operator> (const Value &v) const |
| Larger than operator. | |
| int | operator>= (const Value &v) const |
| Larger than or equal operator. | |
| int | operator< (const Value &v) const |
| Less than operator. | |
| int | operator<= (const Value &v) const |
| Less than or equal operator. | |
| Value & | operator*= (const Value &v) |
| Multiply by operator. | |
| Value & | operator/= (const Value &v) |
| Divide by operator. | |
| Value & | operator%= (const Value &v) |
| Modulus operator. | |
| Value & | operator+= (const Value &v) |
| Add operator. | |
| Value & | operator-= (const Value &v) |
| Subtract operator. | |
| Value & | operator= (const Value &v) |
| Assignment operator that only change the contents. Calls actually assign() | |
| Value & | operator= (const std::string &v) |
| Assignment operator that only change the contents. | |
| Value & | operator= (const Value *v) |
| Assignment operator setting this instance to references the past instance pointer. | |
| Value | mul (const Value &v) const |
| Multiply this with the passed value. | |
| Value | div (const Value &v) const |
| Divide this with the passed value. | |
| Value | add (const Value &v) const |
| Add this with the passed value. | |
| Value | sub (const Value &v) const |
| Subtract this with the passed value. | |
| Value | mod (const Value &v) const |
| Modulus this with the passed value. | |
| int | compare (const Value &v) const |
| Compare this with the passed value. | |
Static Public Member Functions | |
| static EType | getType (const std::string_view &type) |
| Gets the type corresponding to the passed type string. | |
| static std::string_view | getType (EType type) |
| Gets the type string of the passed type enumeration value. | |
| static Value | calculateOffset (Value value, Value min, Value max, const Value &len, bool clip) |
| Calculates the offset for a given range and set point. | |
Static Public Attributes | |
| static const char * | _invalidStr |
| Holds the invalid string when needed. | |
Friends | |
| Value | operator* (const Value &v1, const Value &v2) |
| Value | operator/ (const Value &v1, const Value &v2) |
| Value | operator% (const Value &v1, const Value &v2) |
| Value | operator+ (const Value &v1, const Value &v2) |
| Value | operator- (const Value &v1, const Value &v2) |
| std::ostream & | operator<< (std::ostream &os, const Value &v) |
| Value class output stream operator. | |
| std::istream & | operator>> (std::istream &is, Value &v) |
| Value class input stream operator. | |
Value container class able to performing arithmetic functions.
Class designed to store settings and to manipulate them using overridden basic arithmetic operators.
| typedef double sf::Value::flt_type |
Type used internally for storing floating point value.
| typedef int64_t sf::Value::int_type |
Type used internally for storing integers.
| typedef TVector<Value> sf::Value::vector_type |
Vector type and implicit iterator for this class.
| anonymous enum |
| enum sf::Value::EType |
Enumerate for available types.
| sf::Value::Value | ( | ) |
Default constructor.
|
noexcept |
Move constructor.
| sf::Value::Value | ( | const Value & | v | ) |
Copy constructor. Copies the content and type of the passed instance.
|
explicit |
Reference constructor. Creates an alias instance to reference the instance passed by pointer.
| v | Instance pointer to reference to. |
|
explicit |
Constructs an empty but typed value.
| type |
|
explicit |
Floating point type constructor for implicit vitFloat.
| v | The floating point value. |
|
explicit |
Double type constructor for implicit vitString.
| v | The string value. |
|
explicit |
Double type constructor for implicit vitString.
| v | The std string value. |
|
explicit |
Boolean type constructor for implicit vitInteger.
| v | The boolean value. |
|
explicit |
32bit integer type constructor for implicit vitInteger.
| v | The boolean value. |
|
explicit |
32-bit unsigned integer type constructor for implicit vitInteger.
| v | The unsigned int value. |
|
explicit |
# 64bit int_type type constructor for implicit vitInteger.
| v | The int_type value. |
| sf::Value::Value | ( | const void * | v, |
| size_t | size | ||
| ) |
Binary type constructor for implicit vitBinary.
| v | The raw value. |
| size | Size of the raw value. |
| sf::Value::Value | ( | EType | type, |
| const void * | content, | ||
| size_t | size = 0 |
||
| ) |
Specific type constructor.
| type | Type |
| content | Content to store in this instance. |
| size | Only specified when not of type vitInteger or vitFloat |
| sf::Value::~Value | ( | ) |
Destructor. Frees the allocated memory if some was allocated.
|
inline |
Assigns a boolean value but not changing the current type. Except for vitUndefined and vitInvalid type.
| v | The new value. |
|
inline |
Assigns a string value but not changing the current type. Except for vitUndefined and vitInvalid type.
| v | The new value. |
|
inline |
Assigns a string value but not changing the current type. Except for vitUndefined and vitInvalid type.
| v | The new value. |
Assigns a value of an instance but not changing the current type. Except for vitUndefined and vitInvalid type.
| v | The new value. |
|
inline |
Assigns raw binary data but not changing the current type. Except for vitUndefined and vitInvalid type.
| v | The new value. |
| size | Size of the raw value. |
Assigns a floating point value but not changing the current type. Except for vitUndefined and vitInvalid type.
| v | The new value. |
|
inline |
Assigns an integer value but not changing the current type. Except for vitUndefined and vitInvalid type.
| v | The new value. |
|
inline |
Assigns an unsigned integer value but not changing the current type. Except for vitUndefined and vitInvalid type.
| v | The new value. |
|
static |
Calculates the offset for a given range and set point.
| int sf::Value::compare | ( | const Value & | v | ) | const |
Compare this with the passed value.
| const void * sf::Value::getBinary | ( | ) | const |
Gets the pointer to the binary buffer if vitBinary.
| const char * sf::Value::getData | ( | ) | const |
Gets pointer to the data. Only when the type is vitString, vitBinary or vitCustom.
| flt_type sf::Value::getFloat | ( | ) | const |
Gets a floating point value of the current value if possible.
| flt_type sf::Value::getFloat | ( | int * | cnv_err | ) | const |
Returns a floating point value of the current value if possible. When the current type is a string the 'cnv_err' is Set to the error position and is zero on success.
| int_type sf::Value::getInteger | ( | ) | const |
Returns an integer value of the current value if possible.
| int_type sf::Value::getInteger | ( | int * | cnv_err | ) | const |
Gets an integer value of the current value if possible. if the current type is a string the 'cnv_err' is Set to the error position and is zero on success.
| size_t sf::Value::getSize | ( | ) | const |
Gets the size of the occupied space.
| std::string sf::Value::getString | ( | int | precision = std::numeric_limits< int >::max() | ) | const |
Gets the string of the value with the specified precision.
This is only useful when the type is vitFloat or vitInteger
| precision | When not set uses the natural formatting of the value. (vitFloat only) |
|
inline |
Gets the current type for this instance.
|
static |
Gets the type corresponding to the passed type string.
| type | Name of the type. |
|
static |
Gets the type string of the passed type enumeration value.
| type | The type. |
| bool sf::Value::isNumber | ( | ) | const |
Checks if this is a numeric type (vitFloat or vitInteger) of instance.
| bool sf::Value::isValid | ( | ) | const |
Checks if the instance is valid. If the type is equals vitInvalid.
| bool sf::Value::isZero | ( | ) | const |
Returns if the instance is type is zero. For non-numeric values this is when the data length is zero.
For numerical values this is when the value itself is zero.
For floating point value a special approach is taken because floating point values are approximations by default.
So the absolute value is compared to the minimum positive subnormal value.
|
explicit |
Type operator returning a boolean.
|
explicit |
Type operator returning a string.
| bool sf::Value::operator! | ( | ) | const |
Boolean invert operator.
| int sf::Value::operator!= | ( | const Value & | v | ) | const |
Not equal operator.
| int sf::Value::operator< | ( | const Value & | v | ) | const |
Less than operator.
| int sf::Value::operator<= | ( | const Value & | v | ) | const |
Less than or equal operator.
| Value & sf::Value::operator= | ( | const std::string & | v | ) |
Assignment operator that only change the contents.
Assignment operator that only change the contents. Calls actually assign()
Assignment operator setting this instance to references the past instance pointer.
| int sf::Value::operator== | ( | const Value & | v | ) | const |
Equal operator.
| int sf::Value::operator> | ( | const Value & | v | ) | const |
Larger than operator.
| int sf::Value::operator>= | ( | const Value & | v | ) | const |
Larger than or equal operator.
Rounds the current instance to a multiple of the passed value.
| v | Value to round. |
|
inline |
Sets the type and content. An existing type is undone.
| v | value. |
|
inline |
Sets the type and content. An existing type is undone.
| v | value. |
|
inline |
Sets the type and content. An existing type is undone.
| v | value. |
Copies the content and type of the passed value. An existing reference type is undone.
| v |
Set this instance to references to the instance passed here as pointer. Makes this instance an alias for another instance.
| v | The instance pointer to reference to. |
|
inline |
Sets the type implicitly to vitBinary. An existing type is undone.
| v | Raw data pointer. |
| size | Size of the raw data. |
Sets the type and content. An existing type is undone.
| v | value. |
| Value & sf::Value::set | ( | int | type, |
| const void * | content, | ||
| size_t | size = 0 |
||
| ) |
Sets the instance type and content. Called by constructors and all set functions.
| type | Type of the new content. |
| content | Pointer to the raw content. |
| size | Size when not the types vitInteger or vitFloat |
|
inline |
Sets the type and content. An existing type is undone.
| v | value. |
Sets the type and content. An existing type is undone.
| v | value. |
|
inline |
Sets the type and content. An existing type is undone.
| v | value. |
| bool sf::Value::setType | ( | EType | type | ) |
Convert the instance to the passed type.
| type | New type. |
|
friend |
Value class output stream operator.
|
friend |
Value class input stream operator.
| flt_type sf::Value::_flt |
Floating point value.
| int_type sf::Value::_int |
Integer value.
|
static |
Holds the invalid string when needed.
| char* sf::Value::_ptr |
Pointer to special, binary or string data.
| Value* sf::Value::_ref |
Reference pointer to other instance.