KUnitConversion
power.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 "power.h" 00021 #include "converter.h" 00022 #include <klocale.h> 00023 00024 using namespace KUnitConversion; 00025 00026 Power::Power() : UnitCategory(PowerCategory) 00027 { 00028 setName(i18n("Power")); 00029 setSymbolStringFormat(ki18nc("%1 value, %2 unit symbol (power)", "%1 %2")); 00030 00031 U(Yottawatt, 1e+24, 00032 i18nc("power unit symbol", "YW"), 00033 i18nc("unit description in lists", "yottawatts"), 00034 i18nc("unit synonyms for matching user input", "yottawatt;yottawatts;YW"), 00035 ki18nc("amount in units (real)", "%1 yottawatts"), 00036 ki18ncp("amount in units (integer)", "%1 yottawatt", "%1 yottawatts") 00037 ); 00038 U(Zettawatt, 1e+21, 00039 i18nc("power unit symbol", "ZW"), 00040 i18nc("unit description in lists", "zettawatts"), 00041 i18nc("unit synonyms for matching user input", "zettawatt;zettawatts;ZW"), 00042 ki18nc("amount in units (real)", "%1 zettawatts"), 00043 ki18ncp("amount in units (integer)", "%1 zettawatt", "%1 zettawatts") 00044 ); 00045 U(Exawatt, 1e+18, 00046 i18nc("power unit symbol", "EW"), 00047 i18nc("unit description in lists", "exawatts"), 00048 i18nc("unit synonyms for matching user input", "exawatt;exawatts;EW"), 00049 ki18nc("amount in units (real)", "%1 exawatts"), 00050 ki18ncp("amount in units (integer)", "%1 exawatt", "%1 exawatts") 00051 ); 00052 U(Petawatt, 1e+15, 00053 i18nc("power unit symbol", "PW"), 00054 i18nc("unit description in lists", "petawatts"), 00055 i18nc("unit synonyms for matching user input", "petawatt;petawatts;PW"), 00056 ki18nc("amount in units (real)", "%1 petawatts"), 00057 ki18ncp("amount in units (integer)", "%1 petawatt", "%1 petawatts") 00058 ); 00059 U(Terawatt, 1e+12, 00060 i18nc("power unit symbol", "TW"), 00061 i18nc("unit description in lists", "terawatts"), 00062 i18nc("unit synonyms for matching user input", "terawatt;terawatts;TW"), 00063 ki18nc("amount in units (real)", "%1 terawatts"), 00064 ki18ncp("amount in units (integer)", "%1 terawatt", "%1 terawatts") 00065 ); 00066 U(Gigawatt, 1e+09, 00067 i18nc("power unit symbol", "GW"), 00068 i18nc("unit description in lists", "gigawatts"), 00069 i18nc("unit synonyms for matching user input", "gigawatt;gigawatts;GW"), 00070 ki18nc("amount in units (real)", "%1 gigawatts"), 00071 ki18ncp("amount in units (integer)", "%1 gigawatt", "%1 gigawatts") 00072 ); 00073 U(Megawatt, 1e+06, 00074 i18nc("power unit symbol", "MW"), 00075 i18nc("unit description in lists", "megawatts"), 00076 i18nc("unit synonyms for matching user input", "megawatt;megawatts;MW"), 00077 ki18nc("amount in units (real)", "%1 megawatts"), 00078 ki18ncp("amount in units (integer)", "%1 megawatt", "%1 megawatts") 00079 ); 00080 U(Kilowatt, 1000, 00081 i18nc("power unit symbol", "kW"), 00082 i18nc("unit description in lists", "kilowatts"), 00083 i18nc("unit synonyms for matching user input", "kilowatt;kilowatts;kW"), 00084 ki18nc("amount in units (real)", "%1 kilowatts"), 00085 ki18ncp("amount in units (integer)", "%1 kilowatt", "%1 kilowatts") 00086 ); 00087 U(Hectowatt, 100, 00088 i18nc("power unit symbol", "hW"), 00089 i18nc("unit description in lists", "hectowatts"), 00090 i18nc("unit synonyms for matching user input", "hectowatt;hectowatts;hW"), 00091 ki18nc("amount in units (real)", "%1 hectowatts"), 00092 ki18ncp("amount in units (integer)", "%1 hectowatt", "%1 hectowatts") 00093 ); 00094 U(Decawatt, 10, 00095 i18nc("power unit symbol", "daW"), 00096 i18nc("unit description in lists", "decawatts"), 00097 i18nc("unit synonyms for matching user input", "decawatt;decawatts;daW"), 00098 ki18nc("amount in units (real)", "%1 decawatts"), 00099 ki18ncp("amount in units (integer)", "%1 decawatt", "%1 decawatts") 00100 ); 00101 setDefaultUnit(UP(Watt, 1, 00102 i18nc("power unit symbol", "W"), 00103 i18nc("unit description in lists", "watts"), 00104 i18nc("unit synonyms for matching user input", "watt;watts;W"), 00105 ki18nc("amount in units (real)", "%1 watts"), 00106 ki18ncp("amount in units (integer)", "%1 watt", "%1 watts") 00107 )); 00108 U(Deciwatt, 0.1, 00109 i18nc("power unit symbol", "dW"), 00110 i18nc("unit description in lists", "deciwatts"), 00111 i18nc("unit synonyms for matching user input", "deciwatt;deciwatts;dW"), 00112 ki18nc("amount in units (real)", "%1 deciwatts"), 00113 ki18ncp("amount in units (integer)", "%1 deciwatt", "%1 deciwatts") 00114 ); 00115 U(Centiwatt, 0.01, 00116 i18nc("power unit symbol", "cW"), 00117 i18nc("unit description in lists", "centiwatts"), 00118 i18nc("unit synonyms for matching user input", "centiwatt;centiwatts;cW"), 00119 ki18nc("amount in units (real)", "%1 centiwatts"), 00120 ki18ncp("amount in units (integer)", "%1 centiwatt", "%1 centiwatts") 00121 ); 00122 U(Milliwatt, 0.001, 00123 i18nc("power unit symbol", "mW"), 00124 i18nc("unit description in lists", "milliwatts"), 00125 i18nc("unit synonyms for matching user input", "milliwatt;milliwatts;mW"), 00126 ki18nc("amount in units (real)", "%1 milliwatts"), 00127 ki18ncp("amount in units (integer)", "%1 milliwatt", "%1 milliwatts") 00128 ); 00129 U(Microwatt, 1e-06, 00130 i18nc("power unit symbol", "µW"), 00131 i18nc("unit description in lists", "microwatts"), 00132 i18nc("unit synonyms for matching user input", "microwatt;microwatts;µW;uW"), 00133 ki18nc("amount in units (real)", "%1 microwatts"), 00134 ki18ncp("amount in units (integer)", "%1 microwatt", "%1 microwatts") 00135 ); 00136 U(Nanowatt, 1e-09, 00137 i18nc("power unit symbol", "nW"), 00138 i18nc("unit description in lists", "nanowatts"), 00139 i18nc("unit synonyms for matching user input", "nanowatt;nanowatts;nW"), 00140 ki18nc("amount in units (real)", "%1 nanowatts"), 00141 ki18ncp("amount in units (integer)", "%1 nanowatt", "%1 nanowatts") 00142 ); 00143 U(Picowatt, 1e-12, 00144 i18nc("power unit symbol", "pW"), 00145 i18nc("unit description in lists", "picowatts"), 00146 i18nc("unit synonyms for matching user input", "picowatt;picowatts;pW"), 00147 ki18nc("amount in units (real)", "%1 picowatts"), 00148 ki18ncp("amount in units (integer)", "%1 picowatt", "%1 picowatts") 00149 ); 00150 U(Femtowatt, 1e-15, 00151 i18nc("power unit symbol", "fW"), 00152 i18nc("unit description in lists", "femtowatts"), 00153 i18nc("unit synonyms for matching user input", "femtowatt;femtowatts;fW"), 00154 ki18nc("amount in units (real)", "%1 femtowatts"), 00155 ki18ncp("amount in units (integer)", "%1 femtowatt", "%1 femtowatts") 00156 ); 00157 U(Attowatt, 1e-18, 00158 i18nc("power unit symbol", "aW"), 00159 i18nc("unit description in lists", "attowatts"), 00160 i18nc("unit synonyms for matching user input", "attowatt;attowatts;aW"), 00161 ki18nc("amount in units (real)", "%1 attowatts"), 00162 ki18ncp("amount in units (integer)", "%1 attowatt", "%1 attowatts") 00163 ); 00164 U(Zeptowatt, 1e-21, 00165 i18nc("power unit symbol", "zW"), 00166 i18nc("unit description in lists", "zeptowatts"), 00167 i18nc("unit synonyms for matching user input", "zeptowatt;zeptowatts;zW"), 00168 ki18nc("amount in units (real)", "%1 zeptowatts"), 00169 ki18ncp("amount in units (integer)", "%1 zeptowatt", "%1 zeptowatts") 00170 ); 00171 U(Yoctowatt, 1e-24, 00172 i18nc("power unit symbol", "yW"), 00173 i18nc("unit description in lists", "yoctowatts"), 00174 i18nc("unit synonyms for matching user input", "yoctowatt;yoctowatts;yW"), 00175 ki18nc("amount in units (real)", "%1 yoctowatts"), 00176 ki18ncp("amount in units (integer)", "%1 yoctowatt", "%1 yoctowatts") 00177 ); 00178 U(Horsepower, 735.499, 00179 i18nc("power unit symbol", "hp"), 00180 i18nc("unit description in lists", "horsepowers"), 00181 i18nc("unit synonyms for matching user input", "horsepower;horsepowers;hp"), 00182 ki18nc("amount in units (real)", "%1 horsepowers"), 00183 ki18ncp("amount in units (integer)", "%1 horsepower", "%1 horsepowers") 00184 ); 00185 00186 setMostCommonUnits(QList<int>() << Kilowatt << Watt << Horsepower); 00187 }
KDE 4.6 API Reference