• 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
unitcategory.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_UNITCATEGORY_H
21 #define KUNITCONVERSION_UNITCATEGORY_H
22 
23 #include "value.h"
24 #include "unit.h"
25 #include <QtCore/QString>
26 #include <QtCore/QStringList>
27 #include <kurl.h>
28 #include "kunitconversion_export.h"
29 
30 namespace KUnitConversion
31 {
32 
33 class KUNITCONVERSION_EXPORT UnitCategory
34 {
35 public:
36  UnitCategory(int id);
37  virtual ~UnitCategory();
38 
44  QString name() const;
45 
49  QString description() const;
50 
54  KUrl url() const;
55 
61  UnitPtr defaultUnit() const;
62 
68  bool hasUnit(const QString &unit) const;
69 
75  UnitPtr unit(const QString& s) const;
76 
82  UnitPtr unit(int unitId) const;
83 
89  QList<UnitPtr> units() const;
90 
96  QList<UnitPtr> mostCommonUnits() const;
97 
103  QStringList allUnits() const;
104 
112  Value convert(const Value& value, const QString& toUnit = QString());
113  Value convert(const Value& value, int toUnit);
114  virtual Value convert(const Value& value, UnitPtr toUnit);
115 
119  int id() const;
120 
121 protected:
122  void setName(const QString& name);
123  void setDefaultUnit(UnitPtr defaultUnit);
124  void addUnitName(const QString& name);
125  void addUnitMapValues(UnitPtr unit, const QString& names);
126  void addIdMapValue(UnitPtr unit, int id);
127  void setDescription(const QString& desc);
128  void setUrl(const KUrl& url);
129  void setSymbolStringFormat(const KLocalizedString& symbolStringFormat);
130  void setMostCommonUnits(const QList<int>& units);
131  KLocalizedString symbolStringFormat() const;
132 
133 private:
134  friend class Unit;
135  class Private;
136  Private* const d;
137 };
138 
139 } // KUnitConversion namespace
140 
141 #endif
KUnitConversion::Value
Definition: value.h:32
KUnitConversion::Unit
Definition: unit.h:43
QString
QList< UnitPtr >
QStringList
unit.h
KUnitConversion::UnitCategory
Definition: unitcategory.h:33
KUnitConversion::UnitPtr
KSharedPtr< Unit > UnitPtr
Definition: unit.h:125
value.h
kunitconversion_export.h
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