KUnitConversion::Unit

Search for usage in LXR

KUnitConversion::Unit Class Reference

#include <unit.h>

Public Member Functions

 Unit ()
 
 Unit (const Unit &other)
 
UnitCategory category () const
 
CategoryId categoryId () const
 
QString description () const
 
UnitId id () const
 
bool isNull () const
 
bool isValid () const
 
bool operator!= (const Unit &other) const
 
Unitoperator= (const Unit &other)
 
Unitoperator= (Unit &&other)
 
bool operator== (const Unit &other) const
 
QString symbol () const
 
QString toString (qreal value, int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const
 
QString toSymbolString (qreal value, int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const
 

Protected Member Functions

qreal fromDefault (qreal value) const
 
qreal toDefault (qreal value) const
 

Detailed Description

Class to define a unit of measurement.

This is a class to define a unit of measurement.

See also
Converter, UnitCategory, Value
Author
Petri Damstén damu@.nosp@m.iki..nosp@m.fi
John Layt jlayt.nosp@m.@kde.nosp@m..org

Definition at line 763 of file unit.h.

Constructor & Destructor Documentation

◆ Unit() [1/2]

KUnitConversion::Unit::Unit ( )

Null constructor.

Definition at line 83 of file unit.cpp.

◆ Unit() [2/2]

KUnitConversion::Unit::Unit ( const Unit & other)

Copy constructor, copy other to this.

Definition at line 93 of file unit.cpp.

◆ ~Unit()

KUnitConversion::Unit::~Unit ( )

Definition at line 98 of file unit.cpp.

Member Function Documentation

◆ category()

UnitCategory KUnitConversion::Unit::category ( ) const
Returns
unit category.

Definition at line 158 of file unit.cpp.

◆ categoryId()

CategoryId KUnitConversion::Unit::categoryId ( ) const
Returns
category id.

Definition at line 150 of file unit.cpp.

◆ description()

QString KUnitConversion::Unit::description ( ) const
Returns
translated name for unit.

Definition at line 166 of file unit.cpp.

◆ fromDefault()

qreal KUnitConversion::Unit::fromDefault ( qreal value) const
protected

Definition at line 197 of file unit.cpp.

◆ id()

UnitId KUnitConversion::Unit::id ( ) const
Returns
unit id.

Definition at line 142 of file unit.cpp.

◆ isNull()

bool KUnitConversion::Unit::isNull ( ) const
Returns
returns true if this Unit is null

Definition at line 132 of file unit.cpp.

◆ isValid()

bool KUnitConversion::Unit::isValid ( ) const
Returns
if unit is valid.

Definition at line 137 of file unit.cpp.

◆ operator!=()

bool KUnitConversion::Unit::operator!= ( const Unit & other) const
Returns
true if this Unit is not equal to the other Unit.

Definition at line 123 of file unit.cpp.

◆ operator=() [1/2]

Unit & KUnitConversion::Unit::operator= ( const Unit & other)

Assignment operator, assign other to this.

Definition at line 102 of file unit.cpp.

◆ operator=() [2/2]

Unit & KUnitConversion::Unit::operator= ( Unit && other)

Move-assigns other to this Unit instance, transferring the ownership of the managed pointer to this instance.

Definition at line 108 of file unit.cpp.

◆ operator==()

bool KUnitConversion::Unit::operator== ( const Unit & other) const
Returns
true if this Unit is equal to the other Unit.

Definition at line 114 of file unit.cpp.

◆ symbol()

QString KUnitConversion::Unit::symbol ( ) const
Returns
symbol for the unit.

Definition at line 174 of file unit.cpp.

◆ toDefault()

qreal KUnitConversion::Unit::toDefault ( qreal value) const
protected

Definition at line 189 of file unit.cpp.

◆ toString()

QString KUnitConversion::Unit::toString ( qreal value,
int fieldWidth = 0,
char format = 'g',
int precision = -1,
const QChar & fillChar = QLatin1Char(' ') ) const
Parameters
valuenumber value
fieldWidthwidth of the formatted field, padded by spaces. Positive value aligns right, negative aligns left
formattype of floating point formatting, like in QString::arg
precisionnumber of digits after the decimal separator
fillCharthe character used to fill up the empty places when field width is greater than argument width
Returns
value + unit string

Definition at line 205 of file unit.cpp.

◆ toSymbolString()

QString KUnitConversion::Unit::toSymbolString ( qreal value,
int fieldWidth = 0,
char format = 'g',
int precision = -1,
const QChar & fillChar = QLatin1Char(' ') ) const
Parameters
valuenumber value
fieldWidthwidth of the formatted field, padded by spaces. Positive value aligns right, negative aligns left
formattype of floating point formatting, like in QString::arg
precisionnumber of digits after the decimal separator
fillCharthe character used to fill up the empty places when field width is greater than argument width
Returns
value + unit string

Definition at line 216 of file unit.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:06:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.