From 5b632e61bda94a2f70a477094533dba7836e2766 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 27 Apr 2005 08:30:59 +0000 Subject: [PATCH] Patch level : 2.2 84 Files correlati : ci0.exe Ricompilazione Demo : [ ] Commento : Aggiunto il metodo is_holiday alle date git-svn-id: svn://10.65.10.50/trunk@13010 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/date.cpp | 24 ++++++++++++++++++++++++ include/date.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/include/date.cpp b/include/date.cpp index ae7dc7dbe..55ab058b2 100755 --- a/include/date.cpp +++ b/include/date.cpp @@ -375,6 +375,30 @@ int TDate::week() const return int((*this - y) / 7 + 1); } +bool TDate::is_holiday() const +{ + bool holiday = wday() > 5; + if (!holiday) + { + const int d = day(); + const int m = month(); + + if ((m == 1) && ((d == 1) || (d == 6))) + return true; + if ((m == 4) && (d == 25)) + return true; + if ((m == 5) && (d == 1)) + return true; + if ((m == 8) && (d == 15)) + return true; + if ((m == 11) && (d == 1)) + return true; + if ((m == 12) && ((d == 8) || (d == 25) || (d == 26))) + return true; + } + return holiday; +} + TDate& TDate::operator +=(long nday) { const long d = day() + nday; diff --git a/include/date.h b/include/date.h index 706839b4f..11b1135ed 100755 --- a/include/date.h +++ b/include/date.h @@ -89,6 +89,8 @@ public: int wday() const ; // @cmember Ritorna la settimana dell'anno int week() const ; + // @cmember Ritorna se e' un giorno festivo + bool is_holiday() const ; // @cmember Ritorna la settimana e l'anno considerando le settimane complete

o no void get_week_year(int &weekd, int &yeard, bool complete); // @cmember Aggiunge dei mesi