本文整理汇总了C++中CDataReader::canRead方法的典型用法代码示例。如果您正苦于以下问题:C++ CDataReader::canRead方法的具体用法?C++ CDataReader::canRead怎么用?C++ CDataReader::canRead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDataReader
的用法示例。
在下文中一共展示了CDataReader::canRead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CRWSectionContainer::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
CRWSectionContainer *pParentRWSectionContainer = this;
uint32 uiSectionDepth = 0;
vector<uint32>
vecSectionSizes,
vecByteCountsRead;
while (!pDataReader->isEOF())
{
if (!pDataReader->canRead(12))
{
break;
}
// read section header
uint32
uiRWSectionId = pDataReader->readUint32(),
uiRWSectionSize = pDataReader->readUint32(),
uiRWSectionRWVersion = pDataReader->readUint32();
eRWSection eRWSectionValue = (eRWSection)uiRWSectionId;
// enter new section
if (uiRWSectionId != 1)
{
vecSectionSizes.push_back(uiRWSectionSize);
vecByteCountsRead.push_back(0);
uiSectionDepth++;
}
// read struct header
if (CRWSection::doesRWSectionContainStruct(eRWSectionValue))
{
uint32
uiRWSectionId2 = pDataReader->readUint32(),
uiRWSectionSize2 = pDataReader->readUint32(),
uiRWSectionRWVersion2 = pDataReader->readUint32();
}
// create RW section
CRWSection *pRWSection = CRWSection::createRWSection(eRWSectionValue);
// unserialize RW section
uint32 uiByteCountBefore = pDataReader->getSeek();
pRWSection->unserialize();
uint32 uiByteCountAfter = pDataReader->getSeek();
vecByteCountsRead[uiSectionDepth - 1] += uiByteCountAfter - uiByteCountBefore;
// store RW section
pParentRWSectionContainer->addEntry(pRWSection);
// reset section depth
if (vecByteCountsRead[uiSectionDepth - 1] >= vecSectionSizes[uiSectionDepth - 1])
{
pParentRWSectionContainer = pParentRWSectionContainer->getParentNode();
vecSectionSizes.pop_back();
vecByteCountsRead[uiSectionDepth - 2] += vecByteCountsRead[uiSectionDepth - 1];
vecByteCountsRead.pop_back();
uiSectionDepth--;
}
}
}