void CWordArray::Serialize(CArchive& ar) { ASSERT_VALID(this); CObject::Serialize(ar); if (ar.IsStoring()) { ar.WriteCount(m_nSize); #ifdef _MAC if (!ar.IsByteSwapping()) #endif ar.Write(m_pData, m_nSize * sizeof(WORD)); #ifdef _MAC else { // write each item individually so that it will be byte-swapped for (int i = 0; i < m_nSize; i++) ar << m_pData[i]; } #endif } else { DWORD nOldSize = ar.ReadCount(); SetSize(nOldSize); ar.Read(m_pData, m_nSize * sizeof(WORD)); #ifdef _MAC if (ar.IsByteSwapping()) { for (int i = 0; i < m_nSize; i++) _AfxByteSwap(m_pData[i], (BYTE*)&m_pData[i]); } #endif } }
void CControlBarInfo::Serialize(CArchive& ar, CDockState* pDockState) { ASSERT(pDockState!=NULL); if (ar.IsStoring()) { ar << (DWORD)m_nBarID; ar << (DWORD)m_bVisible; ar << (DWORD)m_bFloating; ar << (DWORD)m_bHorz; ar << m_pointPos; if (pDockState->GetVersion() > 1) { ar << (DWORD)m_nMRUWidth; ar << (DWORD)m_bDocking; if (m_bDocking) { ar << (DWORD)m_uMRUDockID; ar << m_rectMRUDockPos; ar << m_dwMRUFloatStyle; ar << m_ptMRUFloatPos; } } ar << (WORD)m_arrBarID.GetSize(); if (m_arrBarID.GetSize() != 0) { #ifdef _MAC if (!ar.IsByteSwapping()) #endif ar.Write(&m_arrBarID.ElementAt(0), m_arrBarID.GetSize()*sizeof(DWORD)); #ifdef _MAC else { // write each ID individually so that it will be byte-swapped for (int i = 0; i < m_arrBarID.GetSize(); i++) ar << (DWORD)m_arrBarID[i]; } #endif } } else { DWORD dw; ar >> dw; m_nBarID = (int)dw; ar >> dw; m_bVisible = (BOOL)dw; ar >> dw; m_bFloating = (BOOL)dw; ar >> dw; m_bHorz = (BOOL)dw; ar >> m_pointPos; if (pDockState->GetVersion() > 1) { pDockState->ScalePoint(m_pointPos); ar >> dw; m_nMRUWidth = (int)dw; ar >> dw; m_bDocking = (BOOL)dw; if (m_bDocking) { ar >> dw; m_uMRUDockID = (DWORD)dw; ar >> m_rectMRUDockPos; pDockState->ScaleRectPos(m_rectMRUDockPos); ar >> m_dwMRUFloatStyle; ar >> m_ptMRUFloatPos; pDockState->ScalePoint(m_ptMRUFloatPos); } } WORD w; ar >> w; m_arrBarID.SetSize(w); if (w != 0) { ar.Read(&m_arrBarID.ElementAt(0), m_arrBarID.GetSize()*sizeof(DWORD)); #ifdef _MAC if (ar.IsByteSwapping()) { for (int i = 0; i < m_arrBarID.GetSize(); i++) _AfxByteSwap((DWORD)m_arrBarID[i], (BYTE*)&m_arrBarID[i]); } #endif } }