本文整理汇总了C++中CBoolVector::Reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ CBoolVector::Reserve方法的具体用法?C++ CBoolVector::Reserve怎么用?C++ CBoolVector::Reserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBoolVector
的用法示例。
在下文中一共展示了CBoolVector::Reserve方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadByte
void CInArchive::ReadBoolVector2(int numItems, CBoolVector &v)
{
Byte allAreDefined = ReadByte();
if (allAreDefined == 0)
{
ReadBoolVector(numItems, v);
return;
}
v.Clear();
v.Reserve(numItems);
for (int i = 0; i < numItems; i++)
v.Add(true);
}
示例2: ReadBoolVector
void CInArchive::ReadBoolVector(int numItems, CBoolVector &v)
{
v.Clear();
v.Reserve(numItems);
Byte b = 0;
Byte mask = 0;
for (int i = 0; i < numItems; i++)
{
if (mask == 0)
{
b = ReadByte();
mask = 0x80;
}
v.Add((b & mask) != 0);
mask >>= 1;
}
}
示例3: ReadHeader
HRESULT CInArchive::ReadHeader(
DECL_EXTERNAL_CODECS_LOC_VARS
CArchiveDatabaseEx &db
#ifndef _NO_CRYPTO
, ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
#endif
)
{
UInt64 type = ReadID();
if (type == NID::kArchiveProperties)
{
ReadArchiveProperties(db.ArchiveInfo);
type = ReadID();
}
CObjectVector<CByteBuffer> dataVector;
if (type == NID::kAdditionalStreamsInfo)
{
HRESULT result = ReadAndDecodePackedStreams(
EXTERNAL_CODECS_LOC_VARS
db.ArchiveInfo.StartPositionAfterHeader,
db.ArchiveInfo.DataStartPosition2,
dataVector
#ifndef _NO_CRYPTO
, getTextPassword, passwordIsDefined
#endif
);
RINOK(result);
db.ArchiveInfo.DataStartPosition2 += db.ArchiveInfo.StartPositionAfterHeader;
type = ReadID();
}
CRecordVector<UInt64> unpackSizes;
CRecordVector<bool> digestsDefined;
CRecordVector<UInt32> digests;
if (type == NID::kMainStreamsInfo)
{
ReadStreamsInfo(&dataVector,
db.ArchiveInfo.DataStartPosition,
db.PackSizes,
db.PackCRCsDefined,
db.PackCRCs,
db.Folders,
db.NumUnpackStreamsVector,
unpackSizes,
digestsDefined,
digests);
db.ArchiveInfo.DataStartPosition += db.ArchiveInfo.StartPositionAfterHeader;
type = ReadID();
}
else
{
for (int i = 0; i < db.Folders.Size(); i++)
{
db.NumUnpackStreamsVector.Add(1);
CFolder &folder = db.Folders[i];
unpackSizes.Add(folder.GetUnpackSize());
digestsDefined.Add(folder.UnpackCRCDefined);
digests.Add(folder.UnpackCRC);
}
}
db.Files.Clear();
if (type == NID::kEnd)
return S_OK;
if (type != NID::kFilesInfo)
ThrowIncorrect();
CNum numFiles = ReadNum();
db.Files.Reserve(numFiles);
CNum i;
for (i = 0; i < numFiles; i++)
db.Files.Add(CFileItem());
db.ArchiveInfo.FileInfoPopIDs.Add(NID::kSize);
if (!db.PackSizes.IsEmpty())
db.ArchiveInfo.FileInfoPopIDs.Add(NID::kPackInfo);
if (numFiles > 0 && !digests.IsEmpty())
db.ArchiveInfo.FileInfoPopIDs.Add(NID::kCRC);
CBoolVector emptyStreamVector;
emptyStreamVector.Reserve((int)numFiles);
for (i = 0; i < numFiles; i++)
emptyStreamVector.Add(false);
CBoolVector emptyFileVector;
CBoolVector antiFileVector;
CNum numEmptyStreams = 0;
for (;;)
{
UInt64 type = ReadID();
if (type == NID::kEnd)
break;
UInt64 size = ReadNumber();
size_t ppp = _inByteBack->_pos;
bool addPropIdToList = true;
//.........这里部分代码省略.........