本文整理汇总了C++中TBuf8::Left方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf8::Left方法的具体用法?C++ TBuf8::Left怎么用?C++ TBuf8::Left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf8
的用法示例。
在下文中一共展示了TBuf8::Left方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunL
// -----------------------------------------------------------------------------
// CContactSubscriber::RunL()
// Assyncronous request handler , on completion of notification
// -----------------------------------------------------------------------------
//
void CContactSubscriber::RunL()
{
__TRACE_CALLSTACK;
SubscribeChangeNotiFication();
// property updated, get new value
TBuf8 <KBufferSize> value;
TPtrC8 id;
TPtrC8 sourceType;
TPtrC8 addressCount;
if ( KErrNone == iProperty.Get( value ) )
{
TInt pos = value.Locate(TChar('-'));
id.Set( value.Left(pos) );
TPtrC8 ptr = value.Right(3);
sourceType.Set(ptr.Left(1));
addressCount.Set(ptr.Right(1));
TInt appId = -1, addressType = -1, addressTypeCount = -1;
TLex8 lex(id);
lex.Val(appId);
TLex8 lex1(sourceType);
lex1.Val( addressType );
TLex8 lex2(addressCount);
lex2.Val(addressTypeCount);
iNotifyChange.GetChangeNotificationL( appId, addressType,addressTypeCount );
}
}
示例2: CleanUpAndWriteResults
void CTmsTestStep::CleanUpAndWriteResults()
{
RFs fs;
fs.Connect();
CleanupClosePushL(fs);
iTestStepPositions.Close();
if (iTestStepNames != NULL)
{
iTestStepNames->Reset();
delete iTestStepNames;
iTestStepNames = NULL;
if (BaflUtils::FolderExists(fs, KLogLocation))
{
RFile file;
if (BaflUtils::FileExists( fs, KLogLocation ))
{
// open the temporary tms log
TInt err = file.Open( fs, KLogLocation, EFileRead|EFileShareAny);
if(err == KErrInUse)
{
CleanupStack::PopAndDestroy();
return;
}
if (err == KErrNone)
{
CleanupClosePushL(file);
TBuf8<256> line;
TBuf<250> testID;
TBuf<6> testResult;
// get a line from the temporary tms log
while (CTmsTestStep::ReadNextLineL(file,line))
{
TInt blankPos = line.Find(KBlankSpace);
// get the ID from the line
testID.Copy(line.Left(blankPos));
//get the pass or fail result from the line
testResult.Copy(line.Mid(blankPos+1,4));
// print into the standard tef log the id and the result in the correct format
// so that they are correctly parsed into the TMS csv file
INFO_PRINTF2(_L("START_TESTCASE %S"),&testID);
INFO_PRINTF2(_L("Line = 1 Command = START_TESTCASE %S"),&testID);
INFO_PRINTF2(_L("END_TESTCASE %S"),&testID);
INFO_PRINTF3(_L("Line = 1 Command = END_TESTCASE %S ***TestCaseResult = %S"),&testID,&testResult);
}
CleanupStack::PopAndDestroy();
}
// remove the temporary tms log
fs.Delete(KLogLocation);
}
}
}
CleanupStack::PopAndDestroy();
}
示例3: NewDecryptL
CPBDecryptor* CPBEncryptSet::NewDecryptL(void) const
{
TBuf8<KPBEMaxCipherKeyBytes> masterKey;
DecryptMasterKeyL(masterKey);
CPBDecryptor* decryptor = 0;
//make sure the masterkey we pass is exactly the right length for the cipher
decryptor = CPBDecryptorSet::NewL(iData->EncryptParms().Cipher(),
masterKey.Left(PBE::GetKeyBytes(iData->EncryptParms().Cipher())));
return decryptor;
}
示例4: Get
/** Reads a descriptor setting.
@param aKey Key of setting to be read.
@param aValue Returns the value of the setting if it is a descriptor.
@param aActualLength Returns the actual length of the setting if it is a descriptor.
@return
KErrNone if successful,
KErrNotFound if the setting does not exist,
KErrArgument if the setting exists but is not a descriptor,
KErrOverflow if the descriptor is too small to receive the value in the repository,
plus other system-wide error codes.
@post Transactions fail only on those "other system-wide error codes".
@capability Dependent Caller must satisfy the read access policy of that key in the repository.
*/
EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes8& aValue, TInt& aActualLength)
{
TBuf8<KMaxBinaryLength> val;
TInt ret = iImpl->Get(aKey, val);
if (ret==KErrNone)
{
TInt settingValueLength=val.Length();
//now check whether any string overflow
if (settingValueLength > aValue.MaxLength())
{
aActualLength=settingValueLength;
aValue.Copy(val.Left(aValue.MaxLength()));
return KErrOverflow;
}
else
{
aValue.Copy(val);
}
}
return ret;
}
示例5: GetParameterValue
TInt RMmCustomAPI::GetParameterValue(TInt aLineNumber,TInt aIndex )
{
if ( KErrNone != iFileError)
return -1;
RFile fread;
TInt lError = fread.Open(iFs,KMyFile,EFileRead);
RFileReadStream rfs(fread);
TChar delmeter(10);
TInt ret = -9999;
TInt err;
if ( KErrNone == lError )
{
for(TInt i = 0; i < aLineNumber; i++ )
{
TRAP(err,rfs.ReadL(iLineBuffer,delmeter));
if(err != KErrNone)
{
rfs.Close();
fread.Close();
return -1;
}
iLineBuffer.Copy(iLineBuffer.Left(iLineBuffer.Length() - 2 ));
}
}
TBuf8<64> restBuffer;
TInt pos = KErrNotFound;
TChar c(44); // 44 means ','
if(aIndex != -1 )
{
for(TInt i = 0; i < aIndex; i++ )
{
pos = iLineBuffer.Locate(c);
if(pos == KErrNotFound)
break;
restBuffer.Copy(iLineBuffer.Left(pos ));
iLineBuffer.Copy(iLineBuffer.Mid( pos + 1));
}
if(pos != KErrNotFound)
iLineBuffer.Copy(restBuffer);
}
if(ret == -9999)
{
pos = iLineBuffer.Locate(c);
if(pos != KErrNotFound)
{
restBuffer.Copy(iLineBuffer.Left(pos ));
iLineBuffer.Copy(restBuffer);
}
TLex8 input(iLineBuffer);
input.Val(ret);
}
rfs.Close();
fread.Close();
return ret;
#if 0
RFs fs;
RFile fread;
TInt lError = fs.Connect();
if ( KErrNone != lError )
return -1;
lError = fread.Open(fs,KMyFile,EFileRead);
RFileReadStream rfs(fread);
TBuf8<8> buf;
TChar delmeter(10);
TInt ret = -999;
TInt err;
if ( KErrNone == lError )
{
for(TInt i = 0; i < aIndex; i++ )
{
TRAP(err,rfs.ReadL(buf,delmeter));
if(err != KErrNone)
{
rfs.Close();
fread.Close();
fs.Close();
return -1;
}
buf.Copy(buf.Left(buf.Length() - 2 ));
}
}
if(ret == -999)
{
TLex8 input(buf);
input.Val(ret);
}
rfs.Close();
fread.Close();
//.........这里部分代码省略.........
示例6: ContinueExecutionL
// -----------------------------------------------------------------------------
// CLogPlayerManager::ContinueExecutionL()
// -----------------------------------------------------------------------------
//
void CLogPlayerManager::ContinueExecutionL()
{
_LIT8( KOpenDb, "OPENDB" );
_LIT8( KDefineVolume, "DEFINEVOLUME" );
_LIT8( KReset, "RESET" );
_LIT8( KFlush, "FLUSH" );
_LIT8( KAdd, "ADD" );
_LIT8( KUpdate, "UPDATE" );
_LIT8( KDelete, "DELETE" );
_LIT8( KSearch, "SEARCH" );
_LIT8( KGet, "GET" );
_LIT8( KCancel, "CANCEL" );
_LIT8( KHouseKeep, "HOUSEKEEP" );
// Note: Huge descriptor from stack. Re-use this if possible.
// TODO: Remove and use member variable iTextBuffer
TBuf8<KLogPlayerMaxTextLength> textBuffer;
// Read command
ReadTextL(iReadStream, textBuffer);
// Command: OPENDB
if (textBuffer.Compare(KOpenDb) == 0)
{
if ( iConsole )
{
iConsole->Printf(_L("OPENDB\n"));
}
TInt index = 0;
TBool isSearcher = EFalse;
HBufC* baseAppClass = ReadOpenDbL(iReadStream, index, isSearcher);
CleanupStack::PushL( baseAppClass );
if ( index == iHandle )
{
if ( isSearcher )
{
TRAP_IGNORE( iSearcher->OpenDatabaseL(*baseAppClass) );
}
else
{
TRAP_IGNORE( iIndexer->OpenDatabaseL(*baseAppClass) );
}
}
CleanupStack::PopAndDestroy( baseAppClass );
// Check if handler for this index is created
if ( iHandle == -1 && !IsHandlerCreated( index ) )
{
THandleInformation handleInformation;
handleInformation.iLogFileName = iLogFileName;
handleInformation.iFilePosition = iStartPosition.Offset();
handleInformation.iHandleId = index;
handleInformation.iStartTime = iStartTime;
iHandleInformationArray.Append( handleInformation );
// Create new thread for this new handler
// Thread name: "LogManager_" + handle id
TBuf<KMaxFileName> threadName;
_LIT( KThreadNameBase, "LogManager_" );
threadName.Append( KThreadNameBase );
threadName.AppendNum( index );
// Create thread
RThread thread;
thread.Create( threadName,
ThreadFunction,
1024*10,
0,
&iHandleInformationArray[iHandleInformationArray.Count()-1] );
thread.Resume();
}
}
// Command: DEFINEVOLUME
else if (textBuffer.Compare(KDefineVolume) == 0)
{
if ( iConsole )
{
iConsole->Printf(_L("DEFINEVOLUME\n"));
}
// Get QualifiedBaseAppClass
ReadTextL(iReadStream, textBuffer, KDefineVolumeSeparator);
HBufC* qualifiedBaseAppClass = HBufC::NewLC(textBuffer.Length());
TUint textBufferLen = textBuffer.Length() - 1; // Remove separator at end
qualifiedBaseAppClass->Des().Copy( textBuffer.Left( textBufferLen ) );
qualifiedBaseAppClass->Des().Trim();
// Get Index path
ReadTextL(iReadStream, textBuffer, KLogPlayerFieldSeparatorEndLine);
HBufC* indexDbPath = HBufC::NewLC(textBuffer.Length());
indexDbPath->Des().Copy(textBuffer);
if ( iHandle == -1 )
//.........这里部分代码省略.........
示例7: 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;
}
示例8: ConstructL
/**
ConstructL()
Parses a .txt file and creates Arrays of fields and there values
@param aFileName
Name of the file to be parsed.
*/
EXPORT_C void CT_MsgUtilsConfigFileParserUtility::ConstructL(const TDesC& aFileName)
{
RFs fileServerSession;
fileServerSession.Connect();
RFile file;
User::LeaveIfError(file.Open(fileServerSession, aFileName, EFileRead));
TInt eof = EFalse;
TInt fileOffset = 0;
TBuf8<KFileBufferSize> fileBuffer;
while (!eof)
{
fileBuffer.SetLength(0);
User::LeaveIfError(file.Read(fileOffset, fileBuffer, KFileBufferSize));
TInt read = fileBuffer.Length();
if (read < KFileBufferSize)
{
fileBuffer.Append('\n');
eof = ETrue;
}
TInt lineOverflow = fileBuffer.Locate('\n');
if ((lineOverflow == KErrNotFound) && (read == KFileBufferSize))
{
User::Leave(KErrOverflow);
}
TInt eol = EFalse;
while (!eol)
{
TInt lineFeedLocation = fileBuffer.Locate('\n');
if (lineFeedLocation == KErrNotFound)
{
eol = ETrue;
}
else
{
fileOffset += lineFeedLocation + 1;
TInt lineLength;
if ((lineFeedLocation != 0) && (fileBuffer[lineFeedLocation - 1] == '\r'))
{
lineLength = lineFeedLocation - 1;
}
else
{
lineLength = lineFeedLocation;
}
TPtrC8 line = fileBuffer.Left(lineLength);
TInt commentLocation = line.Match(KComment);
if (commentLocation != KErrNotFound)
{
TPtrC8 skipComment = line.Left(commentLocation);
line.Set(skipComment);
}
TInt seperatorLocation = line.Locate('=');
if (seperatorLocation != KErrNotFound)
{
if ((seperatorLocation == 0) || (seperatorLocation == line.Length() - 1))
{
seperatorLocation = KErrNotFound;
}
}
if (seperatorLocation != KErrNotFound)
{
TPtrC8 namePtr = line.Left(seperatorLocation);
HBufC8* nameBuf8 = HBufC8::NewL(namePtr.Length());
CleanupStack::PushL(nameBuf8);
TPtr8 name8 = nameBuf8->Des();
name8.Copy(namePtr);
name8.Trim();
HBufC* nameBuf16 = HBufC::NewL(namePtr.Length());
TPtr name16 = nameBuf16->Des();
name16.Copy(name8);
iName.Append(nameBuf16);
CleanupStack::PopAndDestroy(nameBuf8);
TPtrC8 contentPtr = line.Mid(seperatorLocation + 1);
HBufC8* contentBuf8 = HBufC8::NewL(contentPtr.Length());
//.........这里部分代码省略.........