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

KUnitConversion

  • sources
  • kde-4.14
  • kdelibs
  • kunitconversion
frequency.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 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 "frequency.h"
21 #include "converter.h"
22 #include <klocale.h>
23 
24 using namespace KUnitConversion;
25 
26 Frequency::Frequency() : UnitCategory(FrequencyCategory)
27 {
28  setName(i18n("Frequency"));
29  setSymbolStringFormat(ki18nc("%1 value, %2 unit symbol (frequency", "%1 %2"));
30 
31  U(Yottahertz, 1e+24,
32  i18nc("frequency unit symbol", "YHz"),
33  i18nc("unit description in lists", "yottahertzs"),
34  i18nc("unit synonyms for matching user input", "yottahertz;yottahertzs;YHz"),
35  ki18nc("amount in units (real)", "%1 yottahertzs"),
36  ki18ncp("amount in units (integer)", "%1 yottahertz", "%1 yottahertzs")
37  );
38  U(Zettahertz, 1e+21,
39  i18nc("frequency unit symbol", "ZHz"),
40  i18nc("unit description in lists", "zettahertzs"),
41  i18nc("unit synonyms for matching user input", "zettahertz;zettahertzs;ZHz"),
42  ki18nc("amount in units (real)", "%1 zettahertzs"),
43  ki18ncp("amount in units (integer)", "%1 zettahertz", "%1 zettahertzs")
44  );
45  U(Exahertz, 1e+18,
46  i18nc("frequency unit symbol", "EHz"),
47  i18nc("unit description in lists", "exahertzs"),
48  i18nc("unit synonyms for matching user input", "exahertz;exahertzs;EHz"),
49  ki18nc("amount in units (real)", "%1 exahertzs"),
50  ki18ncp("amount in units (integer)", "%1 exahertz", "%1 exahertzs")
51  );
52  U(Petahertz, 1e+15,
53  i18nc("frequency unit symbol", "PHz"),
54  i18nc("unit description in lists", "petahertzs"),
55  i18nc("unit synonyms for matching user input", "petahertz;petahertzs;PHz"),
56  ki18nc("amount in units (real)", "%1 petahertzs"),
57  ki18ncp("amount in units (integer)", "%1 petahertz", "%1 petahertzs")
58  );
59  U(Terahertz, 1e+12,
60  i18nc("frequency unit symbol", "THz"),
61  i18nc("unit description in lists", "terahertzs"),
62  i18nc("unit synonyms for matching user input", "terahertz;terahertzs;THz"),
63  ki18nc("amount in units (real)", "%1 terahertzs"),
64  ki18ncp("amount in units (integer)", "%1 terahertz", "%1 terahertzs")
65  );
66  U(Gigahertz, 1e+09,
67  i18nc("frequency unit symbol", "GHz"),
68  i18nc("unit description in lists", "gigahertzs"),
69  i18nc("unit synonyms for matching user input", "gigahertz;gigahertzs;GHz"),
70  ki18nc("amount in units (real)", "%1 gigahertzs"),
71  ki18ncp("amount in units (integer)", "%1 gigahertz", "%1 gigahertzs")
72  );
73  U(Megahertz, 1e+06,
74  i18nc("frequency unit symbol", "MHz"),
75  i18nc("unit description in lists", "megahertzs"),
76  i18nc("unit synonyms for matching user input", "megahertz;megahertzs;MHz"),
77  ki18nc("amount in units (real)", "%1 megahertzs"),
78  ki18ncp("amount in units (integer)", "%1 megahertz", "%1 megahertzs")
79  );
80  U(Kilohertz, 1000,
81  i18nc("frequency unit symbol", "kHz"),
82  i18nc("unit description in lists", "kilohertzs"),
83  i18nc("unit synonyms for matching user input", "kilohertz;kilohertzs;kHz"),
84  ki18nc("amount in units (real)", "%1 kilohertzs"),
85  ki18ncp("amount in units (integer)", "%1 kilohertz", "%1 kilohertzs")
86  );
87  U(Hectohertz, 100,
88  i18nc("frequency unit symbol", "hHz"),
89  i18nc("unit description in lists", "hectohertzs"),
90  i18nc("unit synonyms for matching user input", "hectohertz;hectohertzs;hHz"),
91  ki18nc("amount in units (real)", "%1 hectohertzs"),
92  ki18ncp("amount in units (integer)", "%1 hectohertz", "%1 hectohertzs")
93  );
94  U(Decahertz, 10,
95  i18nc("frequency unit symbol", "daHz"),
96  i18nc("unit description in lists", "decahertzs"),
97  i18nc("unit synonyms for matching user input", "decahertz;decahertzs;daHz"),
98  ki18nc("amount in units (real)", "%1 decahertzs"),
99  ki18ncp("amount in units (integer)", "%1 decahertz", "%1 decahertzs")
100  );
101  setDefaultUnit(UP(Hertz, 1,
102  i18nc("frequency unit symbol", "Hz"),
103  i18nc("unit description in lists", "hertzs"),
104  i18nc("unit synonyms for matching user input", "hertz;hertzs;Hz"),
105  ki18nc("amount in units (real)", "%1 hertzs"),
106  ki18ncp("amount in units (integer)", "%1 hertz", "%1 hertzs")
107  ));
108  U(Decihertz, 0.1,
109  i18nc("frequency unit symbol", "dHz"),
110  i18nc("unit description in lists", "decihertzs"),
111  i18nc("unit synonyms for matching user input", "decihertz;decihertzs;dHz"),
112  ki18nc("amount in units (real)", "%1 decihertzs"),
113  ki18ncp("amount in units (integer)", "%1 decihertz", "%1 decihertzs")
114  );
115  U(Centihertz, 0.01,
116  i18nc("frequency unit symbol", "cHz"),
117  i18nc("unit description in lists", "centihertzs"),
118  i18nc("unit synonyms for matching user input", "centihertz;centihertzs;cHz"),
119  ki18nc("amount in units (real)", "%1 centihertzs"),
120  ki18ncp("amount in units (integer)", "%1 centihertz", "%1 centihertzs")
121  );
122  U(Millihertz, 0.001,
123  i18nc("frequency unit symbol", "mHz"),
124  i18nc("unit description in lists", "millihertzs"),
125  i18nc("unit synonyms for matching user input", "millihertz;millihertzs;mHz"),
126  ki18nc("amount in units (real)", "%1 millihertzs"),
127  ki18ncp("amount in units (integer)", "%1 millihertz", "%1 millihertzs")
128  );
129  U(Microhertz, 1e-06,
130  i18nc("frequency unit symbol", "µHz"),
131  i18nc("unit description in lists", "microhertzs"),
132  i18nc("unit synonyms for matching user input", "microhertz;microhertzs;µHz;uHz"),
133  ki18nc("amount in units (real)", "%1 microhertzs"),
134  ki18ncp("amount in units (integer)", "%1 microhertz", "%1 microhertzs")
135  );
136  U(Nanohertz, 1e-09,
137  i18nc("frequency unit symbol", "nHz"),
138  i18nc("unit description in lists", "nanohertzs"),
139  i18nc("unit synonyms for matching user input", "nanohertz;nanohertzs;nHz"),
140  ki18nc("amount in units (real)", "%1 nanohertzs"),
141  ki18ncp("amount in units (integer)", "%1 nanohertz", "%1 nanohertzs")
142  );
143  U(Picohertz, 1e-12,
144  i18nc("frequency unit symbol", "pHz"),
145  i18nc("unit description in lists", "picohertzs"),
146  i18nc("unit synonyms for matching user input", "picohertz;picohertzs;pHz"),
147  ki18nc("amount in units (real)", "%1 picohertzs"),
148  ki18ncp("amount in units (integer)", "%1 picohertz", "%1 picohertzs")
149  );
150  U(Femtohertz, 1e-15,
151  i18nc("frequency unit symbol", "fHz"),
152  i18nc("unit description in lists", "femtohertzs"),
153  i18nc("unit synonyms for matching user input", "femtohertz;femtohertzs;fHz"),
154  ki18nc("amount in units (real)", "%1 femtohertzs"),
155  ki18ncp("amount in units (integer)", "%1 femtohertz", "%1 femtohertzs")
156  );
157  U(Attohertz, 1e-18,
158  i18nc("frequency unit symbol", "aHz"),
159  i18nc("unit description in lists", "attohertzs"),
160  i18nc("unit synonyms for matching user input", "attohertz;attohertzs;aHz"),
161  ki18nc("amount in units (real)", "%1 attohertzs"),
162  ki18ncp("amount in units (integer)", "%1 attohertz", "%1 attohertzs")
163  );
164  U(Zeptohertz, 1e-21,
165  i18nc("frequency unit symbol", "zHz"),
166  i18nc("unit description in lists", "zeptohertzs"),
167  i18nc("unit synonyms for matching user input", "zeptohertz;zeptohertzs;zHz"),
168  ki18nc("amount in units (real)", "%1 zeptohertzs"),
169  ki18ncp("amount in units (integer)", "%1 zeptohertz", "%1 zeptohertzs")
170  );
171  U(Yoctohertz, 1e-24,
172  i18nc("frequency unit symbol", "yHz"),
173  i18nc("unit description in lists", "yoctohertzs"),
174  i18nc("unit synonyms for matching user input", "yoctohertz;yoctohertzs;yHz"),
175  ki18nc("amount in units (real)", "%1 yoctohertzs"),
176  ki18ncp("amount in units (integer)", "%1 yoctohertz", "%1 yoctohertzs")
177  );
178  U(RPM, 1.0 / 60.0,
179  i18nc("frequency unit symbol", "RPM"),
180  i18nc("unit description in lists", "revolutions per minute"),
181  i18nc("unit synonyms for matching user input",
182  "revolutions per minute;revolution per minute;RPM"),
183  ki18nc("amount in units (real)", "%1 revolutions per minute"),
184  ki18ncp("amount in units (integer)", "%1 revolution per minute", "%1 revolutions per minute")
185  );
186 
187  setMostCommonUnits(QList<int>() <<
188  Kilohertz << Megahertz << Gigahertz << Hertz << RPM);
189 }
190 
KUnitConversion::UnitCategory::setMostCommonUnits
void setMostCommonUnits(const QList< int > &units)
Definition: unitcategory.cpp:80
KUnitConversion::Hectohertz
Definition: converter.h:131
KUnitConversion::Nanohertz
Definition: converter.h:132
Frequency::Frequency
Frequency()
Definition: frequency.cpp:26
KUnitConversion::RPM
Definition: converter.h:132
KUnitConversion::UnitCategory::setName
void setName(const QString &name)
Definition: unitcategory.cpp:156
frequency.h
KUnitConversion::Femtohertz
Definition: converter.h:132
KUnitConversion::Decihertz
Definition: converter.h:131
KUnitConversion::Microhertz
Definition: converter.h:131
KUnitConversion::Kilohertz
Definition: converter.h:131
KUnitConversion::Decahertz
Definition: converter.h:131
KUnitConversion::Megahertz
Definition: converter.h:130
KUnitConversion::Zeptohertz
Definition: converter.h:132
KUnitConversion::Yottahertz
Definition: converter.h:130
KUnitConversion::Exahertz
Definition: converter.h:130
KUnitConversion::Petahertz
Definition: converter.h:130
UP
#define UP(id, m, s, d, sy, r, i)
Definition: unit.h:127
KUnitConversion::Millihertz
Definition: converter.h:131
KUnitConversion::Gigahertz
Definition: converter.h:130
KUnitConversion::Yoctohertz
Definition: converter.h:132
KUnitConversion::Hertz
Definition: converter.h:131
converter.h
KUnitConversion::Zettahertz
Definition: converter.h:130
KUnitConversion::Picohertz
Definition: converter.h:132
QList
KUnitConversion::UnitCategory::setDefaultUnit
void setDefaultUnit(UnitPtr defaultUnit)
Definition: unitcategory.cpp:161
KUnitConversion::UnitCategory
Definition: unitcategory.h:33
KUnitConversion::Attohertz
Definition: converter.h:132
KUnitConversion::FrequencyCategory
Definition: converter.h:33
KUnitConversion::UnitCategory::setSymbolStringFormat
void setSymbolStringFormat(const KLocalizedString &symbolStringFormat)
Definition: unitcategory.cpp:60
KUnitConversion::Centihertz
Definition: converter.h:131
U
#define U(id, m, s, d, sy, r, i)
Definition: unit.h:129
KUnitConversion::Terahertz
Definition: converter.h:130
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KUnitConversion

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal