]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/timespan.tex
remove C++ comment
[wxWidgets.git] / docs / latex / wx / timespan.tex
... / ...
CommitLineData
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: datespan.tex
3%% Purpose: wxDateSpan documentation
4%% Author: Vadim Zeitlin
5%% Modified by:
6%% Created: 04.04.00
7%% RCS-ID: $Id$
8%% Copyright: (c) Vadim Zeitlin
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxTimeSpan}}\label{wxtimespan}
13
14wxTimeSpan class represents a time interval.
15
16\wxheading{Derived from}
17
18No base class
19
20\wxheading{Include files}
21
22<wx/datetime.h>
23
24\wxheading{Library}
25
26\helpref{wxBase}{librarieslist}
27
28\wxheading{See also}
29
30\helpref{Date classes overview}{wxdatetimeoverview},\rtfsp
31\helpref{wxDateTime}{wxdatetime}
32
33\latexignore{\rtfignore{\wxheading{Function groups}}}
34
35
36\membersection{Static functions}\label{timespanstaticfunctions}
37
38\helpref{Milliseconds}{wxtimespanmilliseconds}\\
39\helpref{Millisecond}{wxtimespanmillisecond}\\
40\helpref{Seconds}{wxtimespanseconds}\\
41\helpref{Second}{wxtimespansecond}\\
42\helpref{Minutes}{wxtimespanminutes}\\
43\helpref{Minute}{wxtimespanminute}\\
44\helpref{Hours}{wxtimespanhours}\\
45\helpref{Hour}{wxtimespanhour}\\
46\helpref{Days}{wxtimespandays}\\
47\helpref{Day}{wxtimespanday}\\
48\helpref{Weeks}{wxtimespanweeks}\\
49\helpref{Week}{wxtimespanweek}
50
51
52\membersection{Constructors}\label{timespanconstructors}
53
54\helpref{wxTimeSpan}{wxtimespanctor}
55
56
57\membersection{Accessors}\label{timespanaccessors}
58
59\helpref{GetSeconds}{wxtimespangetseconds}\\
60\helpref{GetMinutes}{wxtimespangetminutes}\\
61\helpref{GetHours}{wxtimespangethours}\\
62\helpref{GetDays}{wxtimespangetdays}\\
63\helpref{GetWeeks}{wxtimespangetweeks}\\
64\helpref{GetValue}{wxtimespangetvalue}
65
66
67\membersection{Operations}\label{timespanoperations}
68
69\helpref{Add}{wxtimespanadd}\\
70\helpref{Subtract}{wxtimespansubtract}\\
71\helpref{Multiply}{wxtimespanmultiply}\\
72\helpref{Negate}{wxtimespannegate}\\
73\helpref{Neg}{wxtimespanneg}\\
74\helpref{Abs}{wxtimespanabs}
75
76
77\membersection{Tests}\label{timespantests}
78
79\helpref{IsNull}{wxtimespanisnull}\\
80\helpref{IsPositive}{wxtimespanispositive}\\
81\helpref{IsNegative}{wxtimespanisnegative}\\
82\helpref{IsEqualTo}{wxtimespanisequalto}\\
83\helpref{IsLongerThan}{wxtimespanislongerthan}\\
84\helpref{IsShorterThan}{wxtimespanisshorterthan}
85
86
87\membersection{Formatting time spans}\label{timespanformatting}
88
89\helpref{Format}{wxtimespanformat}
90
91%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92% Start of member function part %
93%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94
95\helponly{\insertatlevel{2}{
96 \wxheading{Members}
97}}
98
99
100\membersection{wxTimeSpan::Abs}\label{wxtimespanabs}
101
102\constfunc{wxTimeSpan}{Abs}{\void}
103
104Returns the absolute value of the timespan: does not modify the
105object.
106
107
108\membersection{wxTimeSpan::Add}\label{wxtimespanadd}
109
110\constfunc{wxTimeSpan}{Add}{\param{const wxTimeSpan\& }{diff}}
111
112\func{wxTimeSpan\&}{Add}{\param{const wxTimeSpan\& }{diff}}
113
114\func{wxTimeSpan\&}{operator$+=$}{\param{const wxTimeSpan\&}{diff}}
115
116Returns the sum of two timespans.
117
118
119\membersection{wxTimeSpan::Days}\label{wxtimespandays}
120
121\func{static wxTimespan}{Days}{\param{long }{days}}
122
123Returns the timespan for the given number of days.
124
125
126\membersection{wxTimeSpan::Day}\label{wxtimespanday}
127
128\func{static wxTimespan}{Day}{\void}
129
130Returns the timespan for one day.
131
132
133\membersection{wxTimeSpan::Format}\label{wxtimespanformat}
134
135\func{wxString}{Format}{\param{const wxChar * }{format = wxDefaultTimeSpanFormat}}
136
137Returns the string containing the formatted representation of the time span.
138The following format specifiers are allowed after \%:
139
140\twocolwidtha{5cm}%
141\begin{twocollist}\itemsep=0pt
142\twocolitem{H}{number of {\bf H}ours}
143\twocolitem{M}{number of {\bf M}inutes}
144\twocolitem{S}{number of {\bf S}econds}
145\twocolitem{l}{number of mi{\bf l}liseconds}
146\twocolitem{D}{number of {\bf D}ays}
147\twocolitem{E}{number of w{\bf E}eks}
148\twocolitem{\%}{the percent character}
149\end{twocollist}
150
151Note that, for example, the number of hours in the description above is not
152well defined: it can be either the total number of hours (for example, for a
153time span of $50$ hours this would be $50$) or just the hour part of the time
154span, which would be $2$ in this case as $50$ hours is equal to $2$ days and
155$2$ hours.
156
157wxTimeSpan resolves this ambiguity in the following way: if there had been,
158indeed, the {\tt \%D} format specified preceding the {\tt \%H}, then it is
159interpreted as $2$. Otherwise, it is $50$.
160
161The same applies to all other format specifiers: if they follow a specifier of
162larger unit, only the rest part is taken, otherwise the full value is used.
163
164
165\membersection{wxTimeSpan::GetDays}\label{wxtimespangetdays}
166
167\constfunc{int}{GetDays}{\void}
168
169Returns the difference in number of days.
170
171
172\membersection{wxTimeSpan::GetHours}\label{wxtimespangethours}
173
174\constfunc{int}{GetHours}{\void}
175
176Returns the difference in number of hours.
177
178
179\membersection{wxTimeSpan::GetMilliseconds}\label{wxtimespangetmilliseconds}
180
181\constfunc{wxLongLong}{GetMilliseconds}{\void}
182
183Returns the difference in number of milliseconds.
184
185
186\membersection{wxTimeSpan::GetMinutes}\label{wxtimespangetminutes}
187
188\constfunc{int}{GetMinutes}{\void}
189
190Returns the difference in number of minutes.
191
192
193\membersection{wxTimeSpan::GetSeconds}\label{wxtimespangetseconds}
194
195\constfunc{wxLongLong}{GetSeconds}{\void}
196
197Returns the difference in number of seconds.
198
199
200\membersection{wxTimeSpan::GetValue}\label{wxtimespangetvalue}
201
202\constfunc{wxLongLong}{GetValue}{\void}
203
204Returns the internal representation of timespan.
205
206
207\membersection{wxTimeSpan::GetWeeks}\label{wxtimespangetweeks}
208
209\constfunc{int}{GetWeeks}{\void}
210
211Returns the difference in number of weeks.
212
213
214\membersection{wxTimeSpan::Hours}\label{wxtimespanhours}
215
216\func{static wxTimespan}{Hours}{\param{long }{hours}}
217
218Returns the timespan for the given number of hours.
219
220
221\membersection{wxTimeSpan::Hour}\label{wxtimespanhour}
222
223\func{static wxTimespan}{Hour}{\void}
224
225Returns the timespan for one hour.
226
227
228\membersection{wxTimeSpan::IsEqualTo}\label{wxtimespanisequalto}
229
230\constfunc{bool}{IsEqualTo}{\param{const wxTimeSpan\& }{ts}}
231
232Returns {\tt true} if two timespans are equal.
233
234
235\membersection{wxTimeSpan::IsLongerThan}\label{wxtimespanislongerthan}
236
237\constfunc{bool}{IsLongerThan}{\param{const wxTimeSpan\& }{ts}}
238
239Compares two timespans: works with the absolute values, i.e. -2
240hours is longer than 1 hour. Also, it will return {\tt false} if
241the timespans are equal in absolute value.
242
243
244\membersection{wxTimeSpan::IsNegative}\label{wxtimespanisnegative}
245
246\constfunc{bool}{IsNegative}{\void}
247
248Returns {\tt true} if the timespan is negative.
249
250
251\membersection{wxTimeSpan::IsNull}\label{wxtimespanisnull}
252
253\constfunc{bool}{IsNull}{\void}
254
255Returns {\tt true} if the timespan is empty.
256
257
258\membersection{wxTimeSpan::IsPositive}\label{wxtimespanispositive}
259
260\constfunc{bool}{IsPositive}{\void}
261
262Returns {\tt true} if the timespan is positive.
263
264
265\membersection{wxTimeSpan::IsShorterThan}\label{wxtimespanisshorterthan}
266
267\constfunc{bool}{IsShorterThan}{\param{const wxTimeSpan\& }{ts}}
268
269Compares two timespans: works with the absolute values, i.e. 1
270hour is shorter than -2 hours. Also, it will return {\tt false} if
271the timespans are equal in absolute value.
272
273
274\membersection{wxTimeSpan::Minutes}\label{wxtimespanminutes}
275
276\func{static wxTimespan}{Minutes}{\param{long }{min}}
277
278Returns the timespan for the given number of minutes.
279
280
281\membersection{wxTimeSpan::Minute}\label{wxtimespanminute}
282
283\func{static wxTimespan}{Minute}{\void}
284
285Returns the timespan for one minute.
286
287
288\membersection{wxTimeSpan::Multiply}\label{wxtimespanmultiply}
289
290\constfunc{wxTimeSpan}{Multiply}{\param{int }{n}}
291
292\func{wxTimeSpan\&}{Multiply}{\param{int }{n}}
293
294\func{wxTimeSpan\&}{operator$*=$}{\param{int }{n}}
295
296Multiplies timespan by a scalar.
297
298
299\membersection{wxTimeSpan::Negate}\label{wxtimespannegate}
300
301\constfunc{wxTimeSpan}{Negate}{\void}
302
303Returns timespan with inverted sign.
304
305
306\membersection{wxTimeSpan::Neg}\label{wxtimespanneg}
307
308\func{wxTimeSpan\&}{Neg}{\void}
309
310\func{wxTimeSpan\&}{operator$-$}{\void}
311
312Negate the value of the timespan.
313
314
315\membersection{wxTimeSpan::Milliseconds}\label{wxtimespanmilliseconds}
316
317\func{static wxTimespan}{Milliseconds}{\param{long }{ms}}
318
319Returns the timespan for the given number of milliseconds.
320
321
322\membersection{wxTimeSpan::Millisecond}\label{wxtimespanmillisecond}
323
324\func{static wxTimespan}{Millisecond}{\void}
325
326Returns the timespan for one millisecond.
327
328
329\membersection{wxTimeSpan::Seconds}\label{wxtimespanseconds}
330
331\func{static wxTimespan}{Seconds}{\param{long }{sec}}
332
333Returns the timespan for the given number of seconds.
334
335
336\membersection{wxTimeSpan::Second}\label{wxtimespansecond}
337
338\func{static wxTimespan}{Second}{\void}
339
340Returns the timespan for one second.
341
342
343\membersection{wxTimeSpan::Subtract}\label{wxtimespansubtract}
344
345\constfunc{wxTimeSpan}{Subtract}{\param{const wxTimeSpan\&}{diff}}
346
347\func{wxTimeSpan\&}{Subtract}{\param{const wxTimeSpan\& }{diff}}
348
349\func{wxTimeSpan\&}{operator$-=$}{\param{const wxTimeSpan\&}{diff}}
350
351Returns the difference of two timespans.
352
353
354\membersection{wxTimeSpan::Weeks}\label{wxtimespanweeks}
355
356\func{static wxTimespan}{Weeks}{\param{long }{weeks}}
357
358Returns the timespan for the given number of weeks.
359
360
361\membersection{wxTimeSpan::Week}\label{wxtimespanweek}
362
363\func{static wxTimespan}{Week}{\void}
364
365Returns the timespan for one week.
366
367
368\membersection{wxTimeSpan::wxTimeSpan}\label{wxtimespanctor}
369
370\func{}{wxTimeSpan}{\void}
371
372Default constructor, constructs a zero timespan.
373
374\func{}{wxTimeSpan}{\param{long }{hours}, \param{long }{min}, \param{long }{sec}, \param{long }{msec}}
375
376Constructs timespan from separate values for each component, with the date
377set to 0. Hours are not restricted to 0..24 range, neither are
378minutes, seconds or milliseconds.
379