Class for converting values between units of measurement.
More...
#include <converter.h>
Class for converting values between units of measurement.
This is a class to convert values between different units of measurement.
- See also
- Unit, UnitCategory, Value
- Author
- Petri Damstén damu@.nosp@m.iki..nosp@m.fi
-
John Layt jlayt.nosp@m.@kde.nosp@m..org
◆ Converter() [1/2]
KUnitConversion::Converter::Converter |
( |
| ) |
|
◆ ~Converter()
KUnitConversion::Converter::~Converter |
( |
| ) |
|
◆ Converter() [2/2]
KUnitConversion::Converter::Converter |
( |
const Converter & |
other | ) |
|
Copy constructor.
- Parameters
-
◆ __attribute__() [1/2]
KUnitConversion::Converter::__attribute__ |
( |
(__deprecated__("Since ""5"".""91"". " "result is always false")) |
| ) |
|
◆ __attribute__() [2/2]
KUnitConversion::Converter::__attribute__ |
( |
(__deprecated__("Since ""5"".""91"". " "result is always true")) |
| ) |
|
◆ categories()
QList< UnitCategory > KUnitConversion::Converter::categories |
( |
| ) |
const |
Returns a list of all unit categories.
- Returns
- list of unit categories.
◆ category() [1/2]
UnitCategory KUnitConversion::Converter::category |
( |
CategoryId |
categoryId | ) |
const |
Find unit category.
- Parameters
-
categoryId | id of the category to find (LengthCategory, AreaCategory, etc.). |
- Returns
- unit category which id is categoryId or invalid category.
◆ category() [2/2]
UnitCategory KUnitConversion::Converter::category |
( |
const QString & |
category | ) |
const |
Find unit category.
- Parameters
-
category | name of the category to find (length, area, mass, etc.). |
- Returns
- unit category named category or invalid category.
◆ categoryForUnit()
UnitCategory KUnitConversion::Converter::categoryForUnit |
( |
const QString & |
unit | ) |
const |
Find unit category for unit.
- Parameters
-
unit | unit to find category for. |
- Returns
- unit category for unit
◆ convert()
Value KUnitConversion::Converter::convert |
( |
const Value & |
value, |
|
|
const QString & |
toUnit = QString() |
|
) |
| const |
Convert value to another unit.
- Parameters
-
value | value to convert |
toUnit | unit to convert to. If empty default unit is used. |
- Returns
- converted value
◆ operator=()
Assignment operator, assign other
to this.
◆ swap()
void KUnitConversion::Converter::swap |
( |
Converter & |
other | ) |
|
|
inline |
Swaps this Converter with other
.
This function is very fast and never fails.
◆ unit() [1/2]
Unit KUnitConversion::Converter::unit |
( |
const QString & |
unitString | ) |
const |
Find unit for string unit.
- Parameters
-
unitString | unit string to find unit for. |
- Returns
- unit for string unit
◆ unit() [2/2]
Unit KUnitConversion::Converter::unit |
( |
UnitId |
unitId | ) |
const |
Find unit for unit enum.
- Parameters
-
unitId | unit enum to find unit for. |
- Returns
- unit for string unit