本文整理汇总了C++中TBuf8::LocateF方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf8::LocateF方法的具体用法?C++ TBuf8::LocateF怎么用?C++ TBuf8::LocateF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf8
的用法示例。
在下文中一共展示了TBuf8::LocateF方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QueryDynDriveListLC
//------------------------------------------------------------------------
//CHttpDownloadManagerServerEngine::QueryDynDriveListLC
//------------------------------------------------------------------------
HBufC8* CHttpDownloadManagerServerEngine::QueryDynDriveListLC()
{
TDriveList driveList;
TInt driveCount( 0 );
TInt err;
TChar driveLetter;
TBuf8<KMaxDriveListStrLen> driveLettersDyn;
// Checking validity of drives in Cenrep List
// drive letters are separated by semicolons
// Destination is FFS in default
TInt drive;
User::LeaveIfError(
DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive ) );
for( TInt i = 0; i < iDriveLettersCenRep.Length(); i = i + 2 )
{
if( iRfs.CharToDrive( iDriveLettersCenRep[i], drive ) == KErrNone )
{
TUint status;
if ( DriveInfo::GetDriveStatus( iRfs, drive, status ) == KErrNone )
{
if ( ( status & ( DriveInfo::EDriveUserVisible | DriveInfo::EDrivePresent ) ) )
{
CLOG_WRITE_1( "Drive %d is present and visible", drive);
}
}
}
}
if ( iDriveLettersCenRep.Length() > 0 )
{
driveLettersDyn.Append( iDriveLettersCenRep );
if ( driveLettersDyn[driveLettersDyn.Length() - 1] != ';' )
{
driveLettersDyn.Append( KDefaultDriveListSep );
}
}
// get the list of drives available in real time
err = DriveInfo::GetUserVisibleDrives( iRfs, driveList, driveCount );
if ( err == KErrNone )
{
TInt count( driveList.Length() );
for ( TInt i( 0 ); i < count; ++i )
{
if ( driveList[ i ] )
{
User::LeaveIfError( iRfs.DriveToChar( i, driveLetter) );
TInt drivePos = driveLettersDyn.LocateF( driveLetter );
if ( drivePos == KErrNotFound )
{
driveLettersDyn.Append( driveLetter );
driveLettersDyn.Append( KDefaultDriveListSep );
}
}
}
CLOG_WRITE_1( "Pref. drive list dynamic: [%S]", &driveLettersDyn );
}
else
{
CLOG_WRITE_1( "GetUserVisibleDrives failed with %d", err );
}
HBufC8* driveLetters = HBufC8::NewLC( KMaxDriveListStrLen );
driveLetters->Des().Copy( driveLettersDyn );
return driveLetters;
}
示例2: ReadFromFile
// ----------------------------------------------------------------------------------------
// CFMSServer::ReadFromFile()
// ----------------------------------------------------------------------------------------
TBool CFMSServer::ReadFromFile(TInt& aReason, TInt& aBearer, TInt& aDrive, TInt& aSize
, TInt& aWcdmaBearer )
{
TInt err = iFile.Open(iFs,KFotaInterruptFileName,EFileRead);
FLOG(_L("CFMSServer::ReadFromFile() error as %d"),err);
if(err == KErrNone)
{
TInt size = KErrNone;
err = iFile.Size(size);
if(size == 0) //file empty
{
FLOG(_L("CFMSServer::ReadFromFile() file size is empty"));
iFile.Close();
return EFalse;
}
TBuf8<30> data;
iFile.Read(data);
iFile.Close();
TBuf8<30> data1;
if(data.Length()>0)
{
TInt len =0 ;
if((len=data.LocateF(',')) > 0)
{
TLex8 value( data.Left(len));
value.Val(aReason);
FLOG(_L("CFMSServer::ReadFromFile() retrieving reason as %d"),aReason);
data1.Insert(0,data.Right(data.Length()-(len+1)));
data.Zero();
// len=data1.LocateF(',');
if( data1.Length() > 0 && (len=data1.LocateF(',')) > 0)
{
value=data1.Left(len);
value.Val(aBearer);
FLOG(_L("CFMSServer::ReadFromFile() retrieving aBearer as %d"),aBearer);
data.Insert(0,data1.Right(data1.Length()-(len+1)));
data1.Zero();
// len=data.LocateF(',');
if(data.Length() > 0 && ( len=data.LocateF(','))> 0)
{
value=data.Left(len);
value.Val(aDrive);
FLOG(_L("CFMSServer::ReadFromFile() retrieving aDrive as %d"),aDrive);
data1.Insert(0,data.Right(data.Length()-(len+1)));
data.Zero();
if(data1.Length() > 0 && ( len=data1.LocateF(','))> 0 )
{
value=data1.Left(len);
value.Val(aSize);
FLOG(_L("CFMSServer::ReadFromFile() retrieving aSize as %d"),aSize);
data.Insert(0,data1.Right(data1.Length()-len-1));
data1.Zero();
if(data.Length() > 0 )
{
value=data;
value.Val(aWcdmaBearer);
FLOG(_L("CFMSServer::ReadFromFile() retrieving aWcdmaBearer as %d"),aWcdmaBearer);
}
}
}
}
}
}
}
else
{
return EFalse;
}
return ETrue;
}