本文整理汇总了C++中HBufC::LocateReverse方法的典型用法代码示例。如果您正苦于以下问题:C++ HBufC::LocateReverse方法的具体用法?C++ HBufC::LocateReverse怎么用?C++ HBufC::LocateReverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBufC
的用法示例。
在下文中一共展示了HBufC::LocateReverse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DecompressNextMemberL
void CZipFileDecompressor::DecompressNextMemberL(CZipFileMember& aMember)
{
__ASSERT_ALWAYS(!iUncompressedFile.SubSessionHandle(),
User::Invariant());
__ASSERT_ALWAYS(!iUncompressedData, User::Invariant());
//Ignore entries that has zero uncompressed size.
//(This includes e.g. directories)
if (aMember.UncompressedSize() > 0)
{
const TChar KDirectorySeparator('\\');
TUint32 uncompressedSize = aMember.UncompressedSize();
HBufC8* uncompressedData = HBufC8::NewLC(uncompressedSize);
RZipFileMemberReaderStream* readerStream;
User::LeaveIfError(iZipFile->GetInputStreamL(&aMember, readerStream));
CleanupStack::PushL(readerStream);
TPtr8 uncompressedDataPtr = uncompressedData->Des();
User::LeaveIfError(readerStream->Read(uncompressedDataPtr,
uncompressedDataPtr.MaxLength()));
CleanupStack::PopAndDestroy(readerStream);
HBufC* fileName = aMember.Name()->AllocLC();
TPtr fileNamePtr= fileName->Des();
TInt lastDirectorySeparator = fileName->LocateReverse(KDirectorySeparator);
if (lastDirectorySeparator >= 0)
{
fileNamePtr = fileName->Mid(lastDirectorySeparator+1);
}
TParsePtr fileNameParser(fileNamePtr);
User::LeaveIfError(iUncompressedFile.Replace(iFileServer,
fileNameParser.NameAndExt(),
EFileWrite));
CleanupStack::PopAndDestroy(fileName);
CleanupStack::Pop(uncompressedData);
iUncompressedData = uncompressedData;
iUncompressedFile.Write(*iUncompressedData, iStatus);
SetActive();
}
else
{
iStatus = KRequestPending;
SetActive();
TRequestStatus* ownStatus = &iStatus;
User::RequestComplete(ownStatus, KErrNone);
}
}
示例2: bufferPtr
TBool WidgetUnzipUtilityS60::RunUnzipL()
{
CZipFileMember* member = iMembers->NextL();
if (member)
{
CleanupStack::PushL(member);
RZipFileMemberReaderStream* stream;
User::LeaveIfError(iZipFile->GetInputStreamL(member, stream));
CleanupStack::PushL(stream);
HBufC8* buffer = HBufC8::NewLC(member->UncompressedSize());
TPtr8 bufferPtr(buffer->Des());
User::LeaveIfError(stream->Read(bufferPtr, member->UncompressedSize()));
TFileName text;
text.Copy(*iTempZipPath);
text.Append(_L('\\'));
text.Append(*member->Name());
HBufC* zipedFileNameAndPath = text.AllocLC();
TInt index = zipedFileNameAndPath->LocateReverse('\\');
if (index >= 0)
{
TPtrC path = zipedFileNameAndPath->Left(index + 1);
iFs.MkDirAll(path); // errors are ok
}
if (zipedFileNameAndPath->Right(1).Compare(_L('\\')) != 0)
{
RFile file;
CleanupClosePushL(file);
file.Replace(iFs,*zipedFileNameAndPath,EFileWrite);
User::LeaveIfError(file.Write(*buffer));
CleanupStack::PopAndDestroy(); // file
}
iUncompressedSize += member->UncompressedSize();
CleanupStack::PopAndDestroy(4);
return ETrue;
}
else
{
return EFalse;
}
}