当前位置: 首页>>代码示例>>C++>>正文


C++ CArchive::IsByteSwapping方法代码示例

本文整理汇总了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
	}
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:36,代码来源:array_w.cpp

示例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
        }
    }
开发者ID:shuowen,项目名称:OpenNT,代码行数:93,代码来源:dockstat.cpp


注:本文中的CArchive::IsByteSwapping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。