deprecated SetToTheWeek() and GetWeek(); added and documented new and well-defined SetToWeekOfYear()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-09-11 22:07:10 +00:00
parent 1c5d27e2ab
commit 4c27e2faf3
4 changed files with 199 additions and 45 deletions

View File

@@ -687,12 +687,21 @@ public:
// sets the date to the given day of the given week in the year,
// returns true on success and false if given date doesn't exist (e.g.
// numWeek is > 53)
bool SetToTheWeek(wxDateTime_t numWeek,
WeekDay weekday = Mon,
WeekFlags flags = Monday_First);
inline wxDateTime GetWeek(wxDateTime_t numWeek,
WeekDay weekday = Mon,
WeekFlags flags = Monday_First) const;
//
// these functions are badly defined as they're not the reverse of
// GetWeekOfYear(), use SetToTheWeekOfYear() instead
wxDEPRECATED( bool SetToTheWeek(wxDateTime_t numWeek,
WeekDay weekday = Mon,
WeekFlags flags = Monday_First) );
wxDEPRECATED( wxDateTime GetWeek(wxDateTime_t numWeek,
WeekDay weekday = Mon,
WeekFlags flags = Monday_First) const );
// returns the date corresponding to the given week day of the given
// week (in ISO notation) of the specified year
static wxDateTime SetToWeekOfYear(int year,
wxDateTime_t numWeek,
WeekDay weekday = Mon);
// sets the date to the last day of the given (or current) month or the
// given (or current) year
@@ -1526,15 +1535,6 @@ inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime;
}
inline wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek,
WeekDay weekday,
WeekFlags flags) const
{
wxDateTime dt(*this);
return dt.SetToTheWeek(numWeek, weekday, flags) ? dt : wxInvalidDateTime;
}
inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const
{
MODIFY_AND_RETURN( SetToLastMonthDay(month, year) );