本文整理汇总了C++中StreamSerialiser::undoReadChunk方法的典型用法代码示例。如果您正苦于以下问题:C++ StreamSerialiser::undoReadChunk方法的具体用法?C++ StreamSerialiser::undoReadChunk怎么用?C++ StreamSerialiser::undoReadChunk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamSerialiser
的用法示例。
在下文中一共展示了StreamSerialiser::undoReadChunk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareImpl
//---------------------------------------------------------------------
bool Page::prepareImpl(StreamSerialiser& stream, PageData* dataToPopulate)
{
// Now do the real loading
if (!stream.readChunkBegin(CHUNK_ID, CHUNK_VERSION, "Page"))
return false;
// pageID check (we should know the ID we're expecting)
uint32 storedID;
stream.read(&storedID);
if (mID != storedID)
{
LogManager::getSingleton().stream() << "Error: Tried to populate Page ID " << mID
<< " with data corresponding to page ID " << storedID;
stream.undoReadChunk(CHUNK_ID);
return false;
}
PageManager* mgr = getManager();
while(stream.peekNextChunkID() == CHUNK_CONTENTCOLLECTION_DECLARATION_ID)
{
const StreamSerialiser::Chunk* collChunk = stream.readChunkBegin();
String factoryName;
stream.read(&factoryName);
stream.readChunkEnd(CHUNK_CONTENTCOLLECTION_DECLARATION_ID);
// Supported type?
PageContentCollectionFactory* collFact = mgr->getContentCollectionFactory(factoryName);
if (collFact)
{
PageContentCollection* collInst = collFact->createInstance();
if (collInst->prepare(stream)) // read type-specific data
{
dataToPopulate->collectionsToAdd.push_back(collInst);
}
else
{
LogManager::getSingleton().stream() << "Error preparing PageContentCollection type: "
<< factoryName << " in " << *this;
collFact->destroyInstance(collInst);
}
}
else
{
LogManager::getSingleton().stream() << "Unsupported PageContentCollection type: "
<< factoryName << " in " << *this;
// skip
stream.readChunkEnd(collChunk->id);
}
}
mModified = false;
return true;
}