• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KUnitConversion

  • sources
  • kde-4.14
  • kdelibs
  • kunitconversion
value.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2009 Petri Damstén <damu@iki.fi>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef KUNITCONVERSION_VALUE_H
21 #define KUNITCONVERSION_VALUE_H
22 
23 #include <QtCore/QString>
24 #include "unit.h"
25 #include "kunitconversion_export.h"
26 
27 class QVariant;
28 
29 namespace KUnitConversion
30 {
31 
32 class KUNITCONVERSION_EXPORT Value
33 {
34 public:
35  Value();
36  Value(double n, UnitPtr u);
37  Value(double n, const QString& u);
38  Value(double n, int u);
39  Value(const QVariant& n, const QString& u);
40  ~Value();
41 
47  bool isValid() const;
48 
59  QString toString(int fieldWidth = 0, char format = 'g', int precision = -1,
60  const QChar& fillChar = QLatin1Char(' ')) const;
61 
72  QString toSymbolString(int fieldWidth = 0, char format = 'g', int precision = -1,
73  const QChar& fillChar = QLatin1Char(' ')) const;
74 
78  double number() const;
79 
84  Value& round(uint decimals);
85 
89  UnitPtr unit() const;
90 
94  Value convertTo(UnitPtr unit) const;
95 
99  Value convertTo(int unit) const;
100 
104  Value convertTo(const QString& unit) const;
105 
106  Value& operator=(const Value&);
107 
108 private:
109  class Private;
110  Private* const d;
111 };
112 
113 } // KUnitConversion namespace
114 
115 #endif
QChar
KUnitConversion::Value
Definition: value.h:32
QString
QLatin1Char
unit.h
KUnitConversion::UnitPtr
KSharedPtr< Unit > UnitPtr
Definition: unit.h:125
kunitconversion_export.h
QVariant
This file is part of the KDE documentation.
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.

KUnitConversion

Skip menu "KUnitConversion"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal