//Checks for expiry of all tasks in the multimap void Storage::checkForExpiry() { multimap<DEADLINE, Task*>::iterator it; it=timedTaskMap.begin(); while(it != timedTaskMap.end()){ if(isExpired((*it).second)) { (*it).second->indicateExpired(); } if(isToday((*it).second)) { (*it).second->indicateToday(true); } else { (*it).second->indicateToday(false); } it++; } }
int main(int argc, const char* argv[]) { if(argc < 2) { printError(); return 0; } int iMonth = 0; int iYear = 0; sscanf(argv[1], "%d.%d", &iMonth, &iYear); if(iYear <= 1900 || iMonth > 12 || iMonth <= 0) { printError(); return 0; } // Set environment's default locale setlocale(LC_ALL, ""); // Init console colors HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo( hstdout, &csbi ); int iFirstWeekDay = getFirstDayOfWeek(); int iMonthStartWeekDay = getMonthStartDay(iYear, iMonth); int iDaysInMonth = getDaysInMonth(iYear, iMonth); wchar_t Buf[255]; int iRow = 0; bool bFillCalendar = false; int iCurrentWeekDay = iFirstWeekDay; int iCurrentMonthDay = 1; while(iCurrentMonthDay <= iDaysInMonth) { iCurrentWeekDay = iFirstWeekDay; for(int i = 0; i < 7; i++) { if(iRow == 0) { // Setting white color on black background SetConsoleTextAttribute(hstdout, 0xF0); GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + iCurrentWeekDay, Buf, 255); wprintf(L"%4.3ls ", Buf); } else if(iRow == 1) { // Setting white color on black background SetConsoleTextAttribute(hstdout, 0x7F); if(iMonthStartWeekDay == iCurrentWeekDay) { bFillCalendar = true; } } // Filling blank space before and after selected month if(!bFillCalendar && iRow != 0) { wprintf(L"%5s", " "); } if(bFillCalendar) { // Setting days color if(iCurrentWeekDay == 5 || iCurrentWeekDay == 6) { // Sundays and saturdays are light red! SetConsoleTextAttribute(hstdout, 0x7C); } else { // Other days are white SetConsoleTextAttribute(hstdout, 0x71); } if(isToday(iYear, iMonth, iCurrentMonthDay)) { // Printing "today" in the brackets swprintf(Buf, L"[%2d]", iCurrentMonthDay); wprintf(L"%5.4s", Buf); } else { wprintf(L"%4d ", iCurrentMonthDay); } iCurrentMonthDay++; if(iCurrentMonthDay > iDaysInMonth) { bFillCalendar = false; } } if(iCurrentWeekDay == 6) { iCurrentWeekDay = 0; } else { iCurrentWeekDay++; } } SetConsoleTextAttribute(hstdout, csbi.wAttributes); wprintf(L"\r\n"); iRow++; } printf("Press any key to continue..."); getch(); return 0; }