Commit c3c36ab0 authored by remi cresson's avatar remi cresson
Browse files

ADD: new method IsInRange (startmonth, startday, nbofdays)

parent c719af40
No related merge requests found
Showing with 15 additions and 2 deletions
+15 -2
......@@ -60,7 +60,10 @@ public:
~SingleDate (){}
bool IsInRange(const int& startMonth,const int& startDay,const int& endMonth, const int& endDay) const
/*
* Return true if the date is in the time range given by (startmonth; startday; endmonth, endday)
*/
bool IsInRange(const int& startMonth, const int& startDay, const int& endMonth, const int& endDay) const
{
if (startMonth < month && month < endMonth)
{
......@@ -80,6 +83,16 @@ public:
}
}
/*
* Return true if the date is in the time range given by (startmonth; startday; nbOfDays)
*/
bool IsInRange(const int& startMonth, const int& startDay, const int& nbOfDays) const
{
SingleDate startDate(year, startMonth, startDay);
return startDate.julianday <= julianday && julianday <= startDate.julianday + nbOfDays;
}
int day;
int month;
int year;
......@@ -93,7 +106,7 @@ typedef std::vector<SingleDate> DatesType;
* Input string must be in the form of "YYYYMMDD ....."
*/
DatesType GetDatesFromStringVector(std::vector<std::string> & list, bool check_order = true){
std::cout << "GetDatesFromStringVector" << std::endl;
DatesType dates;
for (unsigned int i = 0 ; i < list.size() ; i++)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment