本文整理汇总了C++中MemChunk::exportMemChunk方法的典型用法代码示例。如果您正苦于以下问题:C++ MemChunk::exportMemChunk方法的具体用法?C++ MemChunk::exportMemChunk怎么用?C++ MemChunk::exportMemChunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemChunk
的用法示例。
在下文中一共展示了MemChunk::exportMemChunk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open
//.........这里部分代码省略.........
// Guess number of lumps
uint32_t num_lumps = dir_len / 16;
// Stop announcements (don't want to be announcing modification due to entries being added etc)
setMuted(true);
// Read each entry
theSplashWindow->setProgressMessage("Reading lfd archive data");
size_t offset = dir_len + 16;
size_t size = mc.getSize();
for (uint32_t d = 0; offset < size; d++)
{
// Update splash window progress
theSplashWindow->setProgress(((float)d / (float)num_lumps));
// Read lump info
uint32_t length = 0;
char type[5] = "";
char name[9] = "";
mc.read(type, 4); // Type
mc.read(name, 8); // Name
mc.read(&length, 4); // Size
name[8] = '\0'; type[4] = 0;
// Move past the header
offset += 16;
// Byteswap values for big endian if needed
length = wxINT32_SWAP_ON_BE(length);
// If the lump data goes past the end of the file,
// the gobfile is invalid
if (offset + length > size)
{
wxLogMessage("LfdArchive::open: lfd archive is invalid or corrupt");
Global::error = "Archive is invalid and/or corrupt";
setMuted(false);
return false;
}
// Create & setup lump
wxFileName fn(name);
fn.SetExt(type);
ArchiveEntry* nlump = new ArchiveEntry(fn.GetFullName(), length);
nlump->setLoaded(false);
nlump->exProp("Offset") = (int)offset;
nlump->setState(0);
// Add to entry list
getRoot()->addEntry(nlump);
// Move to next entry
offset += length;
mc.seek(offset, SEEK_SET);
}
if (num_lumps != numEntries())
wxLogMessage("Warning: computed %i lumps, but actually %i entries", num_lumps, numEntries());
// Detect all entry types
MemChunk edata;
theSplashWindow->setProgressMessage("Detecting entry types");
for (size_t a = 0; a < numEntries(); a++)
{
// Update splash window progress
theSplashWindow->setProgress((((float)a / (float)num_lumps)));
// Get entry
ArchiveEntry* entry = getEntry(a);
// Read entry data if it isn't zero-sized
if (entry->getSize() > 0)
{
// Read the entry data
mc.exportMemChunk(edata, getEntryOffset(entry), entry->getSize());
entry->importMemChunk(edata);
}
// Detect entry type
EntryType::detectEntryType(entry);
// Unload entry data if needed
if (!archive_load_data)
entry->unloadData();
// Set entry to unchanged
entry->setState(0);
}
// Setup variables
setMuted(false);
setModified(false);
announce("opened");
theSplashWindow->setProgressMessage("");
return true;
}