本文整理汇总了C++中TParse::ExtPresent方法的典型用法代码示例。如果您正苦于以下问题:C++ TParse::ExtPresent方法的具体用法?C++ TParse::ExtPresent怎么用?C++ TParse::ExtPresent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TParse
的用法示例。
在下文中一共展示了TParse::ExtPresent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CleanCachedPage
void CResourceManager::CleanCachedPage(nid aPageId)
{
int len = GetCachePath().Length();
HBufC* cache = HBufC::New(len + 64);
TPtr p = cache->Des();
TPtr path = GetCachePath();
p.Format(KCachePathFormat, &path, aPageId);
_LIT(KWildName, "*.*");
RFs& fs = CCoeEnv::Static()->FsSession();
TFindFile file_finder(fs);
CDir* file_list;
TInt err = file_finder.FindWildByDir(KWildName, p, file_list);
while (err == KErrNone) {
for (TInt i = 0; i < file_list->Count(); i++) {
if ((*file_list)[i].IsDir())
continue;
TParse fullentry;
fullentry.Set((*file_list)[i].iName, &file_finder.File(), NULL);
if (fullentry.ExtPresent()) {
err = fs.Delete(fullentry.FullName());
}
else {
TFileName filename;
filename.Append(fullentry.DriveAndPath());
filename.Append(fullentry.Name());
err = fs.Delete(filename);
}
}
delete file_list;
err = file_finder.FindWild(file_list);
}
err = fs.RmDir(p);
delete cache;
}
示例2: ConstructL
//.........这里部分代码省略.........
fileInit = ETrue;
drmContent = ETrue;
iCAFParameters->iEnableUI = stream.ReadInt32L();
}
else if (initUid == KMMFileSourceUid)
{
TInt length;
length = stream.ReadInt32L();
filename = HBufC::NewMaxLC(length);
TPtr ptr = filename->Des();
stream.ReadL(ptr, length);
length = stream.ReadInt32L();
if (length>0)
{
iCAFParameters->iUniqueId = HBufC::NewMaxL(length);
ptr.Set(iCAFParameters->iUniqueId->Des());
stream.ReadL(ptr, length);
}
CleanupStack::Pop(filename);
fileInit = ETrue;
drmContent = ETrue;
iFileHandle = EFalse;
iCAFParameters->iEnableUI = stream.ReadInt32L();
}
else
{
// TODO If the UID is unknown we should reject, but currently
// code also used for older calls that just supply filename.
// User::Leave(KErrNotSupported);
}
CleanupStack::PopAndDestroy(&stream);
if (!fileInit && aInitData.Length() == sizeof(TMMFFileHandleParams))
{
TMMFFileHandleParams params;
TPckgC<TMMFFileHandleParams> config(params);
config.Set(aInitData);
params = config();
if (params.iUid == KFileHandleUid)
{
fileInit = ETrue;
User::LeaveIfError(iHandle.Duplicate(*params.iFile));
TInt pos = 0;
// make sure the duplicate handle is at the start of the file - the usage of the file handle really requires this
User::LeaveIfError(iHandle.Seek(ESeekStart, pos));
iFileHandle = ETrue;
filename = HBufC::NewMaxLC(KMaxFileName);
filenamePushed = ETrue;
TPtr ptr = filename->Des();
User::LeaveIfError(iHandle.Name(ptr));
}
}
if (!fileInit) // do old case as last resort
{
TMMFFileParams params;
TPckgC<TMMFFileParams> config(params);
config.Set(aInitData);
params = config();
filename = params.iPath.AllocL();
fileInit = ETrue;
}
if (!filenamePushed)
{
// from now on it is assumed pushed.
CleanupStack::PushL(filename);
}
TParse parser ;
User::LeaveIfError(parser.Set(*filename, NULL, NULL));
CleanupStack::PopAndDestroy(filename);
if ( !( parser.NamePresent() ) && !( parser.ExtPresent() ) )
User::Leave( KErrBadName ) ;
iFullFileName.Copy( parser.FullName() ) ;
iFileName = parser.Name().AllocL() ;
iFileExt = parser.Ext().AllocL() ;
iFilePath = parser.Path().AllocL() ;
iFileDrive = parser.Drive().AllocL() ;
// in order to simulate old behaviour we are not passing error out
// but will try to create Content again during PrimeL()
if (fileInit && drmContent && aFileMode==ESourceMode)
{
TInt contentError;
if (iFileHandle)
{
TRAP(contentError,
iFile = CContentFile::NewL(iHandle, UniqueId(), iCAFParameters->iEnableUI);
);
}