KItinerary
priceutil.cpp
22 if (!std::isnan(JsonLdDocument::readProperty(item, "totalPrice").toDouble()) && !JsonLdDocument::readProperty(item, "priceCurrency").isNull()) {
35 return JsonLd::isA<Ticket>(item) || (JsonLd::canConvert<Reservation>(item) && !JsonLd::isA<FoodEstablishmentReservation>(item));
42 return !std::isnan(res.totalPrice()) ? res.totalPrice() : PriceUtil::price(res.reservedTicket());
56 return !res.priceCurrency().isEmpty() ? res.priceCurrency() : PriceUtil::currency(res.reservedTicket());
static void writeProperty(QVariant &obj, const char *name, const QVariant &value)
Set property name on object obj to value value.
Definition jsonlddocument.cpp:538
static QVariant readProperty(const QVariant &obj, const char *name)
Read property name on object obj.
Definition jsonlddocument.cpp:522
static Q_INVOKABLE bool canHavePrice(const QVariant &item)
Returns true if item can have price/currency information.
Definition priceutil.cpp:33
static Q_INVOKABLE void setPrice(QVariant &item, double price, const QString ¤cy)
Sets price and currency on item.
Definition priceutil.cpp:66
static Q_INVOKABLE QString currency(const QVariant &item)
Returns the currency value from item.
Definition priceutil.cpp:52
static int decimalCount(QStringView currency)
Returns the number of decimals to represent the sub-unit of currency.
Definition priceutil.cpp:92
static Q_INVOKABLE double price(const QVariant &item)
Returns the price value from item.
Definition priceutil.cpp:38
static Q_INVOKABLE bool hasPrice(const QVariant &item)
Returns true if item has valid price and currency information.
Definition priceutil.cpp:16
bool canConvert(const QVariant &value)
Checks if the given value can be up-cast to T.
Definition datatypes.h:31
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
T value() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.