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