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
This commit is contained in:
parent
d87aed9b33
commit
5b632e61bd
@ -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;
|
||||
|
@ -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 <p complete> o no
|
||||
void get_week_year(int &weekd, int &yeard, bool complete);
|
||||
// @cmember Aggiunge dei mesi
|
||||
|
Loading…
x
Reference in New Issue
Block a user