6#include "mapcssvalue_p.h"
14MapCSSValue::MapCSSValue() =
default;
21MapCSSValue::MapCSSValue(
double num)
25MapCSSValue::MapCSSValue(
bool b)
29MapCSSValue::~MapCSSValue() =
default;
31bool MapCSSValue::isNone()
const
33 switch (m_value.typeId()) {
35 return m_value.toByteArray().isEmpty();
37 return m_value.toDouble() == 0.0 || std::isnan(m_value.toDouble());
39 return m_value.isNull();
44 switch (m_value.typeId()) {
46 return m_value.toByteArray();
50 return m_value.toBool() ?
"true" :
"false";
55double MapCSSValue::asNumber()
const
57 switch (m_value.typeId()) {
59 const auto b = m_value.toByteArray();
64 auto n = b.toDouble(&ok);
68 return m_value.toDouble();
74bool MapCSSValue::asBoolean()
const
76 switch (m_value.typeId()) {
79 const auto b = m_value.toByteArray();
80 return b !=
"false" && b !=
"0" && b !=
"no" && !b.isEmpty();
83 return m_value.toDouble() != 0.0;
85 return m_value.toBool();
91bool MapCSSValue::compareEqual(
const MapCSSValue &other)
const
93 if (m_value.typeId() != other.m_value.typeId()) {
94 return asString() == other.asString();
97 switch (m_value.typeId()) {
99 return m_value.toByteArray() == other.m_value.toByteArray();
101 return m_value.toDouble() == other.m_value.toDouble();
103 return m_value.toBool() == other.m_value.toBool();
109void MapCSSValue::write(
QIODevice *out)
const
111 switch (m_value.typeId()) {
113 out->
write(m_value.toByteArray());
OSM-based multi-floor indoor maps for buildings.
QByteArray number(double n, char format, int precision)
qint64 write(const QByteArray &data)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:09:08 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.