本文整理汇总了C++中plKey::GetStartPos方法的典型用法代码示例。如果您正苦于以下问题:C++ plKey::GetStartPos方法的具体用法?C++ plKey::GetStartPos怎么用?C++ plKey::GetStartPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plKey
的用法示例。
在下文中一共展示了plKey::GetStartPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IRewritePage
void plPageOptimizer::IRewritePage()
{
hsUNIXStream newPage;
if (newPage.Open(fTempPagePath, "wb"))
{
hsUNIXStream oldPage;
oldPage.Open(fPagePath);
const plPageInfo& pageInfo = fPageNode->GetPageInfo();
uint32_t dataStart = pageInfo.GetDataStart();
fBuf.resize(dataStart);
oldPage.Read(dataStart, &fBuf[0]);
newPage.Write(dataStart, &fBuf[0]);
int size = (int)fKeyLoadOrder.size();
for (int i = 0; i < size; i++)
IWriteKeyData(&oldPage, &newPage, fKeyLoadOrder[i]);
// If there are any objects that we didn't write (because they didn't load for
// some reason), put them at the end
for (int i = 0; i < fAllKeys.size(); i++)
{
bool found = (fLoadedKeys.find(fAllKeys[i]) != fLoadedKeys.end());
if (!found)
IWriteKeyData(&oldPage, &newPage, fAllKeys[i]);
}
uint32_t newKeyStart = newPage.GetPosition();
uint32_t oldKeyStart = pageInfo.GetIndexStart();
oldPage.SetPosition(oldKeyStart);
uint32_t numTypes = oldPage.ReadLE32();
newPage.WriteLE32(numTypes);
for (uint32_t i = 0; i < numTypes; i++)
{
uint16_t classType = oldPage.ReadLE16();
uint32_t len = oldPage.ReadLE32();
uint8_t flags = oldPage.ReadByte();
uint32_t numKeys = oldPage.ReadLE32();
newPage.WriteLE16(classType);
newPage.WriteLE32(len);
newPage.WriteByte(flags);
newPage.WriteLE32(numKeys);
for (uint32_t j = 0; j < numKeys; j++)
{
plUoid uoid;
uoid.Read(&oldPage);
uint32_t startPos = oldPage.ReadLE32();
uint32_t dataLen = oldPage.ReadLE32();
// Get the new start pos
plKeyImp* key = (plKeyImp*)fResMgr->FindKey(uoid);
startPos = key->GetStartPos();
uoid.Write(&newPage);
newPage.WriteLE32(startPos);
newPage.WriteLE32(dataLen);
}
}
newPage.Close();
oldPage.Close();
}
}