void CLineGraph::Serialize(CArchive& ar) { if ( ar.IsStoring() ) { ar << m_bShowAxis; ar << m_bShowGrid; ar << m_bShowLegend; ar << m_nSpeed; ar << m_nScale; ar.WriteCount( GetItemCount() ); for ( POSITION pos = GetItemIterator() ; pos ; ) { GetNextItem( pos )->Serialize( ar ); } } else { ar >> m_bShowAxis; ar >> m_bShowGrid; ar >> m_bShowLegend; ar >> m_nSpeed; ar >> m_nScale; for ( int nCount = ar.ReadCount() ; nCount > 0 ; nCount-- ) { CGraphItem* pItem = new CGraphItem(); pItem->Serialize( ar ); m_pItems.AddTail( pItem ); } } }
void CLineGraph::Serialize(CArchive& ar) { if ( ar.IsStoring() ) { ar << m_bShowAxis; ar << m_bShowGrid; ar << m_bShowLegend; ar << m_nSpeed; ar << max( m_nScale, MIN_GRID_SIZE_HORZ ); ar.WriteCount( GetItemCount() ); for ( POSITION pos = GetItemIterator() ; pos ; ) { GetNextItem( pos )->Serialize( ar ); } } else // Loading { ar >> m_bShowAxis; ar >> m_bShowGrid; ar >> m_bShowLegend; ar >> m_nSpeed; ar >> m_nScale; m_nScale = max( m_nScale, MIN_GRID_SIZE_HORZ ); for ( DWORD_PTR nCount = ar.ReadCount() ; nCount > 0 ; nCount-- ) { CGraphItem* pItem = new CGraphItem(); pItem->Serialize( ar ); m_pItems.AddTail( pItem ); } } }