本文整理汇总了C++中SeekableReadStream::readUint16LE方法的典型用法代码示例。如果您正苦于以下问题:C++ SeekableReadStream::readUint16LE方法的具体用法?C++ SeekableReadStream::readUint16LE怎么用?C++ SeekableReadStream::readUint16LE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SeekableReadStream
的用法示例。
在下文中一共展示了SeekableReadStream::readUint16LE方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadHeader
void FoxPro::loadHeader(SeekableReadStream &dbf, uint32 &recordSize, uint32 &recordCount,
uint32 &firstRecordPos) {
byte version = dbf.readByte();
if (version != 0xF5)
throw Exception("Unknown database version 0x%02X", version);
int lastUpdateYear = dbf.readByte() + 2000;
int lastUpdateMonth = dbf.readByte();
int lastUpdateDay = dbf.readByte();
_lastUpdate = date(lastUpdateYear, lastUpdateMonth, lastUpdateDay);
recordCount = dbf.readUint32LE();
firstRecordPos = dbf.readUint16LE();
recordSize = dbf.readUint16LE();
dbf.skip(16); // Reserved
byte flags = dbf.readByte();
_hasIndex = flags & 0x01;
_hasMemo = (flags & 0x02) != 0;
if (flags & 0x04)
throw Exception("DBC unsupported");
if (flags & 0xF8)
throw Exception("Unknown flags 0x%02X", flags);
dbf.skip(1); // Codepage marker
dbf.skip(2); // Reserved
}
示例2: getFileProperties
void ZipFile::getFileProperties(SeekableReadStream &zip, const IFile &file,
uint16 &compMethod, uint32 &compSize, uint32 &realSize) const {
zip.seek(file.offset);
uint32 tag = zip.readUint32LE();
if (tag != 0x04034B50)
throw Exception("Unknown ZIP record %08X", tag);
zip.skip(4);
compMethod = zip.readUint16LE();
zip.skip(8);
compSize = zip.readUint32LE();
realSize = zip.readUint32LE();
uint16 nameLength = zip.readUint16LE();
uint16 extraLength = zip.readUint16LE();
zip.skip(nameLength);
zip.skip(extraLength);
}
示例3: load
void ZipFile::load(SeekableReadStream &zip) {
size_t endPos = findCentralDirectoryEnd(zip);
if (endPos == 0)
throw Exception("End of central directory record not found");
zip.seek(endPos);
zip.skip(4); // Header, already checked
uint16 curDisk = zip.readUint16LE();
uint16 centralDirDisk = zip.readUint16LE();
uint16 curDiskDirs = zip.readUint16LE();
uint16 totalDirs = zip.readUint16LE();
if ((curDisk != 0) || (curDisk != centralDirDisk) || (curDiskDirs != totalDirs))
throw Exception("Unsupported multi-disk ZIP file");
zip.skip(4); // Size of central directory
uint32 centralDirPos = zip.readUint32LE();
zip.seek(centralDirPos);
uint32 tag = zip.readUint32LE();
if (tag != 0x02014B50)
throw Exception("Unknown ZIP record %08X", tag);
_iFiles.reserve(totalDirs);
while (tag == 0x02014B50) {
File file;
IFile iFile;
zip.skip(20);
iFile.size = zip.readUint32LE();
uint16 nameLength = zip.readUint16LE();
uint16 extraLength = zip.readUint16LE();
uint16 commentLength = zip.readUint16LE();
uint16 diskNum = zip.readUint16LE();
if (diskNum != 0)
throw Exception("Unsupported multi-disk ZIP file");
zip.skip(6); // File attributes
iFile.offset = zip.readUint32LE();
file.name = readStringFixed(zip, kEncodingASCII, nameLength).toLower();
zip.skip(extraLength);
zip.skip(commentLength);
tag = zip.readUint32LE();
if ((tag != 0x02014B50) && (tag != 0x06054B50))
throw Exception("Unknown ZIP record %08X", tag);
// Ignore empty file names
if (!file.name.empty()) {
// HACK: Skip any filename with a trailing slash because it's
// a directory. The proper solution would be to interpret the
// file attributes.
if (*(--file.name.end()) != '/') {
file.index = _iFiles.size();
_files.push_back(file);
_iFiles.push_back(iFile);
}
}
}
}