kDB: Knowledge DataBase
|
#include <QuantityValue.h>
Classes | |
struct | Constructor |
Public Member Functions | |
QuantityValue (const _T_ &_value, const Unit &_unit) | |
Unit | unit () const |
_T_ | value () const |
cres_qresult< QuantityValue > | operator+ (const QuantityValue &_rhs) const |
cres_qresult< QuantityValue > | operator- (const QuantityValue &_rhs) const |
cres_qresult< QuantityValue > | operator/ (const QuantityValue &_rhs) const |
cres_qresult< QuantityValue > | operator* (const QuantityValue &_rhs) const |
QuantityValue | operator/ (const _T_ &_rhs) const |
QuantityValue | operator* (const _T_ &_rhs) const |
bool | operator== (const QuantityValue &_rhs) const |
cres_qresult< bool > | operator< (const QuantityValue &_rhs) const |
cres_qresult< QByteArray > | md5 () const |
cres_qresult< QJsonValue > | toJsonValue (const SerialisationContexts &_contexts=defaultSerialisationContext()) const |
cres_qresult< QCborValue > | toCborValue (const SerialisationContexts &_contexts=defaultSerialisationContext()) const |
cres_qresult< QString > | toRdfLiteral (const SerialisationContexts &_contexts=defaultSerialisationContext()) const |
cres_qresult< QString > | printable () const |
template<typename _TOther_ > requires (not std::is_base_of_v<Value, _TOther_>) | |
cres_qresult< QuantityValue< _T_ > > | create (const _TOther_ &_value, const knowCore::Uri &_unit_uri) |
template<typename _TOther_ > requires (not std::is_base_of_v<Value, _TOther_>) | |
cres_qresult< QuantityValue< _T_ > > | create (const _TOther_ &_value, const Symbol &_unit_symbol) |
Static Public Member Functions | |
template<typename _TOther_ , typename _TUri_ > requires (not std::is_base_of_v<Value, _TOther_> and knowCore::Uris::IsUriDefinitionV<_TUri_>) | |
static cres_qresult< QuantityValue > | create (const _TOther_ &_value, const _TUri_ &_unit_uri) |
template<typename _TOther_ > requires (not std::is_base_of_v<Value, _TOther_>) | |
static cres_qresult< QuantityValue > | create (const _TOther_ &_value, const knowCore::Uri &_unit_uri) |
static cres_qresult< QuantityValue > | create (const Value &_value, const knowCore::Uri &_unit_uri) |
template<typename _TOther_ > requires (not std::is_base_of_v<Value, _TOther_>) | |
static cres_qresult< QuantityValue > | create (const _TOther_ &_value, const QString &_unit_uri)=delete |
static cres_qresult< QuantityValue > | create (const Value &_value, const QString &_unit_uri)=delete |
template<typename _TOther_ > requires (not std::is_base_of_v<Value, _TOther_>) | |
static cres_qresult< QuantityValue > | create (const _TOther_ &_value, const Symbol &_unit_symbol) |
static cres_qresult< QuantityValue > | create (const Value &_value, const Symbol &_unit_symbol) |
static cres_qresult< QuantityValue > | fromJsonValue (const QJsonValue &_value, const DeserialisationContexts &_context=defaultDeserialisationContext()) |
static cres_qresult< QuantityValue > | fromCborValue (const QCborValue &_value, const DeserialisationContexts &_context=defaultDeserialisationContext()) |
static cres_qresult< QuantityValue > | fromRdfLiteral (const QString &_value, const DeserialisationContexts &_context=defaultDeserialisationContext()) |
This class can be use to combine a number with a Unit. Look at UnitNumber for an alias combining BigNumber with Unit.
|
inlinestatic |
Convert from cbor
|
inlinestatic |
Convert from json
|
inlinestatic |
Convert from a rdf literal (something like "12.0 m/s")
|
inline |
QuantityValue< _T_ > knowCore::QuantityValue< _T_ >::operator* | ( | const _T_ & | _rhs | ) | const |
Multiplication.
|
inline |
Attempt a multiplication, return an error if units are not compatible
|
inline |
Attempt an addition, return an error if units are not compatible
|
inline |
Attempt an substractionm, return an error if units are not compatible
QuantityValue< _T_ > knowCore::QuantityValue< _T_ >::operator/ | ( | const _T_ & | _rhs | ) | const |
Division.
|
inline |
Attempt a division, return an error if units are not compatible
cres_qresult< bool > knowCore::QuantityValue< _T_ >::operator< | ( | const QuantityValue< _T_ > & | _rhs | ) | const |
Compare two values for inferirority. It will return an error if the units are not compatible.
bool knowCore::QuantityValue< _T_ >::operator== | ( | const QuantityValue< _T_ > & | _rhs | ) | const |
Compare two values. Note, that comparing two numbers with different unit is acceptable and will return false.
|
inline |
Return a printable value
|
inline |
Convert to cbor
|
inline |
Convert to json
|
inline |
Convert to a rdf literal (something like "12.0 m/s")
|
inline |
|
inline |