void CBigBrotherDoc::Serialize(CArchive& ar) { ASSERT_VALID(this); CDocument::Serialize(ar); ar.MapObject(this); ar.SerializeClass(RUNTIME_CLASS(CBigBrotherDoc)); if (ar.IsStoring()) { // Store to archive ar << m_PingSize; ar << m_MaxThreads; ar << m_MaxLogTime; ar << m_bSaveOnShutdown; ar << m_AutoSave; ar << m_LogFile; ar << m_bStoreLastActivity; ar << m_RootBrother; m_Brotherhood.Serialize(ar); } else { UINT schema = ar.GetObjectSchema(); #ifndef NDEBUG { CString tmp; tmp.Format("Doc-OSchema: %u\n",schema); TRACE0(tmp); } #endif CleanUp(); m_ThisMap.RemoveAll(); // Read from archive ar >> m_PingSize; ar >> m_MaxThreads; ar >> m_MaxLogTime; if(schema>=2){ ar >> m_bSaveOnShutdown; ar >> m_AutoSave; } ar >> m_LogFile; if(schema>=3) ar >> m_bStoreLastActivity; ar >> m_RootBrother; m_Brotherhood.Serialize(ar); // Read from archive m_ThisMap.RemoveAll(); // Log loading CString logLine; logLine.Format(IDS_LOG_LOADFILE,(LPCTSTR)GetTitle()); logLine=CTime::GetCurrentTime().Format(IDS_LOG_DATEFORMAT)+" "+logLine; LogLine(logLine); }
void CMyDocument::Serialize(CArchive& ar) { CDocument::Serialize(ar); if (ar.IsStoring()) { // TODO: add storing code here } else { // TODO: add loading code here } ar.MapObject(this); //serialize the subitems in the document; //they will be able to serialize their m_pDoc //back pointer m_listOfSubItems.Serialize(ar); }