KUnitConversion::Converter
#include <converter.h>
Public Member Functions | |
Converter () | |
Converter (const Converter &other) | |
~Converter () | |
QList< UnitCategory > | categories () const |
UnitCategory | category (CategoryId categoryId) const |
UnitCategory | category (const QString &category) const |
UnitCategory | categoryForUnit (const QString &unit) const |
Value | convert (const Value &value, const QString &toUnit=QString()) const |
Value | convert (const Value &value, const Unit &toUnit) const |
Value | convert (const Value &value, UnitId toUnit) const |
Converter & | operator= (const Converter &other) |
Converter & | operator= (Converter &&other) |
Unit | unit (const QString &unitString) const |
Unit | unit (UnitId unitId) const |
Detailed Description
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
Definition at line 34 of file converter.h.
Constructor & Destructor Documentation
◆ Converter() [1/2]
KUnitConversion::Converter::Converter | ( | ) |
Creates a Converter instance.
Definition at line 90 of file converter.cpp.
◆ ~Converter()
KUnitConversion::Converter::~Converter | ( | ) |
Destroys this Converter instance.
Definition at line 95 of file converter.cpp.
◆ Converter() [2/2]
KUnitConversion::Converter::Converter | ( | const Converter & | other | ) |
Copy constructor.
- Parameters
-
other existing Converter instance.
Definition at line 99 of file converter.cpp.
Member Function Documentation
◆ categories()
QList< UnitCategory > KUnitConversion::Converter::categories | ( | ) | const |
Returns a list of all unit categories.
- Returns
- list of unit categories.
Definition at line 196 of file converter.cpp.
◆ 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.
Definition at line 187 of file converter.cpp.
◆ 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.
Definition at line 175 of file converter.cpp.
◆ 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
Definition at line 140 of file converter.cpp.
◆ convert() [1/3]
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
Definition at line 116 of file converter.cpp.
◆ convert() [2/3]
Definition at line 132 of file converter.cpp.
◆ convert() [3/3]
Definition at line 124 of file converter.cpp.
◆ operator=() [1/2]
Assignment operator, assign other
to this.
Definition at line 104 of file converter.cpp.
◆ operator=() [2/2]
Move-assigns other
to this Converter instance, transferring the ownership of the managed pointer to this instance.
Definition at line 110 of file converter.cpp.
◆ unit() [1/2]
Find unit for string unit.
- Parameters
-
unitString unit string to find unit for.
- Returns
- unit for string unit
Definition at line 151 of file converter.cpp.
◆ 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
Definition at line 163 of file converter.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:16:51 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.