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

KUnitConversion

density.cpp

Go to the documentation of this file.
00001 /*
00002  *   Copyright (C) 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 #include "density.h"
00021 #include "converter.h"
00022 #include <klocale.h>
00023 
00024 using namespace KUnitConversion;
00025 
00026 Density::Density() : UnitCategory(DensityCategory)
00027 {
00028     setName(i18n("Density"));
00029     setSymbolStringFormat(ki18nc("%1 value, %2 unit symbol (density)", "%1 %2"));
00030 
00031     setDefaultUnit(UP(KilogramsPerCubicMeter, 1,
00032       i18nc("density unit symbol", "kg/m³"),
00033       i18nc("unit description in lists", "kilograms per cubic meter"),
00034       i18nc("unit synonyms for matching user input",
00035             "kilogram per cubic meter;kilograms per cubic meter;kg/m³"),
00036       ki18nc("amount in units (real)", "%1 kilograms per cubic meter"),
00037       ki18ncp("amount in units (integer)",
00038               "%1 kilogram per cubic meter", "%1 kilograms per cubic meter")
00039     ));
00040 
00041     // source Google calculator
00042     U(KilogramPerLiter, 1000,
00043       i18nc("density unit symbol", "kg/l"),
00044       i18nc("unit description in lists", "kilograms per liter"),
00045       i18nc("unit synonyms for matching user input",
00046             "kilogram per liter;kilograms per liter;kg/l"),
00047       ki18nc("amount in units (real)", "%1 kilograms per liter"),
00048       ki18ncp("amount in units (integer)", "%1 kilogram per liter", "%1 kilograms per liter")
00049     );
00050     U(GramPerLiter, 1,
00051       i18nc("density unit symbol", "g/l"),
00052       i18nc("unit description in lists", "grams per liter"),
00053       i18nc("unit synonyms for matching user input", "gram per liter;grams per liter;g/l"),
00054       ki18nc("amount in units (real)", "%1 grams per liter"),
00055       ki18ncp("amount in units (integer)", "%1 gram per liter", "%1 grams per liter")
00056     );
00057     U(GramPerMilliliter, 1000,
00058       i18nc("density unit symbol", "g/ml"),
00059       i18nc("unit description in lists", "grams per milliliter"),
00060       i18nc("unit synonyms for matching user input",
00061             "gram per milliliter;grams per milliliter;g/ml"),
00062       ki18nc("amount in units (real)", "%1 grams per milliliter"),
00063       ki18ncp("amount in units (integer)", "%1 gram per milliliter", "%1 grams per milliliter")
00064     );
00065 
00066     // source : Google calculator
00067     U(OuncePerCubicInch, 1729.99404,
00068       i18nc("density unit symbol", "oz/in³"),
00069       i18nc("unit description in lists", "ounces per cubic inch"),
00070       i18nc("unit synonyms for matching user input",
00071             "ounce per cubic inch;ounces per cubic inch;oz/in³"),
00072       ki18nc("amount in units (real)", "%1 ounces per cubic inch"),
00073       ki18ncp("amount in units (integer)", "%1 ounce per cubic inch", "%1 ounces per cubic inch")
00074     );
00075     U(OuncePerCubicFoot, 1.00115396,
00076       i18nc("density unit symbol", "oz/ft³"),
00077       i18nc("unit description in lists", "ounces per cubic foot"),
00078       i18nc("unit synonyms for matching user input",
00079             "ounce per cubic foot;ounces per cubic foot;oz/ft³"),
00080       ki18nc("amount in units (real)", "%1 ounces per cubic foot"),
00081       ki18ncp("amount in units (integer)", "%1 ounce per cubic foot", "%1 ounces per cubic foot")
00082     );
00083     U(PoundPerCubicInch, 27679.9047,
00084       i18nc("density unit symbol", "lb/in³"),
00085       i18nc("unit description in lists", "pounds per cubic inch"),
00086       i18nc("unit synonyms for matching user input",
00087             "pound per cubic inch;pounds per cubic inch;lb/in³"),
00088       ki18nc("amount in units (real)", "%1 pounds per cubic inch"),
00089       ki18ncp("amount in units (integer)", "%1 pound per cubic inch", "%1 pounds per cubic inch")
00090     );
00091     U(PoundPerCubicFoot, 16.0184634,
00092       i18nc("density unit symbol", "lb/ft³"),
00093       i18nc("unit description in lists", "pounds per cubic foot"),
00094       i18nc("unit synonyms for matching user input",
00095             "pound per cubic foot;pounds per cubic foot;lb/ft³"),
00096       ki18nc("amount in units (real)", "%1 pounds per cubic foot"),
00097       ki18ncp("amount in units (integer)", "%1 pound per cubic foot", "%1 pounds per cubic foot")
00098     );
00099     U(PoundPerCubicYard, 0.593276421,
00100       i18nc("density unit symbol", "lb/yd³"),
00101       i18nc("unit description in lists", "pounds per cubic yard"),
00102       i18nc("unit synonyms for matching user input",
00103             "pound per cubic yard;pounds per cubic yard;lb/yd³"),
00104       ki18nc("amount in units (real)", "%1 pounds per cubic yard"),
00105       ki18ncp("amount in units (integer)", "%1 pound per cubic yard", "%1 pounds per cubic yard")
00106     );
00107 
00108     setMostCommonUnits(QList<int>() <<
00109             KilogramsPerCubicMeter << KilogramPerLiter << OuncePerCubicInch);
00110 }

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