|
strusBase
0.17
|
Atomic type that can hold numeric values of different type. More...
#include <numericVariant.hpp>
Classes | |
| class | String |
Public Types | |
| enum | Type { Null, Int, UInt, Float } |
| Enumeration of all types an numeric variant can have. More... | |
| typedef int64_t | IntType |
| typedef uint64_t | UIntType |
| typedef double | FloatType |
Public Member Functions | |
| NumericVariant (int64_t value) | |
| Constructor from a signed integer. More... | |
| NumericVariant (uint64_t value) | |
| Constructor from an unsigned integer. More... | |
| NumericVariant (double value) | |
| Constructor from a single precision floating point number. More... | |
| NumericVariant (const char *val_) | |
| Constructor from a string. More... | |
| NumericVariant () | |
| Default constructor (as undefined value) More... | |
| NumericVariant (const NumericVariant &o) | |
| Copy constructor. More... | |
| void | init () |
| String | tostring (int precision=-1) const |
| bool | initFromString (const char *src) |
| Initialize numeric variant parsed from a Ascii source string. More... | |
| bool | defined () const |
| Find out if this value is defined. More... | |
| template<typename TYPE > | |
| TYPE | cast () const |
| Template for casting to a defined value type. More... | |
| operator double () const | |
| Cast to a single precision floating point number. More... | |
| operator int64_t () const | |
| Cast to a signed integer. More... | |
| operator uint64_t () const | |
| Cast to an unsigned integer. More... | |
| int64_t | toint () const |
| Cast to a signed integer. More... | |
| uint64_t | touint () const |
| Cast to an unsigned integer. More... | |
| double | tofloat () const |
| Cast to an unsigned integer. More... | |
| bool | operator== (const NumericVariant &o) const |
| Test for equality. More... | |
| bool | operator!= (const NumericVariant &o) const |
| Test for inequality. More... | |
| bool | operator>= (const NumericVariant &o) const |
| Test for greater or equal. More... | |
| bool | operator> (const NumericVariant &o) const |
| Test for greater. More... | |
| bool | operator<= (const NumericVariant &o) const |
| Test for smaller or equal. More... | |
| bool | operator< (const NumericVariant &o) const |
| Test for smaller. More... | |
| bool | isequal (const NumericVariant &o) const |
| Test for equality. More... | |
| int | compare (const NumericVariant &o) const |
| Comparison of numbers. More... | |
| NumericVariant & | operator= (int64_t value) |
| Assignment operator for a singed integer. More... | |
| NumericVariant & | operator= (uint64_t value) |
| Assignment operator for an unsinged integer. More... | |
| NumericVariant & | operator= (double value) |
| Assignment operator for a single precision floating point number. More... | |
| NumericVariant & | operator= (const NumericVariant &o) |
| Assignment operator. More... | |
Static Public Member Functions | |
| static NumericVariant | asint (int64_t val) |
| static NumericVariant | asuint (uint64_t val) |
| static NumericVariant | asdouble (double val) |
| static const char * | typeName (Type type) |
| Get the name of a type as string. More... | |
Public Attributes | |
| Type | type |
| Type of this numeric variant. More... | |
| union { | |
| int64_t Int | |
| value in case of a signed integer More... | |
| uint64_t UInt | |
| value in case of an unsigned integer More... | |
| double Float | |
| value in case of a floating point number More... | |
| } | variant |
| Value of this numeric variant. More... | |
Atomic type that can hold numeric values of different type.
| typedef double strus::NumericVariant::FloatType |
| typedef int64_t strus::NumericVariant::IntType |
| typedef uint64_t strus::NumericVariant::UIntType |
|
inline |
Constructor from a signed integer.
| [in] | value | value to assign to this numeric variant |
|
inline |
Constructor from an unsigned integer.
| [in] | value | value to assign to this numeric variant |
|
inline |
Constructor from a single precision floating point number.
| [in] | value | value to assign to this numeric variant |
|
inline |
Constructor from a string.
| [in] | value | value to parse and assign to this numeric variant |
|
inline |
Default constructor (as undefined value)
|
inline |
Copy constructor.
| [in] | o | numeric variant to copy |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
Template for casting to a defined value type.
| TYPE | what type to cast this numeric variant to |
| int strus::NumericVariant::compare | ( | const NumericVariant & | o | ) | const |
Comparison of numbers.
| [in] | o | numeric variant to compare |
|
inline |
Find out if this value is defined.
|
inline |
| bool strus::NumericVariant::initFromString | ( | const char * | src | ) |
Initialize numeric variant parsed from a Ascii source string.
| [in] | src | source string to parse |
| bool strus::NumericVariant::isequal | ( | const NumericVariant & | o | ) | const |
Test for equality.
| [in] | o | numeric variant to compare |
|
inline |
Cast to a single precision floating point number.
|
inline |
Cast to a signed integer.
|
inline |
Cast to an unsigned integer.
|
inline |
Test for inequality.
| [in] | o | numeric variant to compare |
|
inline |
Test for smaller.
| [in] | o | numeric variant to compare |
|
inline |
Test for smaller or equal.
| [in] | o | numeric variant to compare |
|
inline |
Assignment operator for a singed integer.
| [in] | value | value to assign to this numeric variant |
|
inline |
Assignment operator for an unsinged integer.
| [in] | value | value to assign to this numeric variant |
|
inline |
Assignment operator for a single precision floating point number.
| [in] | value | value to assign to this numeric variant |
|
inline |
Assignment operator.
| [in] | o | numeric variant to copy |
|
inline |
Test for equality.
| [in] | o | numeric variant to compare |
|
inline |
Test for greater.
| [in] | o | numeric variant to compare |
|
inline |
Test for greater or equal.
| [in] | o | numeric variant to compare |
|
inline |
Cast to an unsigned integer.
|
inline |
Cast to a signed integer.
|
inline |
|
inline |
Cast to an unsigned integer.
|
static |
Get the name of a type as string.
| double strus::NumericVariant::Float |
value in case of a floating point number
| int64_t strus::NumericVariant::Int |
value in case of a signed integer
| Type strus::NumericVariant::type |
Type of this numeric variant.
| uint64_t strus::NumericVariant::UInt |
value in case of an unsigned integer
| union { ... } strus::NumericVariant::variant |
Value of this numeric variant.
1.8.6