KUnitConversion
#include <unitcategory.h>
Public Member Functions | |
UnitCategory (int id) | |
virtual | ~UnitCategory () |
QStringList | allUnits () const |
Value | convert (const Value &value, const QString &toUnit=QString()) |
Value | convert (const Value &value, int toUnit) |
virtual Value | convert (const Value &value, UnitPtr toUnit) |
UnitPtr | defaultUnit () const |
QString | description () const |
bool | hasUnit (const QString &unit) const |
int | id () const |
QList< UnitPtr > | mostCommonUnits () const |
QString | name () const |
UnitPtr | unit (const QString &s) const |
UnitPtr | unit (int unitId) const |
QList< UnitPtr > | units () const |
KUrl | url () const |
Protected Member Functions | |
void | addIdMapValue (UnitPtr unit, int id) |
void | addUnitMapValues (UnitPtr unit, const QString &names) |
void | addUnitName (const QString &name) |
void | setDefaultUnit (UnitPtr defaultUnit) |
void | setDescription (const QString &desc) |
void | setMostCommonUnits (const QList< int > &units) |
void | setName (const QString &name) |
void | setSymbolStringFormat (const KLocalizedString &symbolStringFormat) |
void | setUrl (const KUrl &url) |
KLocalizedString | symbolStringFormat () const |
Detailed Description
Definition at line 33 of file unitcategory.h.
Constructor & Destructor Documentation
KUnitConversion::UnitCategory::UnitCategory | ( | int | id | ) |
Definition at line 49 of file unitcategory.cpp.
|
virtual |
Definition at line 55 of file unitcategory.cpp.
Member Function Documentation
|
protected |
Definition at line 132 of file unitcategory.cpp.
|
protected |
Definition at line 124 of file unitcategory.cpp.
|
protected |
QStringList KUnitConversion::UnitCategory::allUnits | ( | ) | const |
Return all unit names, short names and unit synonyms in this category.
- Returns
- list of units.
Definition at line 88 of file unitcategory.cpp.
Value KUnitConversion::UnitCategory::convert | ( | const Value & | value, |
const QString & | toUnit = QString() |
||
) |
Convert value to another unit.
- Parameters
-
value value to convert toUnit unit to convert to. If empty default unit is used.
- Returns
- converted value
Definition at line 98 of file unitcategory.cpp.
Definition at line 107 of file unitcategory.cpp.
Reimplemented in Currency.
Definition at line 115 of file unitcategory.cpp.
UnitPtr KUnitConversion::UnitCategory::defaultUnit | ( | ) | const |
QString KUnitConversion::UnitCategory::description | ( | ) | const |
- Returns
- unit category description
Definition at line 171 of file unitcategory.cpp.
bool KUnitConversion::UnitCategory::hasUnit | ( | const QString & | unit | ) | const |
Check if unit category has a unit.
- Returns
- True if unit is found
Definition at line 93 of file unitcategory.cpp.
int KUnitConversion::UnitCategory::id | ( | ) | const |
- Returns
- category id.
Definition at line 191 of file unitcategory.cpp.
Return most common units in this category.
- Returns
- list of units.
Definition at line 75 of file unitcategory.cpp.
QString KUnitConversion::UnitCategory::name | ( | ) | const |
Returns name for the unit category.
- Returns
- Translated name for category.
Definition at line 151 of file unitcategory.cpp.
|
protected |
Definition at line 161 of file unitcategory.cpp.
|
protected |
Definition at line 176 of file unitcategory.cpp.
|
protected |
Definition at line 80 of file unitcategory.cpp.
|
protected |
Definition at line 156 of file unitcategory.cpp.
|
protected |
Definition at line 60 of file unitcategory.cpp.
|
protected |
Definition at line 186 of file unitcategory.cpp.
|
protected |
Definition at line 65 of file unitcategory.cpp.
Return unit for string.
- Returns
- Pointer to unit class.
Definition at line 138 of file unitcategory.cpp.
UnitPtr KUnitConversion::UnitCategory::unit | ( | int | unitId | ) | const |
Return unit for unit enum.
- Returns
- Pointer to unit class.
Definition at line 143 of file unitcategory.cpp.
Return units in this category.
- Returns
- list of units.
Definition at line 70 of file unitcategory.cpp.
KUrl KUnitConversion::UnitCategory::url | ( | ) | const |
- Returns
- unit category url for description
Definition at line 181 of file unitcategory.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.