本文整理汇总了C++中TEntry类的典型用法代码示例。如果您正苦于以下问题:C++ TEntry类的具体用法?C++ TEntry怎么用?C++ TEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OstTraceFunctionEntry0
/**
Check if we can move the file to the new location
*/
TMTPResponseCode CMTPMoveObject::CanMoveObjectL(const TDesC& aOldName, const TDesC& aNewName) const
{
OstTraceFunctionEntry0( CMTPMOVEOBJECT_CANMOVEOBJECTL_ENTRY );
TMTPResponseCode result = EMTPRespCodeOK;
TEntry fileEntry;
LEAVEIFERROR(iFramework.Fs().Entry(aOldName, fileEntry),
OstTraceExt1( TRACE_ERROR, DUP1_CMTPMOVEOBJECT_CANMOVEOBJECTL, "can't get entry details from %S", aOldName));
TInt drive(iFramework.StorageMgr().DriveNumber(iStorageId));
LEAVEIFERROR(drive,
OstTrace1( TRACE_ERROR, DUP2_CMTPMOVEOBJECT_CANMOVEOBJECTL, "can't get driver number for storage %d", iStorageId));
TVolumeInfo volumeInfo;
LEAVEIFERROR(iFramework.Fs().Volume(volumeInfo, drive),
OstTrace1( TRACE_ERROR, DUP3_CMTPMOVEOBJECT_CANMOVEOBJECTL, "can't get volume info for drive %d", drive));
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
if(volumeInfo.iFree < fileEntry.FileSize())
#else
if(volumeInfo.iFree < fileEntry.iSize)
#endif
{
result = EMTPRespCodeStoreFull;
}
else if (BaflUtils::FileExists(iFramework.Fs(), aNewName))
{
result = EMTPRespCodeInvalidParentObject;
}
OstTraceFunctionExit0( CMTPMOVEOBJECT_CANMOVEOBJECTL_EXIT );
OstTrace1( TRACE_NORMAL, CMTPMOVEOBJECT_CANMOVEOBJECTL, "response code 0x%04X", result );
return result;
}
示例2: spec
void CStateDownload::ScanDirectory(RFs& aFs, const TDesC& aDir, const TDesC& aWild, CDesCArray* aFilesArray)
{
TParse parse;
parse.Set(aWild, &aDir, NULL);
TPtrC spec(parse.FullName());
TFindFile FindFile(aFs);
CDir* dir;
if (FindFile.FindWildByPath(parse.FullName(), NULL, dir) == KErrNone)
{
CleanupStack::PushL(dir);
TInt count=dir->Count();
for(TInt i = 0; i < count; i++)
{
parse.Set((*dir)[i].iName, &spec, NULL);
TEntry entry;
if(aFs.Entry(parse.FullName(),entry) == KErrNone)
{
if(!entry.IsDir())
{
//InsertIsqL raises a KErrAlreadyExists (-11) when inserting a duplicate
TRAPD(err,aFilesArray->InsertIsqL(parse.FullName()));
}
}
}
CleanupStack::PopAndDestroy(dir);
}
}
示例3: OstTraceFunctionEntry0
/**
Check if we can copy the file to the new location
*/
TMTPResponseCode CMTPImageDpCopyObject::CanCopyObjectL(const TDesC& aOldName, const TDesC& aNewName) const
{
OstTraceFunctionEntry0( CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL_ENTRY );
TMTPResponseCode result = EMTPRespCodeOK;
TEntry fileEntry;
LEAVEIFERROR(iFramework.Fs().Entry(aOldName, fileEntry),
OstTraceExt2( TRACE_ERROR, DUP1_CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL,
"Gets the entry details for %S failed! error code %d", aOldName, munged_err ));
TDriveNumber drive(static_cast<TDriveNumber>(iFramework.StorageMgr().DriveNumber(iStorageId)));
LEAVEIFERROR(drive,
OstTraceExt2( TRACE_ERROR, DUP2_CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL,
"Gets drive for storage %d failed! error code %d", iStorageId, munged_err ));
TVolumeInfo volumeInfo;
LEAVEIFERROR(iFramework.Fs().Volume(volumeInfo, drive),
OstTraceExt2( TRACE_ERROR, DUP3_CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL,
"Gets volume information for driver %d failed! error code %d", drive, munged_err ));
if(volumeInfo.iFree < fileEntry.FileSize())
{
result = EMTPRespCodeStoreFull;
}
else if (BaflUtils::FileExists(iFramework.Fs(), aNewName))
{
result = EMTPRespCodeInvalidParentObject;
}
OstTrace1( TRACE_NORMAL, CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL,
"CanCopyObjectL - Exit with response code 0x%04X", result );
OstTraceFunctionExit0( CMTPIMAGEDPCOPYOBJECT_CANCOPYOBJECTL_EXIT );
return result;
}
示例4: PRINT
// -----------------------------------------------------------------------------
// CGetPartialObject::VerifyParametersL
// Verify if the parameter of the request (i.e. offset) is good.
// -----------------------------------------------------------------------------
//
TBool CGetPartialObject::VerifyParametersL()
{
PRINT( _L( "MM MTP => CGetPartialObject::VerifyParametersL" ) );
__ASSERT_DEBUG( iRequestChecker, Panic( EMmMTPDpRequestCheckNull ) );
TBool result = EFalse;
iObjectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 );
iOffset = Request().Uint32( TMTPTypeRequest::ERequestParameter2 );
iPartialDataLength = Request().Uint32( TMTPTypeRequest::ERequestParameter3 );
PRINT3( _L( "MM MTP <> CGetPartialObject::VerifyParametersL iObjectHandle = 0x%x, iOffset = 0x%x, iMaxLength = 0x%x " ),
iObjectHandle,
iOffset,
iPartialDataLength );
//get object info, but do not have the ownship of the object
CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo( iObjectHandle );
__ASSERT_DEBUG( objectInfo, Panic( EMmMTPDpObjectNull ) );
const TDesC& suid( objectInfo->DesC( CMTPObjectMetaData::ESuid ) );
PRINT1( _L( "MM MTP <> CGetPartialObject::VerifyParametersL suid = %S" ), &suid );
TEntry fileEntry;
User::LeaveIfError( iFramework.Fs().Entry( suid, fileEntry ) );
if ( iOffset < fileEntry.FileSize() )
{
result = ETrue;
}
PRINT1( _L( "MM MTP <= CGetPartialObject::VerifyParametersL result = %d" ), result );
return result;
}
示例5: fillFromTEntry
void QFileSystemMetaData::fillFromTEntry(const TEntry& entry)
{
entryFlags &= ~(QFileSystemMetaData::SymbianTEntryFlags);
knownFlagsMask |= QFileSystemMetaData::SymbianTEntryFlags;
//Symbian doesn't have unix type file permissions
entryFlags |= QFileSystemMetaData::ReadPermissions;
if(!entry.IsReadOnly()) {
entryFlags |= QFileSystemMetaData::WritePermissions;
}
//set the type
if(entry.IsDir())
entryFlags |= (QFileSystemMetaData::DirectoryType | QFileSystemMetaData::ExecutePermissions);
else
entryFlags |= QFileSystemMetaData::FileType;
//set the attributes
entryFlags |= QFileSystemMetaData::ExistsAttribute;
if(entry.IsHidden())
entryFlags |= QFileSystemMetaData::HiddenAttribute;
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
size_ = entry.FileSize();
#else
size_ = (TUint)(entry.iSize);
#endif
modificationTime_ = entry.iModified;
}
示例6: RDEBUG
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::DeleteFileL
// ----------------------------------------------------------------------------------------
void CTerminalControlServer::DeleteFileL( const TDesC8 &aFileName )
{
RDEBUG("CTerminalControlServer::DeleteFileL");
RFs fs;
User::LeaveIfError(fs.Connect());
CleanupClosePushL( fs );
HBufC *fileName = HBufC::NewLC( aFileName.Length()+1 );
TPtr fnptr( fileName->Des() );
fnptr.Copy(aFileName);
TEntry entry;
User::LeaveIfError( fs.Entry( fnptr, entry ) );
if( entry.IsDir() )
{
if(fnptr.Right(1) != _L("\\"))
{
fnptr.Append(_L("\\"));
}
User::LeaveIfError(fs.RmDir( fnptr ) );
}
else
{
User::LeaveIfError(fs.Delete( fnptr ) );
}
CleanupStack::PopAndDestroy( fileName );
CleanupStack::PopAndDestroy( &fs );
}
示例7: DeleteFile
TInt CFileEngine::DeleteFile(const TDesC& aPath)
{
TInt returnErr=0;
CDir* dir;
TInt err=iFs.GetDir(aPath,KEntryAttNormal|KEntryAttDir|KEntryAttHidden,ESortByDate,dir);
if(err==KErrNone)
{
TInt tempInt = dir->Count();
for(TInt i = 0;i < tempInt;i++)
{
TEntry iEntry = (*dir)[i];
if(iEntry.IsDir())
{
TInt iLength=iEntry.iName.Length();
if(iLength>0)
{
TFileName filePath;
filePath.Append(aPath);
filePath.Append(iEntry.iName);
filePath.Append(_L("\\"));
DeleteFile(filePath);
}
}
else
{
TFileName filePath;
filePath.Append(aPath);
filePath.Append(iEntry.iName);
returnErr=BaflUtils::DeleteFile(iFs,filePath);
}
}
}
else
{
returnErr=err;
}
if(dir)
{
delete dir;
dir=NULL;
}
returnErr=iFs.RmDir(aPath);
return returnErr;
}
示例8: PRINT2
// -----------------------------------------------------------------------------
// CMoveObject::CanMoveObjectL
// Check if we can move the file to the new location
// -----------------------------------------------------------------------------
//
TMTPResponseCode CMoveObject::CanMoveObjectL( const TDesC& aOldName,
const TDesC& aNewName ) const
{
PRINT2( _L( "MM MTP => CMoveObject::CanMoveObjectL aOldName = %S, aNewName = %S" ),
&aOldName,
&aNewName );
TMTPResponseCode result = EMTPRespCodeOK;
TEntry fileEntry;
User::LeaveIfError( iFramework.Fs().Entry( aOldName, fileEntry ) );
TInt drive = iFramework.StorageMgr().DriveNumber( iStorageId );
User::LeaveIfError( drive );
TVolumeInfo volumeInfo;
User::LeaveIfError( iFramework.Fs().Volume( volumeInfo, drive ) );
if ( volumeInfo.iFree < fileEntry.FileSize() )
{
result = EMTPRespCodeStoreFull;
}
else if ( BaflUtils::FileExists( iFramework.Fs(), aNewName ) )
{
#ifdef MMMTPDP_REPLACE_EXIST_FILE
// delete the old one and replace
TInt delErr = iFramework.Fs().Delete( aNewName );
PRINT1( _L( "MM MTP <> CMoveObject::CanMoveObjectL delErr = %d" ), delErr );
// delete from the metadata DB
TRAPD( err, iFramework.ObjectMgr().RemoveObjectL( aNewName ) );
PRINT1( _L( "MM MTP <> CMoveObject::CanMoveObjectL err = %d" ), err );
// delete from video/mpx DB
CMTPObjectMetaData* objectInfo = CMTPObjectMetaData::NewLC(); // + objectInfo
if ( iFramework.ObjectMgr().ObjectL( aNewName, *objectInfo ) )
{
TRAP( err, iDpConfig.GetWrapperL().DeleteObjectL( aNewName,
objectInfo->Uint( CMTPObjectMetaData::EFormatCode ) ) );
}
CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo
if ( err )
{
// do nothing
}
#else
result = EMTPRespCodeInvalidParentObject;
#endif
}
PRINT1( _L( "MM MTP <= CMoveObject::CanMoveObjectL result = 0x%x" ), result );
return result;
}
示例9: Test3
LOCAL_C void Test3()
//
// Test RFs::Entry()
//
{
test.Next(_L("Use RFs::EntryL() to check files"));
TEntry entry;
TInt r=TheFs.Entry(_L("UIDCHKNO.SHT"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHKNO.SHT"));
test(entry.IsTypeValid()==EFalse);
r=TheFs.Entry(_L("UIDCHKNO.LNG"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHKNO.LNG"));
test(entry.IsTypeValid()==EFalse);
r=TheFs.Entry(_L("UIDCHK.MSG"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHK.MSG"));
test(entry.IsTypeValid());
test(entry.iType[0]==TUid::Uid('X') && entry.iType[1]==TUid::Uid('Y') && entry.iType[2]==TUid::Uid('Z'));
r=TheFs.Entry(_L("UIDCHK.BLG"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHK.BLG"));
test(entry.IsTypeValid());
test(entry.iType[0]==TUid::Uid('U') && entry.iType[1]==TUid::Uid('I') && entry.iType[2]==TUid::Uid('D'));
r=TheFs.Entry(_L("UIDCHK.DAT"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDCHK.DAT"));
test(entry.IsTypeValid());
test(entry.iType[0]==TUid::Uid('D') && entry.iType[1]==TUid::Uid('A') && entry.iType[2]==TUid::Uid('T'));
r=TheFs.Entry(_L("UIDWINS.PE"),entry);
test_KErrNone(r);
test(entry.iName==_L("UIDWINS.PE"));
#if defined(__WINS__)
TFileName sessionPath;
TheFs.SessionPath(sessionPath);
if (sessionPath[0]!='C')
test(entry.IsTypeValid()==EFalse);
else
{
test(entry.IsTypeValid());
test(entry.iType[0]==TUid::Uid(0x1000007a) && entry.iType[1]==TUid::Uid(2) && entry.iType[2]==TUid::Uid(3));
}
#else
test(entry.IsTypeValid()==EFalse);
#endif
}
示例10: ResetAttributes
// ---------------------------------------------------------------------------
// CRfsFileMan::ResetAttributes
// ---------------------------------------------------------------------------
//
void CRfsFileMan::ResetAttributes( const TDesC& aFullPath, const TEntry& aEntry )
{
FUNC_LOG;
if ( aEntry.IsReadOnly() )
{
TInt err = iFs.SetEntry(
aFullPath, aEntry.iModified, 0, KEntryAttReadOnly | KEntryAttHidden );
ERROR( err, "Failed to reset attributes" );
}
}
示例11: AKNS_TRACE_DEBUG
// ---------------------------------------------------------------------------
// Scan directory for files.
// ---------------------------------------------------------------------------
//
void CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL(
const TDesC& aRootDir )
{
AKNS_TRACE_DEBUG("CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL" );
CDirScan *dirScan = CDirScan::NewLC( iFsSession );
dirScan->SetScanDataL(
aRootDir,
KEntryAttNormal | KEntryAttHidden | KEntryAttSystem |
KEntryAttDir,
ESortNone );
// Fetch all directories and files from root.
CDir* entryList = NULL;
TParse parse;
for(;;)
{
TRAPD( err, dirScan->NextL( entryList ) );
// Stop in error case, or if no more data.
if (!entryList || ( err != KErrNone) )
{
break;
}
for (TInt i=0; i < entryList->Count(); i++)
{
TEntry entry = (*entryList)[i];
const TDesC& dir = dirScan->FullPath();
parse.Set( entry.iName, &dir, NULL );
if ( !entry.IsDir() )
{
iFileArray.Append( parse );
}
}
delete entryList;
}
AKNS_TRACE_DEBUG1("CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL noFiles=%d", iFileArray.Count() );
// Destroy the list.
CleanupStack::PopAndDestroy( dirScan );
}
示例12: FormatEntry
void FormatEntry(TDes& aBuffer, const TEntry& aEntry)
{
_LIT(KEntryDetails,"Entry details: ");
_LIT(KReadOnly," Read-only");
_LIT(KHidden," Hidden");
_LIT(KSystem," System");
_LIT(KDirectory," Directory");
_LIT(KArchive," Archive");
_LIT(KNewLIne,"\n");
aBuffer.Append(KEntryDetails);
if(aEntry.IsReadOnly())
aBuffer.Append(KReadOnly);
if(aEntry.IsHidden())
aBuffer.Append(KHidden);
if(aEntry.IsSystem())
aBuffer.Append(KSystem);
if(aEntry.IsDir())
aBuffer.Append(KDirectory);
if(aEntry.IsArchive())
aBuffer.Append(KArchive);
aBuffer.Append(KNewLIne);
}
示例13: GetFileType
void CImageReader::GetFileType(const TDesC& aFileName, TDes8& aFileType)
{
TEntry FileEntry;
if(CCoeEnv::Static()->FsSession().Entry(aFileName,FileEntry) == KErrNone)
{
TBuf8<255> FileBuffer;
if(!FileEntry.IsDir())
{
TInt FileSize = FileEntry.iSize;
if(FileSize > 255)
{
FileSize = 255;
}
if(CCoeEnv::Static()->FsSession().ReadFileSection(aFileName,0,FileBuffer,FileSize) == KErrNone)
{
RApaLsSession RSession;
if(RSession.Connect() == KErrNone)
{
TDataRecognitionResult FileDataType;
RSession.RecognizeData(aFileName,FileBuffer,*&FileDataType);
// if(FileDataType.iConfidence > aResult.iConfidence)
// {
aFileType.Copy(FileDataType.iDataType.Des8());
// }
RSession.Close();
}
}
}
}
}
示例14: OstTraceFunctionEntry0
/**
Check the GetPartialObject reqeust
@return EMTPRespCodeOK if the request is good, otherwise, one of the error response codes
*/
TMTPResponseCode CMTPGetPartialObject::CheckRequestL()
{
OstTraceFunctionEntry0( CMTPGETPARTIALOBJECT_CHECKREQUESTL_ENTRY );
TMTPResponseCode result = CMTPRequestProcessor::CheckRequestL();
if(result == EMTPRespCodeOK)
{
TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
iOffset = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
iLength = Request().Uint32(TMTPTypeRequest::ERequestParameter3);
//does not take ownership
iObjectInfo = iRequestChecker->GetObjectInfo(objectHandle);
if (!iObjectInfo)
{
// The object handle has already been checked, so an invalid handle can
// only occur if it was invalidated during a context switch between
// the validation time and now.
result = EMTPRespCodeInvalidObjectHandle;
}
else
{
TEntry fileEntry;
LEAVEIFERROR(iFramework.Fs().Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry),
OstTraceExt1(TRACE_ERROR, CMTPGETPARTIALOBJECT_CHECKREQUESTL,
"can't get entry details for %S!", iObjectInfo->DesC(CMTPObjectMetaData::ESuid)));
if((iOffset >= fileEntry.FileSize()))
{
result = EMTPRespCodeInvalidParameter;
}
}
}
OstTraceFunctionExit0( CMTPGETPARTIALOBJECT_CHECKREQUESTL_EXIT );
return result;
}
示例15: Delete
// ---------------------------------------------------------------------------
// CRfsFileMan::Delete
// ---------------------------------------------------------------------------
//
TInt CRfsFileMan::Delete( const TDesC& aFullPath, const TEntry& aEntry )
{
FUNC_LOG;
INFO_1( "Delete '%S'", &aFullPath );
TBool isDir( aEntry.IsDir() );
TInt err( isDir ? iFs.RmDir( aFullPath ) : iFs.Delete( aFullPath ) );
if ( err == KErrAccessDenied )
{
ResetAttributes( aFullPath, aEntry );
err = isDir ? iFs.RmDir( aFullPath ) : iFs.Delete( aFullPath );
}
ERROR_1( err, "Failed to delete '%S'", &aFullPath );
return err;
}