]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/timespan.tex
added new and improved wxFileCtrl implementation (patch 1763164)
[wxWidgets.git] / docs / latex / wx / timespan.tex
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
14 wxTimeSpan class represents a time interval.
15
16 \wxheading{Derived from}
17
18 No 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
104 Returns the absolute value of the timespan: does not modify the
105 object.
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
116 Returns the sum of two timespans.
117
118
119 \membersection{wxTimeSpan::Days}\label{wxtimespandays}
120
121 \func{static wxTimespan}{Days}{\param{long }{days}}
122
123 Returns the timespan for the given number of days.
124
125
126 \membersection{wxTimeSpan::Day}\label{wxtimespanday}
127
128 \func{static wxTimespan}{Day}{\void}
129
130 Returns the timespan for one day.
131
132
133 \membersection{wxTimeSpan::Format}\label{wxtimespanformat}
134
135 \func{wxString}{Format}{\param{const wxChar * }{format = wxDefaultTimeSpanFormat}}
136
137 Returns the string containing the formatted representation of the time span.
138 The 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
151 Note that, for example, the number of hours in the description above is not
152 well defined: it can be either the total number of hours (for example, for a
153 time span of $50$ hours this would be $50$) or just the hour part of the time
154 span, which would be $2$ in this case as $50$ hours is equal to $2$ days and
155 $2$ hours.
156
157 wxTimeSpan resolves this ambiguity in the following way: if there had been,
158 indeed, the {\tt \%D} format specified preceding the {\tt \%H}, then it is
159 interpreted as $2$. Otherwise, it is $50$.
160
161 The same applies to all other format specifiers: if they follow a specifier of
162 larger 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
169 Returns the difference in number of days.
170
171
172 \membersection{wxTimeSpan::GetHours}\label{wxtimespangethours}
173
174 \constfunc{int}{GetHours}{\void}
175
176 Returns the difference in number of hours.
177
178
179 \membersection{wxTimeSpan::GetMilliseconds}\label{wxtimespangetmilliseconds}
180
181 \constfunc{wxLongLong}{GetMilliseconds}{\void}
182
183 Returns the difference in number of milliseconds.
184
185
186 \membersection{wxTimeSpan::GetMinutes}\label{wxtimespangetminutes}
187
188 \constfunc{int}{GetMinutes}{\void}
189
190 Returns the difference in number of minutes.
191
192
193 \membersection{wxTimeSpan::GetSeconds}\label{wxtimespangetseconds}
194
195 \constfunc{wxLongLong}{GetSeconds}{\void}
196
197 Returns the difference in number of seconds.
198
199
200 \membersection{wxTimeSpan::GetValue}\label{wxtimespangetvalue}
201
202 \constfunc{wxLongLong}{GetValue}{\void}
203
204 Returns the internal representation of timespan.
205
206
207 \membersection{wxTimeSpan::GetWeeks}\label{wxtimespangetweeks}
208
209 \constfunc{int}{GetWeeks}{\void}
210
211 Returns the difference in number of weeks.
212
213
214 \membersection{wxTimeSpan::Hours}\label{wxtimespanhours}
215
216 \func{static wxTimespan}{Hours}{\param{long }{hours}}
217
218 Returns the timespan for the given number of hours.
219
220
221 \membersection{wxTimeSpan::Hour}\label{wxtimespanhour}
222
223 \func{static wxTimespan}{Hour}{\void}
224
225 Returns the timespan for one hour.
226
227
228 \membersection{wxTimeSpan::IsEqualTo}\label{wxtimespanisequalto}
229
230 \constfunc{bool}{IsEqualTo}{\param{const wxTimeSpan\& }{ts}}
231
232 Returns {\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
239 Compares two timespans: works with the absolute values, i.e. -2
240 hours is longer than 1 hour. Also, it will return {\tt false} if
241 the timespans are equal in absolute value.
242
243
244 \membersection{wxTimeSpan::IsNegative}\label{wxtimespanisnegative}
245
246 \constfunc{bool}{IsNegative}{\void}
247
248 Returns {\tt true} if the timespan is negative.
249
250
251 \membersection{wxTimeSpan::IsNull}\label{wxtimespanisnull}
252
253 \constfunc{bool}{IsNull}{\void}
254
255 Returns {\tt true} if the timespan is empty.
256
257
258 \membersection{wxTimeSpan::IsPositive}\label{wxtimespanispositive}
259
260 \constfunc{bool}{IsPositive}{\void}
261
262 Returns {\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
269 Compares two timespans: works with the absolute values, i.e. 1
270 hour is shorter than -2 hours. Also, it will return {\tt false} if
271 the timespans are equal in absolute value.
272
273
274 \membersection{wxTimeSpan::Minutes}\label{wxtimespanminutes}
275
276 \func{static wxTimespan}{Minutes}{\param{long }{min}}
277
278 Returns the timespan for the given number of minutes.
279
280
281 \membersection{wxTimeSpan::Minute}\label{wxtimespanminute}
282
283 \func{static wxTimespan}{Minute}{\void}
284
285 Returns 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
296 Multiplies timespan by a scalar.
297
298
299 \membersection{wxTimeSpan::Negate}\label{wxtimespannegate}
300
301 \constfunc{wxTimeSpan}{Negate}{\void}
302
303 Returns 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
312 Negate the value of the timespan.
313
314
315 \membersection{wxTimeSpan::Milliseconds}\label{wxtimespanmilliseconds}
316
317 \func{static wxTimespan}{Milliseconds}{\param{long }{ms}}
318
319 Returns the timespan for the given number of milliseconds.
320
321
322 \membersection{wxTimeSpan::Millisecond}\label{wxtimespanmillisecond}
323
324 \func{static wxTimespan}{Millisecond}{\void}
325
326 Returns the timespan for one millisecond.
327
328
329 \membersection{wxTimeSpan::Seconds}\label{wxtimespanseconds}
330
331 \func{static wxTimespan}{Seconds}{\param{long }{sec}}
332
333 Returns the timespan for the given number of seconds.
334
335
336 \membersection{wxTimeSpan::Second}\label{wxtimespansecond}
337
338 \func{static wxTimespan}{Second}{\void}
339
340 Returns 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
351 Returns the difference of two timespans.
352
353
354 \membersection{wxTimeSpan::Weeks}\label{wxtimespanweeks}
355
356 \func{static wxTimespan}{Weeks}{\param{long }{weeks}}
357
358 Returns the timespan for the given number of weeks.
359
360
361 \membersection{wxTimeSpan::Week}\label{wxtimespanweek}
362
363 \func{static wxTimespan}{Week}{\void}
364
365 Returns the timespan for one week.
366
367
368 \membersection{wxTimeSpan::wxTimeSpan}\label{wxtimespanctor}
369
370 \func{}{wxTimeSpan}{\void}
371
372 Default constructor, constructs a zero timespan.
373
374 \func{}{wxTimeSpan}{\param{long }{hours}, \param{long }{min}, \param{long }{sec}, \param{long }{msec}}
375
376 Constructs timespan from separate values for each component, with the date
377 set to 0. Hours are not restricted to 0..24 range, neither are
378 minutes, seconds or milliseconds.
379