//resets the contents of the message list based upon the currently viewed task void CBackEndDialog::ResetMessageList() { //we need to fill the message list up with the message associated with the //newly selected task //flush existing messages EmptyMessageList(); CTask* pTask = GetViewedTask(); if(pTask) { //now fill up the message list with all of our messages CTaskMessage* pCurrMsg = pTask->GetMessageHead(); while(pCurrMsg) { if(ShouldShowMessage(pCurrMsg, m_eMsgFilter)) { //add this string and a pointer to the orinignal message AddMessageToList(pCurrMsg); } pCurrMsg = pCurrMsg->GetNext(); } } RedrawMessageList(); }
//saves all the messages and tasks to a file of the specified name bool CBackEndDialog::SaveLogToFile(const char* pszFilename) { //open up the file and write out all the tasks and all their messages #if _MSC_VER >= 1300 std::ofstream OutFile(pszFilename); #else ofstream OutFile(pszFilename); #endif if(OutFile.fail()) { return false; } CTask* pCurrTask = m_pHeadTask; while(pCurrTask) { //write out the task title OutFile << "Task: " << pCurrTask->GetName() << "\n\n"; //write out the messages CTaskMessage* pCurrMsg = pCurrTask->GetMessageHead(); while(pCurrMsg) { OutFile << "\t" << FormatFinalMsg(pCurrMsg); pCurrMsg = pCurrMsg->GetNext(); } pCurrTask = pCurrTask->GetNextTask(); } OutFile.close(); return true; }