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

KUnitConversion

unitcategory.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright (C) 2007-2009 Petri Damstén <damu@iki.fi>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU Library General Public License as
00006  *   published by the Free Software Foundation; either version 2, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 
00020 #ifndef KUNITCONVERSION_UNITCATEGORY_H
00021 #define KUNITCONVERSION_UNITCATEGORY_H
00022 
00023 #include "value.h"
00024 #include "unit.h"
00025 #include <QtCore/QString>
00026 #include <QtCore/QStringList>
00027 #include <kurl.h>
00028 #include "kunitconversion_export.h"
00029 
00030 namespace KUnitConversion
00031 {
00032 
00033 class KUNITCONVERSION_EXPORT UnitCategory
00034 {
00035 public:
00036     UnitCategory(int id);
00037     virtual ~UnitCategory();
00038 
00044     QString name() const;
00045 
00049     QString description() const;
00050 
00054     KUrl url() const;
00055 
00061     UnitPtr defaultUnit() const;
00062 
00068     bool hasUnit(const QString &unit) const;
00069 
00075     UnitPtr unit(const QString& s) const;
00076 
00082     UnitPtr unit(int unitId) const;
00083 
00089     QList<UnitPtr> units() const;
00090 
00096     QList<UnitPtr> mostCommonUnits() const;
00097 
00103     QStringList allUnits() const;
00104 
00112     Value convert(const Value& value, const QString& toUnit = QString());
00113     Value convert(const Value& value, int toUnit);
00114     virtual Value convert(const Value& value, UnitPtr toUnit);
00115 
00119     int id() const;
00120 
00121 protected:
00122     void setName(const QString& name);
00123     void setDefaultUnit(UnitPtr defaultUnit);
00124     void addUnitName(const QString& name);
00125     void addUnitMapValues(UnitPtr unit, const QString& names);
00126     void addIdMapValue(UnitPtr unit, int id);
00127     void setDescription(const QString& desc);
00128     void setUrl(const KUrl& url);
00129     void setSymbolStringFormat(const KLocalizedString& symbolStringFormat);
00130     void setMostCommonUnits(const QList<int>& units);
00131     KLocalizedString symbolStringFormat() const;
00132 
00133 private:
00134     friend class Unit;
00135     class Private;
00136     Private* const d;
00137 };
00138 
00139 } // KUnitConversion namespace
00140 
00141 #endif

KUnitConversion

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal