From 00b00f965098963e01985c75fa25c8a38fcf6921 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Sun, 26 Jul 2020 09:48:13 +0200 Subject: [PATCH] Patch level : 12.0 no-patch Files correlati : Commento : Aggiunte funzioni per inizio e fine anno --- src/include/date.cpp | 15 --------------- src/include/date.h | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/include/date.cpp b/src/include/date.cpp index d74575147..0c79dfe24 100755 --- a/src/include/date.cpp +++ b/src/include/date.cpp @@ -130,21 +130,6 @@ int TDate::last_day(int month, int year) return d; } -void TDate::set_end_month() -{ - _val = makedata(last_day(month(),year()),month(),year()); -} - -bool TDate::is_end_month() const -{ - return day() == last_day(month(),year()); -} - -bool TDate::empty() const -{ - return _val == 0; -} - int TDate::wday() const { // day of week (1=lunedi) diff --git a/src/include/date.h b/src/include/date.h index bc11286f8..5c88c1f80 100755 --- a/src/include/date.h +++ b/src/include/date.h @@ -110,11 +110,20 @@ public: // @cmember Ritorna l'ultimo giorno possibile del mese static int last_day(int month, int year); // @cmember Controlla se il giorno e' l'ultimo del mese - bool is_end_month() const; + bool is_end_month() const { return day() == last_day(month(), year());} // @cmember Setta il giorno del mese all'ultimo possibile - void set_end_month(); + void set_end_month() { _val = makedata(last_day(month(), year()), month(), year());} + // @cmember Controlla se il giorno e' primo dell'anno + bool is_start_year() const { return day() == 1 && month() == 1; } + // @cmember Setta il primo giorno dell'anno + void set_start_year(int y = 0) { _val = makedata(1, 1, y == 0 ? year() : y); } + // @cmember Controlla se il giorno e' l'ultimo dell'anno + bool is_end_year() const { return day() == 31 && month() == 12; } + // @cmember Setta l'ultimo giorno dell'anno + void set_end_year(int y = 0) { _val = makedata(31, 12, y == 0 ? year() : y); } + // @cmember Controlla se la data è nulla - bool empty() const ; + bool empty() const { return _val == 0;} // @cmember Setta la il giorno void set_day(int n);