/usr/include/kunitconversion/converter.h is in kdelibs5-dev 4:4.14.38-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | /*
* Copyright (C) 2008-2009 Petri Damstén <damu@iki.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KUNITCONVERSION_CONVERTER_H
#define KUNITCONVERSION_CONVERTER_H
#include <kunitconversion/value.h>
#include <kunitconversion/kunitconversion_export.h>
#include <QtCore/QVariant>
namespace KUnitConversion
{
enum CategoryId {
InvalidCategory = -1, LengthCategory, AreaCategory, VolumeCategory, TemperatureCategory,
VelocityCategory, MassCategory, PressureCategory, EnergyCategory, CurrencyCategory,
PowerCategory, TimeCategory, FuelEfficiencyCategory, DensityCategory, AccelerationCategory,
AngleCategory, FrequencyCategory, ForceCategory
};
enum UnitId {
InvalidUnit = -1, NoUnit = 0, Percent = 1,
// Area
SquareYottameter = 1000, SquareZettameter, SquareExameter, SquarePetameter, SquareTerameter,
SquareGigameter, SquareMegameter, SquareKilometer, SquareHectometer, SquareDecameter,
SquareMeter, SquareDecimeter, SquareCentimeter, SquareMillimeter, SquareMicrometer,
SquareNanometer, SquarePicometer, SquareFemtometer, SquareAttometer, SquareZeptometer,
SquareYoctometer, Acre, SquareFoot, SquareInch, SquareMile,
// Length
Yottameter = 2000, Zettameter, Exameter, Petameter, Terameter, Gigameter, Megameter,
Kilometer, Hectometer, Decameter, Meter, Decimeter, Centimeter, Millimeter, Micrometer,
Nanometer, Picometer, Femtometer, Attometer, Zeptometer, Yoctometer, Inch, Foot, Yard,
Mile, NauticalMile, LightYear, Parsec, AstronomicalUnit, Thou, Angstrom,
// Volume
CubicYottameter = 3000, CubicZettameter, CubicExameter, CubicPetameter, CubicTerameter,
CubicGigameter, CubicMegameter, CubicKilometer, CubicHectometer, CubicDecameter, CubicMeter,
CubicDecimeter, CubicCentimeter, CubicMillimeter, CubicMicrometer, CubicNanometer,
CubicPicometer, CubicFemtometer, CubicAttometer, CubicZeptometer, CubicYoctometer,
Yottaliter, Zettaliter, Exaliter, Petaliter, Teraliter, Gigaliter, Megaliter, Kiloliter,
Hectoliter, Decaliter, Liter, Deciliter, Centiliter, Milliliter, Microliter, Nanoliter,
Picoliter, Femtoliter, Attoliter, Zeptoliter, Yoctoliter, CubicFoot, CubicInch, CubicMile,
FluidOunce, Cup, GallonUS, PintImperial,
// Mass
Yottagram = 4000, Zettagram, Exagram, Petagram, Teragram, Gigagram, Megagram, Kilogram,
Hectogram, Decagram, Gram, Decigram, Centigram, Milligram, Microgram, Nanogram, Picogram,
Femtogram, Attogram, Zeptogram, Yoctogram, Ton, Carat, Pound, Ounce, TroyOunce, MassNewton,
Kilonewton,
// Pressure
Yottapascal = 5000, Zettapascal, Exapascal, Petapascal, Terapascal, Gigapascal, Megapascal,
Kilopascal, Hectopascal, Decapascal, Pascal, Decipascal, Centipascal, Millipascal,
Micropascal, Nanopascal, Picopascal, Femtopascal, Attopascal, Zeptopascal, Yoctopascal,
Bar, Millibar, Decibar, Torr, TechnicalAtmosphere, Atmosphere, PoundForcePerSquareInch,
InchesOfMercury, MillimetersOfMercury,
// Temperature
Kelvin = 6000, Celsius, Fahrenheit, Rankine, Delisle, TemperatureNewton, Reaumur, Romer,
// Energy
Yottajoule = 7000, Zettajoule, Exajoule, Petajoule, Terajoule, Gigajoule, Megajoule,
Kilojoule, Hectojoule, Decajoule, Joule, Decijoule, Centijoule, Millijoule, Microjoule,
Nanojoule, Picojoule, Femtojoule, Attojoule, Zeptojoule, Yoctojoule, GuidelineDailyAmount,
Electronvolt, Rydberg, Kilocalorie, PhotonWavelength, KiloJoulePerMole, JoulePerMole,
// Currency
Eur = 8000, Ats, Bef, Nlg, Fim, Frf, Dem, Iep, Itl, Luf, Pte, Esp, Grd, Sit, Cyp, Mtl, Skk,
Usd, Jpy, Bgn, Czk, Dkk, Eek, Gbp, Huf, Ltl, Lvl, Pln, Ron, Sek, Chf, Nok, Hrk, Rub, Try,
Aud, Brl, Cad, Cny, Hkd, Idr, Inr, Krw, Mxn, Myr, Nzd, Php, Sgd, Thb, Zar,
// Velocity
MeterPerSecond = 9000, KilometerPerHour, MilePerHour, FootPerSecond, InchPerSecond, Knot,
Mach, SpeedOfLight, Beaufort,
// Power
Yottawatt = 10000, Zettawatt, Exawatt, Petawatt, Terawatt, Gigawatt, Megawatt, Kilowatt,
Hectowatt, Decawatt, Watt, Deciwatt, Centiwatt, Milliwatt, Microwatt, Nanowatt, Picowatt,
Femtowatt, Attowatt, Zeptowatt, Yoctowatt, Horsepower,
// Time
Yottasecond = 11000, Zettasecond, Exasecond, Petasecond, Terasecond, Gigasecond, Megasecond,
Kilosecond, Hectosecond, Decasecond, Second, Decisecond, Centisecond, Millisecond,
Microsecond, Nanosecond, Picosecond, Femtosecond, Attosecond, Zeptosecond, Yoctosecond,
Minute, Hour, Day, Week, JulianYear, LeapYear, Year,
// FuelEfficiency
LitersPer100Kilometers = 12000, MilePerUsGallon, MilePerImperialGallon, KilometrePerLitre,
// Density
YottakilogramsPerCubicMeter = 13000, ZettakilogramPerCubicMeter, ExakilogramPerCubicMeter,
PetakilogramPerCubicMeter, TerakilogramPerCubicMeter, GigakilogramPerCubicMeter,
MegakilogramPerCubicMeter, KilokilogramPerCubicMeter, HectokilogramsPerCubicMeter,
DecakilogramsPerCubicMeter, KilogramsPerCubicMeter, DecikilogramsPerCubicMeter,
CentikilogramsPerCubicMeter, MillikilogramsPerCubicMeter, MicrokilogramsPerCubicMeter,
NanokilogramsPerCubicMeter, PicokilogramsPerCubicMeter, FemtokilogramsPerCubicMeter,
AttokilogramsPerCubicMeter, ZeptokilogramsPerCubicMeter, YoctokilogramsPerCubicMeter,
KilogramPerLiter, GramPerLiter, GramPerMilliliter,
OuncePerCubicInch, OuncePerCubicFoot, OuncePerCubicYard,
PoundPerCubicInch, PoundPerCubicFoot, PoundPerCubicYard,
// Acceleration
MetresPerSecondSquared = 14000, FeetPerSecondSquared, StandardGravity,
// Force
Yottanewton = 15000, Zettanewton, Exanewton, Petanewton, Teranewton, Giganewton, Meganewton,
KilonewtonForce, Hectonewton, Decanewton, Newton, Decinewton, Centinewton, Millinewton, Micronewton,
Nanonewton, Piconewton, Femtonewton, Attonewton, Zeptonewton, Yoctonewton, Dyne, Kilopond,
PoundForce, Poundal,
// Angle
Degree = 16000, Radian, Gradian, ArcMinute, ArcSecond,
// Frequency
Yottahertz = 17000, Zettahertz, Exahertz, Petahertz, Terahertz, Gigahertz, Megahertz,
Kilohertz, Hectohertz, Decahertz, Hertz, Decihertz, Centihertz, Millihertz, Microhertz,
Nanohertz, Picohertz, Femtohertz, Attohertz, Zeptohertz, Yoctohertz, RPM
};
class UnitCategory;
class ConverterPrivate;
class KUNITCONVERSION_EXPORT Converter : public QObject
{
Q_OBJECT
public:
explicit Converter(QObject* parent = 0);
~Converter();
/**
* Convert value to another unit.
*
* @param value value to convert
* @param toUnit unit to convert to. If empty default unit is used.
* @return converted value
**/
Value convert(const Value& value, const QString& toUnit = QString()) const;
Value convert(const Value& value, int toUnit) const;
Value convert(const Value& value, UnitPtr toUnit) const;
/**
* Find unit category for unit.
*
* @param unit unit to find category for.
* @return unit category for unit
**/
UnitCategory* categoryForUnit(const QString& unit) const;
/**
* Find unit for string unit.
*
* @param unitString unit string to find unit for.
* @return unit for string unit
**/
UnitPtr unit(const QString& unitString) const;
/**
* Find unit for unit enum.
*
* @param unit unit enum to find unit for.
* @return unit for string unit
**/
UnitPtr unit(int unitId) const;
/**
* Find unit category.
*
* @param category name of the category to find (length, area, mass, etc.).
* @return unit category named category or invalid category.
**/
UnitCategory* category(const QString& category) const;
/**
* Find unit category.
*
* @param categoryId id of the category to find (LengthCategory, AreaCategory, etc.).
* @return unit category which id is categoryId or invalid category.
**/
UnitCategory* category(int categoryId) const;
/**
* Returns a list of all unit categories.
*
* @return list of unit categories.
**/
QList<UnitCategory*> categories() const;
private:
ConverterPrivate *d;
};
} // KUnitConversion namespace
#endif
|