本文整理汇总了C++中CIOBuffer::IsEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ CIOBuffer::IsEnd方法的具体用法?C++ CIOBuffer::IsEnd怎么用?C++ CIOBuffer::IsEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIOBuffer
的用法示例。
在下文中一共展示了CIOBuffer::IsEnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadChunks
//////////////////
//
// XPK fileformat:
// chunk-based, crunched data in chunks
//
// Chunk format:
// * chunk header
// - 1 byte for chunk type
// - 1 byte for chunk header checksum ?
// - 2 bytes for chunk checksum
// - 2/4 bytes for chunk (compressed) length
// - 2/4 bytes for uncompressed length?
// * chunk data
// - amount of packed data given in chunk header..
//
// Note: chunk header may have different size in different file
// according to flags (if "long" sizes are used for chunks).
//
//
void XpkTags::ReadChunks(CIOBuffer &Buffer)
{
m_pFirst = new XpkChunk();
m_pFirst->m_nDataOffset = Buffer.GetCurrentPos();
XpkChunk *pCurrent = m_pFirst;
while (Buffer.IsEnd() == false)
{
bool isValidHeader = false;
if (m_streamHeader.xsh_Flags & XPKSTREAMF_LONGHEADERS)
{
XpkChunkHdrLong *pHdr = (XpkChunkHdrLong*)Buffer.GetAtCurrent();
pCurrent->m_Type = pHdr->xchl_Type;
pCurrent->m_HChecksum = pHdr->xchl_HChk;
pCurrent->m_ChunkChecksum = Swap2(pHdr->xchl_CChk);
pCurrent->m_ChunkLength = Swap4(pHdr->xchl_CLen);
pCurrent->m_UnLen = Swap4(pHdr->xchl_ULen);
pCurrent->m_nDataOffset += sizeof(XpkChunkHdrLong);
isValidHeader = verifyHeaderLong(pHdr);
}
else
{
XpkChunkHdrWord *pHdr = (XpkChunkHdrWord*)Buffer.GetAtCurrent();
pCurrent->m_Type = pHdr->xchw_Type;
pCurrent->m_HChecksum = pHdr->xchw_HChk;
pCurrent->m_ChunkChecksum = Swap2(pHdr->xchw_CChk);
pCurrent->m_ChunkLength = Swap2(pHdr->xchw_CLen);
pCurrent->m_UnLen = Swap2(pHdr->xchw_ULen);
pCurrent->m_nDataOffset += sizeof(XpkChunkHdrWord);
isValidHeader = verifyHeaderWord(pHdr);
}
// TODO: need header checksum verification somewhere around here..
if (isValidHeader == false)
{
// TODO: exception or skip ?
}
if (pCurrent->m_Type != XPKCHUNK_RAW
&& pCurrent->m_Type != XPKCHUNK_PACKED
&& pCurrent->m_Type != XPKCHUNK_END)
{
// TODO: exception or skip ?
}
// move to actual data of chunk (according to chunk header size)
Buffer.SetCurrentPos(pCurrent->m_nDataOffset);
// "end-of-file" chunk? (empty)
if (pCurrent->m_Type == XPKCHUNK_END)
{
return;
}
// TODO:
// .. process chunk
// -> walkthrough in XPK-master now..
// offset to start of next chunk:
// start of data in current + size of data in current
size_t nNextChunkOffset = pCurrent->m_nDataOffset + pCurrent->m_ChunkLength;
Buffer.SetCurrentPos(nNextChunkOffset);
pCurrent->m_pNext = new XpkChunk(pCurrent);
pCurrent->m_pNext->m_nDataOffset = nNextChunkOffset;
pCurrent = pCurrent->m_pNext;
}
}