|
template<typename _T_ > |
static Value | fromValue (const _T_ &_value) |
|
static ReturnValue< Value > | fromValue (const QVariant &_value) |
|
template<typename _T_ > |
static ReturnValue< Value > | fromValue (const Uri &_datatype, const _T_ &_value, TypeCheckingMode _conversion=TypeCheckingMode::Safe) |
|
static ReturnValue< Value > | fromVariant (const Uri &_datatype, const QVariant &_value, TypeCheckingMode _conversion=TypeCheckingMode::Safe) |
|
static ReturnValue< Value > | fromVariant (const QVariant &_variant) |
|
static ReturnValue< Value > | fromJsonValue (const Uri &_datatype, const QJsonValue &_value, const DeserialisationContexts &_context=defaultDeserialisationContext()) |
|
template<typename _T_ > |
static ReturnValue< _T_ > | fromJsonValue (const QJsonValue &_value, const DeserialisationContexts &_context=defaultDeserialisationContext()) |
|
static ReturnValue< Value > | fromCborValue (const Uri &_datatype, const QCborValue &_value, const DeserialisationContexts &_context=defaultDeserialisationContext()) |
|
static ReturnValue< Value > | fromRdfLiteral (const Uri &_datatype, const QString &_value, const DeserialisationContexts &_context=defaultDeserialisationContext()) |
|
static ReturnValue< Value > | fromJsonObject (const QJsonObject &_value, const DeserialisationContexts &_context=defaultDeserialisationContext()) |
|
static ReturnValue< Value > | fromCborMap (const QCborMap &_value, const DeserialisationContexts &_context=defaultDeserialisationContext()) |
|
template<> |
ReturnValue< Value > | fromValue (const Uri &_datatype, const QVariant &_value, TypeCheckingMode _conversion) |
|
◆ Value()
◆ canConvert() [1/2]
bool Value::canConvert |
( |
const Uri & | _uri, |
|
|
TypeCheckingMode | _conversion = TypeCheckingMode::Safe ) const |
- Returns
- true if this value can be converted to the type identified by
- Parameters
-
◆ canConvert() [2/2]
template<typename _T_ >
bool knowCore::Value::canConvert |
( |
TypeCheckingMode | _conversion = TypeCheckingMode::Safe | ) |
const |
|
inline |
- Returns
- true if it is possible to convert
◆ compare()
ReturnValue< bool > Value::compare |
( |
const Value & | _value, |
|
|
ComparisonOperators | _operators ) const |
Compare two values. With different operators, if one returns true then compare return true.
◆ compute()
Compute the arithmetic operation between this value and _value.
◆ datatype()
Uri Value::datatype |
( |
| ) |
const |
- Returns
- the URI corresponding to the datatype
◆ fromCborMap()
- Returns
- a value from a cbor map that contains the datatype and the value (i.e. one created with toCborMap).
◆ fromJsonObject()
- Returns
- a value from a json object that contains the datatype and the value (i.e. one created with toJsonObject).
◆ fromValue() [1/3]
template<typename _T_ >
Value knowCore::Value::fromValue |
( |
const _T_ & | _value | ) |
|
|
inlinestatic |
Create a Value from any value _value
. The type of _value
needs to be register in knowCore's metatype system. This function will guess the data type uri.
◆ fromValue() [2/3]
Attempt to create a Value from a variant _value
. The type of _value
needs to be register in knowCore's metatype system, if it is not, the function return an error.
◆ fromValue() [3/3]
template<typename _T_ >
ReturnValue< Value > knowCore::Value::fromValue |
( |
const Uri & | _datatype, |
|
|
const _T_ & | _value, |
|
|
TypeCheckingMode | _conversion = TypeCheckingMode::Safe ) |
|
inlinestatic |
Create a Value from any value _value
. The type of _value
needs to be register in knowCore's metatype system. This function will use the datatype _datatype
and attempt to convert _value
into _datatype
.
◆ fromVariant() [1/2]
Construct a value from a variant. If the type of the variant is not defined as a knowCore MetaType, it will return an invalid value.
◆ fromVariant() [2/2]
ReturnValue< Value > Value::fromVariant |
( |
const Uri & | _datatype, |
|
|
const QVariant & | _value, |
|
|
TypeCheckingMode | _conversion = TypeCheckingMode::Safe ) |
|
static |
Construct a literal from a variant
- Parameters
-
_datatype | the type of the literal |
_value | a variant with the value |
This attempt to convert the variant content to the dataype, if it fails, it returns an invalid value.
◆ isEmpty()
bool Value::isEmpty |
( |
| ) |
const |
- Returns
- true if it is empty
◆ operator!=()
bool knowCore::Value::operator!= |
( |
const Value & | _rhs | ) |
const |
|
inline |
Inequality comparison, it can only compare value of the same type.
◆ operator<()
bool Value::operator< |
( |
const Value & | _rhs | ) |
const |
This operator use the printable result, it should only be used for storing values in a container. If you want proper comparison between the value you should use the compare function.
◆ operator==()
bool Value::operator== |
( |
const Value & | _rhs | ) |
const |
Equality comparison, it can only compare value of the same type.
◆ toCborMap()
- Returns
- a cbor map that contains the datatype and the value.
◆ toHash()
◆ toJsonObject()
- Returns
- a json object that contains the datatype and the value.
◆ toList()
◆ toVariant()
QVariant Value::toVariant |
( |
| ) |
const |
- Returns
- convert to a variant
◆ value() [1/2]
template<typename _T_ >
_T_ knowCore::Value::value |
( |
const _T_ & | _default, |
|
|
TypeCheckingMode | _conversion = TypeCheckingMode::Safe ) const |
|
inline |
Convenient function to access the value or a default one if the stored value and _T_
are not compatible.
- Returns
- the value contained in the literal (no error is triggered if the type is wrong, instead a default value is returned)
◆ value() [2/2]
template<typename _T_ >
ReturnValue< _T_ > knowCore::Value::value |
( |
TypeCheckingMode | _conversion = TypeCheckingMode::Safe | ) |
const |
|
inline |
Function to access the value stored .
- Returns
- the value if successfull, or an error message if the value cannot be converted
The documentation for this class was generated from the following files:
- knowl/src/knowCore/Value.h
- knowl/src/knowCore/Value.cpp