1/*
2 * Copyright (C) 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#include "pressure.h"
21#include "converter.h"
22#include <klocale.h>
23
24using namespace KUnitConversion;
25
26Pressure::Pressure() : UnitCategory(PressureCategory)
27{
28 setName(i18n("Pressure"));
29 setSymbolStringFormat(ki18nc("%1 value, %2 unit symbol (pressure)", "%1 %2"));
30
31 U(Yottapascal, 1e+24,
32 i18nc("pressure unit symbol", "YPa"),
33 i18nc("unit description in lists", "yottapascals"),
34 i18nc("unit synonyms for matching user input", "yottapascal;yottapascals;YPa"),
35 ki18nc("amount in units (real)", "%1 yottapascals"),
36 ki18ncp("amount in units (integer)", "%1 yottapascal", "%1 yottapascals")
37 );
38 U(Zettapascal, 1e+21,
39 i18nc("pressure unit symbol", "ZPa"),
40 i18nc("unit description in lists", "zettapascals"),
41 i18nc("unit synonyms for matching user input", "zettapascal;zettapascals;ZPa"),
42 ki18nc("amount in units (real)", "%1 zettapascals"),
43 ki18ncp("amount in units (integer)", "%1 zettapascal", "%1 zettapascals")
44 );
45 U(Exapascal, 1e+18,
46 i18nc("pressure unit symbol", "EPa"),
47 i18nc("unit description in lists", "exapascals"),
48 i18nc("unit synonyms for matching user input", "exapascal;exapascals;EPa"),
49 ki18nc("amount in units (real)", "%1 exapascals"),
50 ki18ncp("amount in units (integer)", "%1 exapascal", "%1 exapascals")
51 );
52 U(Petapascal, 1e+15,
53 i18nc("pressure unit symbol", "PPa"),
54 i18nc("unit description in lists", "petapascals"),
55 i18nc("unit synonyms for matching user input", "petapascal;petapascals;PPa"),
56 ki18nc("amount in units (real)", "%1 petapascals"),
57 ki18ncp("amount in units (integer)", "%1 petapascal", "%1 petapascals")
58 );
59 U(Terapascal, 1e+12,
60 i18nc("pressure unit symbol", "TPa"),
61 i18nc("unit description in lists", "terapascals"),
62 i18nc("unit synonyms for matching user input", "terapascal;terapascals;TPa"),
63 ki18nc("amount in units (real)", "%1 terapascals"),
64 ki18ncp("amount in units (integer)", "%1 terapascal", "%1 terapascals")
65 );
66 U(Gigapascal, 1e+09,
67 i18nc("pressure unit symbol", "GPa"),
68 i18nc("unit description in lists", "gigapascals"),
69 i18nc("unit synonyms for matching user input", "gigapascal;gigapascals;GPa"),
70 ki18nc("amount in units (real)", "%1 gigapascals"),
71 ki18ncp("amount in units (integer)", "%1 gigapascal", "%1 gigapascals")
72 );
73 U(Megapascal, 1e+06,
74 i18nc("pressure unit symbol", "MPa"),
75 i18nc("unit description in lists", "megapascals"),
76 i18nc("unit synonyms for matching user input", "megapascal;megapascals;MPa"),
77 ki18nc("amount in units (real)", "%1 megapascals"),
78 ki18ncp("amount in units (integer)", "%1 megapascal", "%1 megapascals")
79 );
80 U(Kilopascal, 1000,
81 i18nc("pressure unit symbol", "kPa"),
82 i18nc("unit description in lists", "kilopascals"),
83 i18nc("unit synonyms for matching user input", "kilopascal;kilopascals;kPa"),
84 ki18nc("amount in units (real)", "%1 kilopascals"),
85 ki18ncp("amount in units (integer)", "%1 kilopascal", "%1 kilopascals")
86 );
87 U(Hectopascal, 100,
88 i18nc("pressure unit symbol", "hPa"),
89 i18nc("unit description in lists", "hectopascals"),
90 i18nc("unit synonyms for matching user input", "hectopascal;hectopascals;hPa"),
91 ki18nc("amount in units (real)", "%1 hectopascals"),
92 ki18ncp("amount in units (integer)", "%1 hectopascal", "%1 hectopascals")
93 );
94 U(Decapascal, 10,
95 i18nc("pressure unit symbol", "daPa"),
96 i18nc("unit description in lists", "decapascals"),
97 i18nc("unit synonyms for matching user input", "decapascal;decapascals;daPa"),
98 ki18nc("amount in units (real)", "%1 decapascals"),
99 ki18ncp("amount in units (integer)", "%1 decapascal", "%1 decapascals")
100 );
101 setDefaultUnit(UP(Pascal, 1,
102 i18nc("pressure unit symbol", "Pa"),
103 i18nc("unit description in lists", "pascals"),
104 i18nc("unit synonyms for matching user input", "pascal;pascals;Pa"),
105 ki18nc("amount in units (real)", "%1 pascals"),
106 ki18ncp("amount in units (integer)", "%1 pascal", "%1 pascals")
107 ));
108 U(Decipascal, 0.1,
109 i18nc("pressure unit symbol", "dPa"),
110 i18nc("unit description in lists", "decipascals"),
111 i18nc("unit synonyms for matching user input", "decipascal;decipascals;dPa"),
112 ki18nc("amount in units (real)", "%1 decipascals"),
113 ki18ncp("amount in units (integer)", "%1 decipascal", "%1 decipascals")
114 );
115 U(Centipascal, 0.01,
116 i18nc("pressure unit symbol", "cPa"),
117 i18nc("unit description in lists", "centipascals"),
118 i18nc("unit synonyms for matching user input", "centipascal;centipascals;cPa"),
119 ki18nc("amount in units (real)", "%1 centipascals"),
120 ki18ncp("amount in units (integer)", "%1 centipascal", "%1 centipascals")
121 );
122 U(Millipascal, 0.001,
123 i18nc("pressure unit symbol", "mPa"),
124 i18nc("unit description in lists", "millipascals"),
125 i18nc("unit synonyms for matching user input", "millipascal;millipascals;mPa"),
126 ki18nc("amount in units (real)", "%1 millipascals"),
127 ki18ncp("amount in units (integer)", "%1 millipascal", "%1 millipascals")
128 );
129 U(Micropascal, 1e-06,
130 i18nc("pressure unit symbol", "µPa"),
131 i18nc("unit description in lists", "micropascals"),
132 i18nc("unit synonyms for matching user input", "micropascal;micropascals;µPa;uPa"),
133 ki18nc("amount in units (real)", "%1 micropascals"),
134 ki18ncp("amount in units (integer)", "%1 micropascal", "%1 micropascals")
135 );
136 U(Nanopascal, 1e-09,
137 i18nc("pressure unit symbol", "nPa"),
138 i18nc("unit description in lists", "nanopascals"),
139 i18nc("unit synonyms for matching user input", "nanopascal;nanopascals;nPa"),
140 ki18nc("amount in units (real)", "%1 nanopascals"),
141 ki18ncp("amount in units (integer)", "%1 nanopascal", "%1 nanopascals")
142 );
143 U(Picopascal, 1e-12,
144 i18nc("pressure unit symbol", "pPa"),
145 i18nc("unit description in lists", "picopascals"),
146 i18nc("unit synonyms for matching user input", "picopascal;picopascals;pPa"),
147 ki18nc("amount in units (real)", "%1 picopascals"),
148 ki18ncp("amount in units (integer)", "%1 picopascal", "%1 picopascals")
149 );
150 U(Femtopascal, 1e-15,
151 i18nc("pressure unit symbol", "fPa"),
152 i18nc("unit description in lists", "femtopascals"),
153 i18nc("unit synonyms for matching user input", "femtopascal;femtopascals;fPa"),
154 ki18nc("amount in units (real)", "%1 femtopascals"),
155 ki18ncp("amount in units (integer)", "%1 femtopascal", "%1 femtopascals")
156 );
157 U(Attopascal, 1e-18,
158 i18nc("pressure unit symbol", "aPa"),
159 i18nc("unit description in lists", "attopascals"),
160 i18nc("unit synonyms for matching user input", "attopascal;attopascals;aPa"),
161 ki18nc("amount in units (real)", "%1 attopascals"),
162 ki18ncp("amount in units (integer)", "%1 attopascal", "%1 attopascals")
163 );
164 U(Zeptopascal, 1e-21,
165 i18nc("pressure unit symbol", "zPa"),
166 i18nc("unit description in lists", "zeptopascals"),
167 i18nc("unit synonyms for matching user input", "zeptopascal;zeptopascals;zPa"),
168 ki18nc("amount in units (real)", "%1 zeptopascals"),
169 ki18ncp("amount in units (integer)", "%1 zeptopascal", "%1 zeptopascals")
170 );
171 U(Yoctopascal, 1e-24,
172 i18nc("pressure unit symbol", "yPa"),
173 i18nc("unit description in lists", "yoctopascals"),
174 i18nc("unit synonyms for matching user input", "yoctopascal;yoctopascals;yPa"),
175 ki18nc("amount in units (real)", "%1 yoctopascals"),
176 ki18ncp("amount in units (integer)", "%1 yoctopascal", "%1 yoctopascals")
177 );
178 U(Bar, 100000,
179 i18nc("pressure unit symbol", "bar"),
180 i18nc("unit description in lists", "bars"),
181 i18nc("unit synonyms for matching user input", "bar;bars;bar"),
182 ki18nc("amount in units (real)", "%1 bars"),
183 ki18ncp("amount in units (integer)", "%1 bar", "%1 bars")
184 );
185 U(Millibar, 100,
186 i18nc("pressure unit symbol", "mbar"),
187 i18nc("unit description in lists", "millibars"),
188 i18nc("unit synonyms for matching user input", "millibar;millibars;mbar;mb"),
189 ki18nc("amount in units (real)", "%1 millibars"),
190 ki18ncp("amount in units (integer)", "%1 millibar", "%1 millibars")
191 );
192 U(Decibar, 10000,
193 i18nc("pressure unit symbol", "dbar"),
194 i18nc("unit description in lists", "decibars"),
195 i18nc("unit synonyms for matching user input", "decibar;decibars;dbar"),
196 ki18nc("amount in units (real)", "%1 decibars"),
197 ki18ncp("amount in units (integer)", "%1 decibar", "%1 decibars")
198 );
199 U(Torr, 133.322,
200 i18nc("pressure unit symbol", "Torr"),
201 i18nc("unit description in lists", "Torr"),
202 i18nc("unit synonyms for matching user input", "Torr"),
203 ki18nc("amount in units (real)", "%1 torr"),
204 ki18ncp("amount in units (integer)", "%1 torr", "%1 torr")
205 );
206 U(TechnicalAtmosphere, 98066.5,
207 i18nc("pressure unit symbol", "at"),
208 i18nc("unit description in lists", "technical atmospheres"),
209 i18nc("unit synonyms for matching user input",
210 "technical atmosphere;technical atmospheres;at"),
211 ki18nc("amount in units (real)", "%1 technical atmospheres"),
212 ki18ncp("amount in units (integer)", "%1 technical atmosphere", "%1 technical atmospheres")
213 );
214 U(Atmosphere, 101325,
215 i18nc("pressure unit symbol", "atm"),
216 i18nc("unit description in lists", "atmospheres"),
217 i18nc("unit synonyms for matching user input", "atmosphere;atmospheres;atm"),
218 ki18nc("amount in units (real)", "%1 atmospheres"),
219 ki18ncp("amount in units (integer)", "%1 atmosphere", "%1 atmospheres")
220 );
221 U(PoundForcePerSquareInch, 6894.76,
222 i18nc("pressure unit symbol", "psi"),
223 i18nc("unit description in lists", "pound-force per square inch"),
224 i18nc("unit synonyms for matching user input",
225 "pound-force per square inch;pound-force per square inches;psi"),
226 ki18nc("amount in units (real)", "%1 pound-force per square inches"),
227 ki18ncp("amount in units (integer)",
228 "%1 pound-force per square inch", "%1 pound-force per square inch")
229 );
230 // http://en.wikipedia.org/wiki/InHg
231 U(InchesOfMercury, 3386.39,
232 i18nc("pressure unit symbol", "inHg"),
233 i18nc("unit description in lists", "inches of mercury"),
234 i18nc("unit synonyms for matching user input",
235 "inch of mercury;inches of mercury;inHg;in\""),
236 ki18nc("amount in units (real)", "%1 inches of mercury"),
237 ki18ncp("amount in units (integer)", "%1 inches of mercury", "%1 inches of mercury")
238 );
239 // http://en.wikipedia.org/wiki/MmHg#mmHg
240 U(MillimetersOfMercury, 133.322,
241 i18nc("pressure unit symbol", "mmHg"),
242 i18nc("unit description in lists", "millimeters of mercury"),
243 i18nc("unit synonyms for matching user input",
244 "millimeter of mercury;millimeters of mercury;mmHg"),
245 ki18nc("amount in units (real)", "%1 millimeters of mercury"),
246 ki18ncp("amount in units (integer)", "%1 millimeters of mercury", "%1 millimeters of mercury")
247 );
248
249 setMostCommonUnits(QList<int>() <<
250 Hectopascal << Pascal << Bar << Atmosphere << InchesOfMercury);
251}
252