本文整理汇总了C++中CArchive::IsByteSwapping方法的典型用法代码示例。如果您正苦于以下问题:C++ CArchive::IsByteSwapping方法的具体用法?C++ CArchive::IsByteSwapping怎么用?C++ CArchive::IsByteSwapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArchive
的用法示例。
在下文中一共展示了CArchive::IsByteSwapping方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Serialize
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
}
}
示例2: Serialize
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
}
}