aboutsummaryrefslogtreecommitdiff
path: root/libcontextsubscriber/doc/html/duration_8h_source.html
blob: 18878684f615dc43f30c1a6da4a9b50b1c9bdec1 (plain)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libcontextsubscriber: duration.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>duration.h</h1><a href="duration_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2008,2009 Nokia Corporation.</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Contact: Marius Vollmer &lt;marius.vollmer@nokia.com&gt;</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
<a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the GNU Lesser General Public License</span>
<a name="l00008"></a>00008 <span class="comment"> * version 2.1 as published by the Free Software Foundation.</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * This library is distributed in the hope that it will be useful, but</span>
<a name="l00011"></a>00011 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
<a name="l00013"></a>00013 <span class="comment"> * Lesser General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"> *</span>
<a name="l00015"></a>00015 <span class="comment"> * You should have received a copy of the GNU Lesser General Public</span>
<a name="l00016"></a>00016 <span class="comment"> * License along with this library; if not, write to the Free Software</span>
<a name="l00017"></a>00017 <span class="comment"> * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span>
<a name="l00018"></a>00018 <span class="comment"> * 02110-1301 USA</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> */</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef DURATION_H</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define DURATION_H</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;QString&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;QtCore/QMetaType&gt;</span>
<a name="l00027"></a>00027 
<a name="l00028"></a><a class="code" href="class_duration.html">00028</a> <span class="keyword">class </span><a class="code" href="class_duration.html" title="The Duration class represents a period of elapsed time between two events.">Duration</a>
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="keyword">public</span>:
<a name="l00032"></a>00032     <a class="code" href="class_duration.html#a688948a87d69e8982cf7e292c7fe4b0a" title="Constructs a Duration with an initial value of 0.">Duration</a>();
<a name="l00033"></a>00033     <a class="code" href="class_duration.html#a688948a87d69e8982cf7e292c7fe4b0a" title="Constructs a Duration with an initial value of 0.">Duration</a>(quint64 <a class="code" href="class_duration.html#a23068f3487c60176d11e61e4d15f318b" title="Returns the number of nanoseconds in the duration.">nanoSecs</a>);
<a name="l00034"></a>00034     <a class="code" href="class_duration.html#a688948a87d69e8982cf7e292c7fe4b0a" title="Constructs a Duration with an initial value of 0.">Duration</a>(<span class="keyword">const</span> QString &amp;duration);
<a name="l00035"></a>00035 
<a name="l00036"></a>00036     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a23068f3487c60176d11e61e4d15f318b" title="Returns the number of nanoseconds in the duration.">nanoSecs</a>() <span class="keyword">const</span>;
<a name="l00037"></a>00037     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#af4b4eb8817b6afcf1f0fa4a10b4ba270" title="Returns the number of seconds in the duration.">seconds</a>() <span class="keyword">const</span>;
<a name="l00038"></a>00038     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a357d45c156e514ef576e31098ed6265c" title="Returns the number of minutes in the duration.">minutes</a>() <span class="keyword">const</span>;
<a name="l00039"></a>00039     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a35730cb8c441ce177902f20dcb09e2c7" title="Returns the number of hours in the duration.">hours</a>() <span class="keyword">const</span>;
<a name="l00040"></a>00040     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a48c13c7c308da37173c0219584ef5622" title="Returns the number of days in the duration.">days</a>() <span class="keyword">const</span>;
<a name="l00041"></a>00041     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a0e505e12e139d4a65ab3a5fafcc904a9" title="Returns the number of weeks in the duration.">weeks</a>() <span class="keyword">const</span>;
<a name="l00042"></a>00042     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a8df87676e16d72fa40db920bd455aeb6" title="Returns the number of years in the duration.">years</a>() <span class="keyword">const</span>;
<a name="l00043"></a>00043     QString <a class="code" href="class_duration.html#aab2ffe2cd04b22eeb62442a666d90c77" title="Returns a string representation of the duration using the following format: Y W D...">toString</a>() <span class="keyword">const</span>;
<a name="l00044"></a>00044     quint64 <a class="code" href="class_duration.html#a8e1ffa5c04f46acba56cb44282a9ea25" title="Returns the Duration expressed in nanoseconds.">toNanoSeconds</a>() <span class="keyword">const</span>;
<a name="l00045"></a>00045     <span class="keywordtype">bool</span> <a class="code" href="class_duration.html#a195c274bc9635ec1a5ce31b6c6a40523" title="Returns true if this Duration is equal to the other Duration.">operator==</a>(<span class="keyword">const</span> <a class="code" href="class_duration.html" title="The Duration class represents a period of elapsed time between two events.">Duration</a> &amp;other) <span class="keyword">const</span>;
<a name="l00046"></a>00046 
<a name="l00047"></a>00047     <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="class_duration.html#afd264a1a96af9a1feacf5d4c75e89aee" title="Returns true if the string format used to represent the Duration is valid i.e. Y...">isDuration</a>(<span class="keyword">const</span> QString &amp;duration);
<a name="l00048"></a><a class="code" href="class_duration.html#a3c33d820ff418009481a2ad01910d905">00048</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#a3c33d820ff418009481a2ad01910d905" title="Convenient time conversions.">NANOSECS_PER_MSEC</a> = Q_INT64_C(1000000);
<a name="l00049"></a><a class="code" href="class_duration.html#ae10e56c108a86fe4f02ac6906e4f8ee2">00049</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#ae10e56c108a86fe4f02ac6906e4f8ee2">NANOSECS_PER_SEC</a> = 1000*<a class="code" href="class_duration.html#a3c33d820ff418009481a2ad01910d905" title="Convenient time conversions.">NANOSECS_PER_MSEC</a>;
<a name="l00050"></a><a class="code" href="class_duration.html#accbae8614661c399db58db8ccc1934d5">00050</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#accbae8614661c399db58db8ccc1934d5">NANOSECS_PER_MIN</a> = 60*<a class="code" href="class_duration.html#ae10e56c108a86fe4f02ac6906e4f8ee2">NANOSECS_PER_SEC</a>;
<a name="l00051"></a><a class="code" href="class_duration.html#af9fe9fc7c65087ac96b7cfd8c6c445e2">00051</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#af9fe9fc7c65087ac96b7cfd8c6c445e2">NANOSECS_PER_HOUR</a> = 60*<a class="code" href="class_duration.html#accbae8614661c399db58db8ccc1934d5">NANOSECS_PER_MIN</a>;
<a name="l00052"></a><a class="code" href="class_duration.html#a9c6208ed7f3bb8a6e39a02076a44e8c7">00052</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#a9c6208ed7f3bb8a6e39a02076a44e8c7">NANOSECS_PER_DAY</a> = 24*<a class="code" href="class_duration.html#af9fe9fc7c65087ac96b7cfd8c6c445e2">NANOSECS_PER_HOUR</a>;
<a name="l00053"></a><a class="code" href="class_duration.html#a348e30edf37b03700e3f85dd285dad56">00053</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#a348e30edf37b03700e3f85dd285dad56">NANOSECS_PER_WEEK</a> = 7*<a class="code" href="class_duration.html#a9c6208ed7f3bb8a6e39a02076a44e8c7">NANOSECS_PER_DAY</a>;
<a name="l00054"></a><a class="code" href="class_duration.html#ae5b4050b9acbc77ed87c76e3566c87f9">00054</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#ae5b4050b9acbc77ed87c76e3566c87f9">SECS_PER_DAY</a> = Q_INT64_C(86400);
<a name="l00055"></a><a class="code" href="class_duration.html#a642b774520634b947320302c50c07492">00055</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#a642b774520634b947320302c50c07492">MSECS_PER_DAY</a> = 1000*<a class="code" href="class_duration.html#ae5b4050b9acbc77ed87c76e3566c87f9">SECS_PER_DAY</a>;
<a name="l00056"></a><a class="code" href="class_duration.html#ae00e48d850dfb255bb24a76b0cde4d94">00056</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#ae00e48d850dfb255bb24a76b0cde4d94">DAYS_PER_YEAR</a> = 365;
<a name="l00057"></a><a class="code" href="class_duration.html#a0caaa666d3802bef2458dac99010c2d3">00057</a>     <span class="keyword">static</span> <span class="keyword">const</span> qint64 <a class="code" href="class_duration.html#a0caaa666d3802bef2458dac99010c2d3">DAYS_PER_WEEK</a> = 7;
<a name="l00058"></a>00058 
<a name="l00059"></a>00059 <span class="keyword">private</span>:
<a name="l00060"></a><a class="code" href="class_duration.html#a7b2bed98e3f146e624fb94c0b00e1b9f">00060</a>     quint64 <a class="code" href="class_duration.html#a7b2bed98e3f146e624fb94c0b00e1b9f">totalNanoSecs_p</a>;
<a name="l00061"></a><a class="code" href="class_duration.html#a47d92d1ce87dbc18b2295c9606fc6b2e">00061</a>     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a47d92d1ce87dbc18b2295c9606fc6b2e" title="the duration expressed in nanoseconds">nanoSecs_p</a>;
<a name="l00062"></a><a class="code" href="class_duration.html#a07066203528348d96b639c9308ae1778">00062</a>     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a07066203528348d96b639c9308ae1778" title="the number of nanoseconds in the duration">seconds_p</a>;
<a name="l00063"></a><a class="code" href="class_duration.html#a6bee3ecfa3c407b57ed03c9aac48f872">00063</a>     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a6bee3ecfa3c407b57ed03c9aac48f872" title="the number of seconds in the duration">minutes_p</a>;
<a name="l00064"></a><a class="code" href="class_duration.html#a6e38ff9f6c07148287cc812635265c45">00064</a>     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a6e38ff9f6c07148287cc812635265c45" title="the number of minutes in the duration">hours_p</a>;
<a name="l00065"></a><a class="code" href="class_duration.html#a7a588f2604d45b34714a612af6c0160c">00065</a>     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a7a588f2604d45b34714a612af6c0160c" title="the number of hours in the duration">days_p</a>;
<a name="l00066"></a><a class="code" href="class_duration.html#abe39c4da2490d5014c09622e6a6581cd">00066</a>     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#abe39c4da2490d5014c09622e6a6581cd" title="the number of days in the duration">weeks_p</a>;
<a name="l00067"></a><a class="code" href="class_duration.html#a47a4ba03cc7338ea5002c5e1ec093318">00067</a>     <span class="keywordtype">int</span> <a class="code" href="class_duration.html#a47a4ba03cc7338ea5002c5e1ec093318" title="the number of weeks in the duration">years_p</a>;
<a name="l00068"></a>00068 
<a name="l00069"></a>00069 };
<a name="l00070"></a>00070 Q_DECLARE_METATYPE(<a class="code" href="class_duration.html" title="The Duration class represents a period of elapsed time between two events.">Duration</a>)
<a name="l00071"></a>00071 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Thu Dec 10 16:51:58 2009 for libcontextsubscriber by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>