8#ifndef KUNITCONVERSION_VALUE_H
9#define KUNITCONVERSION_VALUE_H
11#include "kunitconversion/kunitconversion_export.h"
15#include <QSharedDataPointer>
20namespace KUnitConversion
35class KUNITCONVERSION_EXPORT
Value
49 Value(qreal number,
const QString &unitString);
53 Value(qreal number, UnitId unitId);
57 Value(
const QVariant &number,
const QString &unitString);
74#ifdef Q_COMPILER_RVALUE_REFS
136 QString
toString(
int fieldWidth = 0,
char format =
'g',
int precision = -1,
const QChar &fillChar = QLatin1Char(
' '))
const;
148 QString
toSymbolString(
int fieldWidth = 0,
char format =
'g',
int precision = -1,
const QChar &fillChar = QLatin1Char(
' '))
const;
172 QSharedDataPointer<ValuePrivate> d;
Class to define a unit of measurement.
Definition unit.h:758
Class to hold a value in a unit of measurement.
Definition value.h:36
Value convertTo(const QString &unit) const
convert to another unit
Value(qreal number, UnitId unitId)
Creates a value with a unit (as a enum value).
Value(const Value &other)
Copy constructor, copy other to this.
Value(const QVariant &number, const QString &unitString)
Creates a value based on a QVariant (calling toReal() on it) with a unit (as a string).
QString toSymbolString(int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const
Convert value to a string with symbol.
Value(qreal number, const QString &unitString)
Creates a value with a unit (as a string).
QString toString(int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const
Convert value to a string.
qreal number() const
Number part of the value.
bool isValid() const
Check if value is valid.
Value & operator=(const Value &other)
Assignment operator, assign other to this.
bool operator==(const Value &other) const
Value convertTo(UnitId unit) const
convert to another unit
Unit unit() const
Unit part of the value.
Value convertTo(const Unit &unit) const
convert to another unit
Value(qreal number, const Unit &unit)
Creates a value with a unit instance.
Value()
Creates a null value.
void swap(Value &other)
Swaps this Value with other.
Definition value.h:89
Value & round(uint decimals)
rounds value to decimal count
~Value()
Destroys this Value instance.
bool operator!=(const Value &other) const