2000-07-15 15:51:35 -04:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%% Name: datespan.tex
|
|
|
|
%% Purpose: wxDateSpan documentation
|
|
|
|
%% Author: Vadim Zeitlin
|
|
|
|
%% Modified by:
|
|
|
|
%% Created: 04.04.00
|
|
|
|
%% RCS-ID: $Id$
|
|
|
|
%% Copyright: (c) Vadim Zeitlin
|
2005-02-22 10:09:56 -05:00
|
|
|
%% License: wxWindows license
|
2000-07-15 15:51:35 -04:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
\section{\class{wxDateSpan}}\label{wxdatespan}
|
|
|
|
|
2003-01-02 17:10:21 -05:00
|
|
|
This class is a "logical time span" and is useful for implementing program
|
|
|
|
logic for such things as "add one month to the date" which, in general,
|
|
|
|
doesn't mean to add $60*60*24*31$ seconds to it, but to take the same date
|
|
|
|
the next month (to understand that this is indeed different consider adding
|
|
|
|
one month to Feb, 15 -- we want to get Mar, 15, of course).
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2003-01-02 17:10:21 -05:00
|
|
|
When adding a month to the date, all lesser components (days, hours, ...)
|
|
|
|
won't be changed unless the resulting date would be invalid: for example,
|
2006-05-28 19:56:51 -04:00
|
|
|
Jan 31 + 1 month will be Feb 28, not (non-existing) Feb 31.
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
Because of this feature, adding and subtracting back again the same
|
|
|
|
wxDateSpan will {\bf not}, in general give back the original date: Feb 28 - 1
|
|
|
|
month will be Jan 28, not Jan 31!
|
|
|
|
|
|
|
|
wxDateSpan objects can be either positive or negative. They may be
|
|
|
|
multiplied by scalars which multiply all deltas by the scalar: i.e.
|
|
|
|
$2*(1 \hbox{ month and } 1 \hbox{ day})$ is $2$ months and $2$ days. They can
|
|
|
|
be added together and with \helpref{wxDateTime}{wxdatetime} or
|
|
|
|
\helpref{wxTimeSpan}{wxtimespan}, but the type of result is different for each
|
|
|
|
case.
|
|
|
|
|
|
|
|
Beware about weeks: if you specify both weeks and days, the total number of
|
|
|
|
days added will be $7*\hbox{weeks} + \hbox{days}$! See also GetTotalDays()
|
|
|
|
function.
|
|
|
|
|
|
|
|
Equality operators are defined for wxDateSpans. Two datespans are equal if
|
2004-02-21 20:16:32 -05:00
|
|
|
and only if they both give the same target date when added to {\bf every}\rtfsp
|
2003-01-02 17:10:21 -05:00
|
|
|
source date. Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30),
|
2003-06-01 17:25:08 -04:00
|
|
|
because they don't give the same date when added to 1 Feb. But
|
2003-01-02 17:10:21 -05:00
|
|
|
wxDateSpan::Days(14) is equal to wxDateSpan::Weeks(2)
|
|
|
|
|
|
|
|
Finally, notice that for adding hours, minutes and so on you don't need this
|
|
|
|
class at all: \helpref{wxTimeSpan}{wxtimespan} will do the job because there
|
|
|
|
are no subtleties associated with those (we don't support leap seconds).
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
No base class
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/datetime.h>
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Date classes overview}{wxdatetimeoverview},\rtfsp
|
|
|
|
\helpref{wxDateTime}{wxdatetime}
|
|
|
|
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
% wxDateSpan ctor
|
|
|
|
\membersection{wxDateSpan::wxDateSpan}\label{wxdatespanwxdatespan}
|
|
|
|
|
|
|
|
\func{}{wxDateSpan}{\param{int }{years = $0$}, \param{int }{months = $0$}, \param{int }{weeks = $0$}, \param{int }{days = $0$}}
|
|
|
|
|
|
|
|
Constructs the date span object for the given number of years, months, weeks
|
|
|
|
and days. Note that the weeks and days add together if both are given.
|
|
|
|
|
|
|
|
% wxDateSpan::Add
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Add}\label{wxdatespanadd}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{wxDateSpan}{Add}{\param{const wxDateSpan\& }{other}}
|
|
|
|
|
|
|
|
\func{wxDateSpan\&}{Add}{\param{const wxDateSpan\& }{other}}
|
|
|
|
|
|
|
|
\func{wxDateSpan\&}{operator$+=$}{\param{const wxDateSpan\& }{other}}
|
|
|
|
|
|
|
|
Returns the sum of two date spans. The first version returns a new object, the
|
|
|
|
second and third ones modify this object in place.
|
|
|
|
|
|
|
|
% wxDateSpan::Day
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Day}\label{wxdatespanday}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{static wxDateSpan}{Day}{\void}
|
|
|
|
|
|
|
|
Returns a date span object corresponding to one day.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Days}{wxdatespandays}
|
|
|
|
|
|
|
|
% wxDateSpan::Days
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Days}\label{wxdatespandays}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{static wxDateSpan}{Days}{\param{int }{days}}
|
|
|
|
|
|
|
|
Returns a date span object corresponding to the given number of days.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Day}{wxdatespanday}
|
|
|
|
|
|
|
|
% wxDateSpan::GetDays
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::GetDays}\label{wxdatespangetdays}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{int}{GetDays}{\void}
|
|
|
|
|
|
|
|
Returns the number of days (only, that it not counting the weeks component!)
|
|
|
|
in this date span.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{GetTotalDays}{wxdatespangettotaldays}
|
|
|
|
|
|
|
|
% wxDateSpan::GetMonths
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::GetMonths}\label{wxdatespangetmonths}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{int}{GetMonths}{\void}
|
|
|
|
|
|
|
|
Returns the number of the months (not counting the years) in this date span.
|
|
|
|
|
|
|
|
% wxDateSpan::GetTotalDays
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::GetTotalDays}\label{wxdatespangettotaldays}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{int}{GetTotalDays}{\void}
|
|
|
|
|
|
|
|
Returns the combined number of days in this date span, counting both weeks and
|
|
|
|
days. It still doesn't take neither months nor years into the account.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{GetWeeks}{wxdatespangetweeks}, \helpref{GetDays}{wxdatespangetdays}
|
|
|
|
|
|
|
|
% wxDateSpan::GetWeeks
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::GetWeeks}\label{wxdatespangetweeks}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{int}{GetWeeks}{\void}
|
|
|
|
|
|
|
|
Returns the number of weeks in this date span.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{GetTotalDays}{wxdatespangettotaldays}
|
|
|
|
|
|
|
|
% wxDateSpan::GetYears
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::GetYears}\label{wxdatespangetyears}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{int}{GetYears}{\void}
|
|
|
|
|
|
|
|
Returns the number of years in this date span.
|
|
|
|
|
|
|
|
% wxDateSpan::Month
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Month}\label{wxdatespanmonth}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{static wxDateSpan}{Month}{\void}
|
|
|
|
|
|
|
|
Returns a date span object corresponding to one month.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Months}{wxdatespanmonths}
|
|
|
|
|
|
|
|
% wxDateSpan::Months
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Months}\label{wxdatespanmonths}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{static wxDateSpan}{Months}{\param{int }{mon}}
|
|
|
|
|
|
|
|
Returns a date span object corresponding to the given number of months.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Month}{wxdatespanmonth}
|
|
|
|
|
|
|
|
% wxDateSpan::Multiply
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Multiply}\label{wxdatespanmultiply}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{wxDateSpan}{Multiply}{\param{int }{factor}}
|
|
|
|
|
|
|
|
\func{wxDateSpan\&}{Multiply}{\param{int }{factor}}
|
|
|
|
|
|
|
|
\func{wxDateSpan\&}{operator$*=$}{\param{int }{factor}}
|
|
|
|
|
|
|
|
Returns the product of the date span by the specified {\it factor}. The
|
|
|
|
product is computed by multiplying each of the components by the factor.
|
|
|
|
|
|
|
|
The first version returns a new object, the second and third ones modify this
|
|
|
|
object in place.
|
|
|
|
|
|
|
|
% wxDateSpan::Negate
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Negate}\label{wxdatespannegate}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{wxDateSpan}{Negate}{\void}
|
|
|
|
|
|
|
|
Returns the date span with the opposite sign.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Neg}{wxdatespanneg}
|
|
|
|
|
|
|
|
% wxDateSpan::Neg
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Neg}\label{wxdatespanneg}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{wxDateSpan\&}{Neg}{\void}
|
|
|
|
|
|
|
|
\func{wxDateSpan\&}{operator$-$}{\void}
|
|
|
|
|
|
|
|
Changes the sign of this date span.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Negate}{wxdatespannegate}
|
|
|
|
|
|
|
|
% wxDateSpan::SetDays
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::SetDays}\label{wxdatespansetdays}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{wxDateSpan\&}{SetDays}{\param{int }{n}}
|
|
|
|
|
|
|
|
Sets the number of days (without modifying any other components) in this date
|
|
|
|
span.
|
|
|
|
|
|
|
|
% wxDateSpan::SetYears
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::SetYears}\label{wxdatespansetyears}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{wxDateSpan\&}{SetYears}{\param{int }{n}}
|
|
|
|
|
|
|
|
Sets the number of years (without modifying any other components) in this date
|
|
|
|
span.
|
|
|
|
|
|
|
|
% wxDateSpan::SetMonths
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::SetMonths}\label{wxdatespansetmonths}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{wxDateSpan\&}{SetMonths}{\param{int }{n}}
|
|
|
|
|
|
|
|
Sets the number of months (without modifying any other components) in this
|
|
|
|
date span.
|
|
|
|
|
|
|
|
% wxDateSpan::SetWeeks
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::SetWeeks}\label{wxdatespansetweeks}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{wxDateSpan\&}{SetWeeks}{\param{int }{n}}
|
|
|
|
|
|
|
|
Sets the number of weeks (without modifying any other components) in this date
|
|
|
|
span.
|
|
|
|
|
|
|
|
% wxDateSpan::Subtract
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Subtract}\label{wxdatespansubtract}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{wxDateSpan}{Subtract}{\param{const wxDateSpan\& }{other}}
|
|
|
|
|
|
|
|
\func{wxDateSpan\&}{Subtract}{\param{const wxDateSpan\& }{other}}
|
|
|
|
|
|
|
|
\func{wxDateSpan\&}{operator$+=$}{\param{const wxDateSpan\& }{other}}
|
|
|
|
|
|
|
|
Returns the difference of two date spans. The first version returns a new
|
|
|
|
object, the second and third ones modify this object in place.
|
|
|
|
|
|
|
|
% wxDateSpan::Week
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Week}\label{wxdatespanweek}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{static wxDateSpan}{Week}{\void}
|
|
|
|
|
|
|
|
Returns a date span object corresponding to one week.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Weeks}{wxdatespanweeks}
|
|
|
|
|
|
|
|
% wxDateSpan::Weeks
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Weeks}\label{wxdatespanweeks}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{static wxDateSpan}{Weeks}{\param{int }{weeks}}
|
|
|
|
|
|
|
|
Returns a date span object corresponding to the given number of weeks.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Week}{wxdatespanweek}
|
|
|
|
|
|
|
|
% wxDateSpan::Year
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Year}\label{wxdatespanyear}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{static wxDateSpan}{Year}{\void}
|
|
|
|
|
|
|
|
Returns a date span object corresponding to one year.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Years}{wxdatespanyears}
|
|
|
|
|
|
|
|
% wxDateSpan::Years
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::Years}\label{wxdatespanyears}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\func{static wxDateSpan}{Years}{\param{int }{years}}
|
|
|
|
|
|
|
|
Returns a date span object corresponding to the given number of years.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Year}{wxdatespanyear}
|
|
|
|
|
|
|
|
% wxDateSpan::operator==
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::operator$==$}\label{wxdatespanoperatorequal}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{bool}{operator$==$}{\param{wxDateSpan\&}{ other}}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns {\tt true} if this date span is equal to the other one. Two date spans
|
2003-01-02 17:10:21 -05:00
|
|
|
are considered equal if and only if they have the same number of years and
|
|
|
|
months and the same total number of days (counting both days and weeks).
|
|
|
|
|
|
|
|
% wxDateSpan::operator!=
|
2003-06-01 17:20:07 -04:00
|
|
|
\membersection{wxDateSpan::operator$!=$}\label{wxdatespanoperatornotequal}
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\constfunc{bool}{operator$!=$}{\param{wxDateSpan\&}{ other}}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns {\tt true} if this date span is different from the other one.
|
2003-01-02 17:10:21 -05:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{operator==}{wxdatespanoperatorequal}
|
2003-08-24 04:16:37 -04:00
|
|
|
|