当前位置: 首页>>代码示例>>C++>>正文


C++ TPtr8::Find方法代码示例

本文整理汇总了C++中TPtr8::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtr8::Find方法的具体用法?C++ TPtr8::Find怎么用?C++ TPtr8::Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPtr8的用法示例。


在下文中一共展示了TPtr8::Find方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

TInt CFloggerTest004_01::DoTestCheckWriteL()
	{
	RFile theFile;
	HBufC8 * hBuffer;
	TInt listfilesize,returnCode;
	RFs fileSystem; //For file operation create a file system
	TBuf8<256> testData; //To hold the test descriptor
	_LIT(KLogFile,"c:\\logs\\log.txt"); // log file name and path
	TInt numSuccessful = 0;

	_LIT(KTestMessage,"TC 4.01 :This is test msg"); //unicode test decriptor
	
	User::LeaveIfError(fileSystem.Connect());
	
	//Open the file in the read mode
	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 

	CleanupClosePushL(theFile);

	User::LeaveIfError(theFile.Size(listfilesize)); //Size of the file
	
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
	CleanupStack::PushL(hBuffer);

	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer

	// Read from position 0: start of file
	User::LeaveIfError(returnCode = theFile.Read(ptrString));
	
	testData.Copy(KTestMessage); //Copy the test descriptor
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
											//from the file

	if (returnCode != KErrNotFound)
		{
		numSuccessful++;
		}

	returnCode = ptrString.Find(KErrOOM);
	if (returnCode > 0)
		{
		User::Leave(KErrNoMemory);
		}
	

	
	CleanupStack::PopAndDestroy(hBuffer);
	CleanupStack::PopAndDestroy();	//theFile
	if (numSuccessful == 1)
		{
		return KErrNone;
		}
	else 
		{
		return KErrNotFound;
		}
	
	
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:59,代码来源:step_004_xx.cpp

示例2:

TInt CFloggerTest017_04::DoTestCheckWriteL()
	{
	User::After(KTimeToLog);
	RFile theFile;
	HBufC8 * hBuffer;
	TInt listfilesize;
	TInt returnCode;
	RFs fileSystem; //For file operation create a file system	
	TBuf8<256> testData; //To hold the test descriptor
	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path

	_LIT(KBodyTxt,"TC 17_4:Test Msg");//  Test body descriptor 
	TUint numSuccessful = 0;

	User::LeaveIfError(fileSystem.Connect());
	
	//Open the file in the read mode
	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
	CleanupClosePushL(theFile);

	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
	CleanupStack::PushL(hBuffer);
	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer

	// Read from position 0: start of file
	returnCode = theFile.Read(ptrString);
	

	testData.Copy(KBodyTxt); //Copy the test descriptor 
	returnCode=ptrString.Find(testData); //find the test descriptor in the buffer read
									 //from the file
									 
	if (returnCode > 0)
		numSuccessful++;
		
	returnCode=ptrString.Find(KHexTestHeader); //find the test descriptor in the buffer read
		
	if (returnCode == KErrNotFound)
		numSuccessful++;


	if (returnCode == KErrNotFound)  //Find the error message
		{
		returnCode = ptrString.Find(KErrOOM);
		if (returnCode > 0)
			User::Leave(KErrNoMemory);
		}

	CleanupStack::PopAndDestroy(hBuffer);
	CleanupStack::PopAndDestroy();	//theFile object

	if (numSuccessful == 2)
		return KErrNone;
	else 
		return KErrGeneral;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:57,代码来源:step_017_xx.cpp

示例3:

TInt CFloggerTest028_Sync_Binary::DoTestCheckWriteL()
	{
	RFile logFile;
	HBufC8* hBuffer;
	TInt listfilesize,returnCode;
	RFs fileSystem; //For file operation create a file system
	TInt numSuccessful = 0;

	User::LeaveIfError(fileSystem.Connect());
	
	//Open the file in the read mode
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));

	CleanupClosePushL(logFile);

	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
	
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
	CleanupStack::PushL(hBuffer);

	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer

	// Read from position 0: start of file
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
	
	returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
											//from the file
	if (returnCode > 0)
		{
		numSuccessful++;
		}

	returnCode = ptrString.Find(KStdSubsysTag8); 
	if (returnCode > 0)
		{
		numSuccessful++;
		}

	returnCode = ptrString.Find(KStdCompTag8); 
	if (returnCode > 0)
		{
		numSuccessful++;
		}
		


	CleanupStack::PopAndDestroy(hBuffer);
	CleanupStack::PopAndDestroy();	//logFile
	if (numSuccessful ==3)
		return KErrNone;
	else
		return KErrUnknown;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:53,代码来源:step_028_xx.cpp

示例4:

TInt CFloggerTest009_01::DoTestCheckWriteL()
	{
	User::After(1000*1000);
	RFile theFile;
	HBufC8 * hBuffer;
	TInt listfilesize;
	TInt returnCode;
	RFs fileSystem; //For file operation create a file system	
	TBuf8<256> testData; //To hold the test descriptor

	_LIT8(KTestMessageOne,"TC 9_01: The value of test integer variable :%d");
	testData.Format(KTestMessageOne,100);

	_LIT8(KOOMError, "#Logs may be lost out of memory!!"); //Error message

	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path

	User::LeaveIfError(fileSystem.Connect());
	
	//Open the file in the read mode
	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 

	CleanupClosePushL(theFile);

	
	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
	CleanupStack::PushL(hBuffer);
	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer

	// Read from position 0: start of file
	returnCode = theFile.Read(ptrString);
	
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
									//from the file

	if (returnCode == KErrNotFound)  //Find the error message
		{
		returnCode = ptrString.Find(KOOMError);
		if (returnCode > 0)
			User::Leave(KErrNoMemory);
		}


	CleanupStack::PopAndDestroy(hBuffer);
	CleanupStack::PopAndDestroy(); // For theFile object
	if (returnCode > 0)
		return KErrNone;
	else 
		return KErrNotFound;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:51,代码来源:step_009_xx.cpp

示例5:

TInt CFloggerTest025_BuildTestUdeb1::DoTestCheckWriteL()
	{
	RFile theFile;
	HBufC8 * hBuffer;
	TInt listfilesize;
	TInt returnCode;
	RFs fileSystem; //For file operation create a file system	

	User::After(KTimeToLog);
	
	User::LeaveIfError(fileSystem.Connect());
	
	//Open the file in the read mode
	User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead)); 

	CleanupClosePushL(theFile);	
	
	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
	CleanupStack::PushL(hBuffer);
	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer

	// Read from position 0: start of file
	returnCode = theFile.Read(ptrString);
	if (returnCode == KErrNone) 
		returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
											//from the file

	CleanupStack::PopAndDestroy(hBuffer);
	CleanupStack::PopAndDestroy(); // For theFile object
	if (returnCode > 0)
		return KErrNone;
	else 
		return KErrGeneral;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:35,代码来源:step_025_xx.cpp

示例6: ParseCoordinateData

TReal CGpsDataHandler::ParseCoordinateData() {
	TPtr8 pBuffer = iBuffer->Des();
	TReal aAngle;
	TReal aResult = 0.0;
	TInt aFindResult;

	aFindResult = pBuffer.Find(_L8(","));
	if(aFindResult != KErrNotFound) {
		HBufC8* aField = HBufC8::NewL(aFindResult);
		CleanupStack::PushL(aField);
		TPtr8 pField = aField->Des();

		pField.Copy(pBuffer.Ptr(), aFindResult);
		pBuffer.Delete(0, aFindResult+1);

		TLex8 aFieldLex(pField.Ptr());
		if(aFieldLex.Val(aAngle, '.') == KErrNone) {
			TInt32 aDegrees;
			Math::Int(aDegrees, aAngle / 100.0);

			TInt32 aMinutes;
			Math::Int(aMinutes, aAngle - aDegrees * 100);

			TReal aDecimal;
			Math::Frac(aDecimal, aAngle);

			aResult = aDegrees + (aMinutes + aDecimal) / 60.0;

			if(pBuffer[0] == TUint('S') || pBuffer[0] == TUint('W')) {
				aResult = -aResult;
			}

			aFindResult = pBuffer.Find(_L8(","));

			if(aFindResult != KErrNotFound) {
				pBuffer.Delete(0, aFindResult+1);
			}
		}

		CleanupStack::PopAndDestroy();
	}

	return aResult;
}
开发者ID:Persepoliss,项目名称:symbian-client,代码行数:44,代码来源:GpsDataHandler.cpp

示例7:

TInt CFloggerTest007_02::DoTestCheckWriteL()
	{
	User::After(KTimeToLog);
	RFile theFile;
	HBufC8 * hBuffer;
	TInt listfilesize,returnCode;
	RFs fileSystem; //For file operation create a file system
	TBuf8<256> testData; //To hold the test descriptor
	_LIT(KLogFile,"c:\\logs\\log.txt"); // log file name and path

	//The following contains the string of length 200(max) 
	//which is  written to the log file
	//_LIT(KTestLongMessage, "This is the long message This is the long message This is the long message This is the long message This is the long message This is the long message This is the long message This is the long message");
	_LIT(KTestLongMessage, "TC 7_02: This is the long message This is the long message This is the long message This is the long message This is the long message This is the long message This is the long message This is the long");
	
	//_LIT8(KOOMError, "#Logs may be lost out of memory!!");
	
	User::LeaveIfError(fileSystem.Connect());
	
	//Open the file in the read mode
	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 

	CleanupClosePushL(theFile);

	User::LeaveIfError(theFile.Size(listfilesize)); //Size of the file
	
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
	CleanupStack::PushL(hBuffer);

	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer

	// Read from position 0: start of file
	User::LeaveIfError(returnCode = theFile.Read(ptrString));
	
	testData.Copy(KTestLongMessage); //Copy the test descriptor
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
											//from the file

	
	CleanupStack::PopAndDestroy(hBuffer);
	CleanupStack::PopAndDestroy();	//theFile
	if (returnCode > 0)
		return KErrNone;
	else 
		return KErrGeneral;
	

}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:48,代码来源:step_007_xx.cpp

示例8:

TInt CFloggerTest012_02::DoTestCheckWriteL()
	{

	
	User::After(KTimeToLog);

	RFile theFile;
	HBufC8 * hBuffer;
	TInt listfilesize;
	TInt returnCode;
	RFs fileSystem; //For file operation create a file system
	TBuf8<256> testData; //To hold the test descriptor
	_LIT(KLogFile, "c:\\logs\\log.txt"); // log file name and path

	_LIT8(KTestMessageTwo,"TEST 12.02: The value of first test integer variable :%d The value of second test integer variable : %d");
	testData.Format(KTestMessageTwo,100, 200);

	User::LeaveIfError(fileSystem.Connect());
	
	//Open the file in the read mode
	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 

	
	returnCode = theFile.Size(listfilesize); //Size of the file
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
	CleanupStack::PushL(hBuffer);
	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer

	// Read from position 0: start of file
	returnCode = theFile.Read(ptrString);
	
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
									//from the file
	theFile.Close();
	fileSystem.Close();
	CleanupStack::PopAndDestroy(hBuffer);
	if (returnCode > 0)
		return KErrNone;
	else 
		return KErrGeneral;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:41,代码来源:step_012_xx.cpp

示例9: CountLinesOfHtmlL

/**
CountLinesOfHtmlL()
Counts the number of lines of HTML

@param aEntry
A reference to an object representing the email

@return
Number of lines of HTML
*/
TInt CT_MsgComparePopEmailMsgs::CountLinesOfHtmlL(CMsvEntry& aEntry)
	{ 
	TInt lines = 0;
	aEntry.SetEntryL(aEntry.EntryId());
	
	
	CMsvStore* store = aEntry.ReadStoreL();
	CleanupStack::PushL(store);
	
	MMsvAttachmentManager& attManager = store->AttachmentManagerL();
	
	RFile htmlFile = attManager.GetAttachmentFileL(0);
	CleanupClosePushL(htmlFile);
	
	_LIT8(KFindData, "\r\n");
	TInt htmlSize = 0;
	User::LeaveIfError(htmlFile.Size(htmlSize));
	HBufC8* fBuf = HBufC8::NewLC(htmlSize);
	TPtr8 p = fBuf->Des();
	htmlFile.Read(p);
	TInt pos = 0;
	for(;;)
		{
		pos = p.Find(KFindData);
		if(pos < 0)
			{
			break;
			}
		p = p.Mid(pos+2);
		lines++;
		}
		
	CleanupStack::PopAndDestroy(fBuf);
	CleanupStack::PopAndDestroy(); // htmlFile
	CleanupStack::PopAndDestroy(store);
	
	return lines;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:48,代码来源:T_ComparePopEmailMsgs.cpp

示例10: StoreAttributesL

// ---------------------------------------------------------
// CNSmlDsProvisioningAdapter::StoreAttributesL
// ---------------------------------------------------------
void CNSmlDsProvisioningAdapter::StoreAttributesL( const TDesC& aType )
    {
    _DBG_FILE("CNSmlDsProvisioningAdapter::StoreAttributesL(): begin");
    
    TInt iDataProvElementCount = iProfiles[iProfiles.Count()-1]->iDataProvElement.Count()-1;
	// Leave if aType cannot be assigned
    if( ( aType.Length() > 0 ) &&
        ( iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount]->iRemoteDBUri ) )
        {
        TBool dataProvIdFoundInZ = FALSE;
        TSmlDataProviderId firstDataProvIdFound = 0;
        TSmlDataProviderId uidFound = 0;

        TBool doSearch = ETrue;
        if ( aType.FindF( KXVcardMimeType ) != KErrNotFound )
            {
            if ( IsOperatorProfile( *iProfiles[iProfiles.Count()-1] ) )
                {
                const CNSmlDsProfileElement& profile = *iProfiles[iProfiles.Count()-1];
                StoreOperatorUrlL( *profile.iHostAddress );
                
                // Do not make a search through adapter implementations
                doSearch = EFalse;
                uidFound = OperatorAdapterUid();
                if ( !uidFound )
                    {
                    // If OperatorAdapterUid returns 0, do a search
                    doSearch = ETrue;
                    }
                }
            }
		// look through every implementation adapter until one found
		// which supports MIME type in question
		
		// The first one located in ROM is chosen. If none found in ROM then
		// the first adapter found is chosen.

		HBufC8 *type = HBufC8::NewLC(aType.Size());
		TPtr8 typePtr = type->Des();
		CnvUtfConverter::ConvertFromUnicodeToUtf8( typePtr, aType);

		// get list of dataproviderIds
		RImplInfoPtrArray implArray;
		CleanupStack::PushL( PtrArrCleanupItemRArr( CImplementationInformation, &implArray ) );
		TUid ifUid = { KNSmlDSInterfaceUid };
		REComSession::ListImplementationsL( ifUid, implArray );
		
        if ( doSearch )
            {
            TInt countProviders = implArray.Count();
            for( TInt i = 0; i < countProviders; i++ )
                {
                CImplementationInformation* implInfo = implArray[i];

                RSyncMLDataProvider dataProvider;
                dataProvider.OpenL( iSession, implInfo->ImplementationUid().iUid );
                CleanupClosePushL( dataProvider );

                TInt mimeTypeCount = dataProvider.MimeTypeCount();
                for( TInt j = 0; j < mimeTypeCount; j++ )
                    {
                    HBufC* mimeType = dataProvider.MimeType( j ).AllocLC();
                    TPtrC8 convMimeType = ConvertTo8LC( *mimeType );
                    if( typePtr.Find( convMimeType ) == 0)
                        {
                        // MIME type in question was found
                        uidFound = implInfo->ImplementationUid().iUid;

                        if( firstDataProvIdFound == 0 )
                            {
                            // save the first in case of none found from ROM
                            firstDataProvIdFound = uidFound;
                            }
					
                        // check whether the provider is located in ROM (drive Z)
                        if( implInfo->Drive() == EDriveZ )
                            {
                            dataProvIdFoundInZ = TRUE;
                            }
                        }
				
                    CleanupStack::PopAndDestroy(2); // mimetype, ConvertTo8LC

                    if( uidFound )
                        {
                        break;
                        }
                    }
				
                CleanupStack::PopAndDestroy(); // dataProvider
			
                if ( dataProvIdFoundInZ )
                    {
                    break;
                    }
                else
                    {
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:101,代码来源:NSmlDsProvisioningAdapter.cpp

示例11: DoParseIniFileL

void CIniFileParser::DoParseIniFileL(TDesC& aIniFile)
/*
 * 
 * The force flush state is only updated if it is not already set to something other
 * than ENoValue. If force flush option is not found in ini file, force flush is set
 * to off.
 */
	{

	TInt fileLength;
	TInt ret = KErrNone;
	RFile iniFile;

	// Open file
	User::LeaveIfError(iniFile.Open(iFs, aIniFile, EFileShareAny));
		
	CleanupClosePushL(iniFile);
	
	// as we have been able to open the file, set the media to default.
	// If the ini file is parsed correctly, this then gets overwritten.
	// Otherwise the caller should pass thru a mesg to get the default enabled.
	if (iLoggingMediaString.Length() == 0)
		{
		iLoggingMediaString = KDefaultMedia;
		}
		
	

	User::LeaveIfError(iniFile.Size(fileLength));

	HBufC8* iniContents = HBufC8::NewLC(fileLength);
	TPtr8 hbufPtr = iniContents->Des();
	User::LeaveIfError(iniFile.Read(hbufPtr));
	TLex8 lex(*iniContents);

	//OK, file is open and ready for parsing. Make a tempory array and if there is a
	//problem in the ini file leave settings as they were, leave, and
	//the error will get picked up.

	delete iIniSettings;
	iIniSettings = NULL;
	CIniLoggingPairs* iniSettings = CIniLoggingPairs::NewL();
	CleanupStack::PushL(iniSettings);
	TNameTag tempTag;
	TNameTag tempTag2;
	TChar  tempChar;

	FOREVER
		{
		ret = GetNextTokenAndCheck(lex,hbufPtr);
		if (ret != KErrNone)
			{
			break;
			}
		if (hbufPtr.Find(KCommentKeyword)!=KErrNotFound)		//found a Comment
			{
			tempChar = lex.Get();
			while (!lex.Eos() && TUint(tempChar) != KCarriageReturn && TUint(tempChar) != KLineFeed)
				{
				tempChar = lex.Get();
				}
			}
		else if (hbufPtr.CompareF(KMediaKeyword)==0)		//MediaSetting
			{
			User::LeaveIfError(GetNextTokenAndCheck(lex,hbufPtr));
			if (hbufPtr.Length()>KMaxMediaStringLength)
				{
				User::Leave(KErrGeneral);
				}
			iLoggingMediaString = hbufPtr;
			}
		else if (hbufPtr.CompareF(KLogKeyword)==0)		//LOG
			{
			User::LeaveIfError(GetNextTokenAndCheck(lex,hbufPtr));

			if (hbufPtr.Length()>KMaxTagLength)
				{
				tempTag = hbufPtr.Left(KMaxTagLength);
				}
			else
				{
				tempTag = hbufPtr;
				}
			User::LeaveIfError(GetNextTokenAndCheck(lex,hbufPtr));
			if (hbufPtr.Length()>KMaxTagLength)
				{
				tempTag2 = hbufPtr.Left(KMaxTagLength);
				}
			else
				{
				tempTag2 = hbufPtr;
				}
			iniSettings->AddSettingL(tempTag, tempTag2);
			}
		else if (hbufPtr.CompareF(KForceFlushKeyword)==0)		//ForceFlush
			{
			if (iForceFlushState == ENoValue)
				{
				iForceFlushState = EFlushOn;
				}
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:101,代码来源:comsdbgaux.cpp

示例12: ProcessData

void CGpsDataHandler::ProcessData() {
	TPtr8 pBuffer = iBuffer->Des();

	// Check sentence is complete
	if(pBuffer[0] != TUint('$')) {
		// Burn invalid data
		pBuffer.Delete(0, 1);

		iEngineStatus = EGpsReading;
		iSocket.Recv(iChar, 0, iStatus);
		SetActive();
	}
	else if(pBuffer[pBuffer.Length()-1] == TUint('\n')) {
		// Sentence is complete
		TInt aStartField;
		TInt aFindResult;

		// Ready to parse data
		if(pBuffer.Find(_L8("$GPGLL")) != KErrNotFound) {
			aStartField = 1;
		}
		else if(pBuffer.Find(_L8("$GPGGA")) != KErrNotFound) {
			aStartField = 2;
		}
		else if(pBuffer.Find(_L8("$GPRMC")) != KErrNotFound) {
			aStartField = 3;
		}
		else {
			pBuffer.Zero();

			iEngineStatus = EGpsReading;
			iSocket.Recv(iChar, 0, iStatus);
			SetActive();

			return;
		}

		// Burn useless data
		for(TInt i = 0;i < aStartField;i++) {
			aFindResult = pBuffer.Find(_L8(","));

			if(aFindResult != KErrNotFound) {
				pBuffer.Delete(0, aFindResult+1);
			}
		}

		// Read latitude
		TReal aLatitude = ParseCoordinateData();
		TReal aLongitude = ParseCoordinateData();

		pBuffer.Zero();

		if(aLatitude != 0.0 || aLongitude != 0.0) {
			iObserver->GpsData(aLatitude, aLongitude, 10.0);

			iSocket.Close();
			iSocketServ.Close();
			iEngineStatus = EGpsDisconnected;
		}
	}
	else {
		iEngineStatus = EGpsReading;
		iSocket.Recv(iChar, 0, iStatus);
		SetActive();
	}
}
开发者ID:Persepoliss,项目名称:symbian-client,代码行数:66,代码来源:GpsDataHandler.cpp

示例13: KTestMessageOneParamExpected

TInt CFloggerTest028_Sync_Static_Multiple2::DoTestCheckWriteL()
	{
	RFile logFile;
	HBufC8* hBuffer;
	TInt listfilesize,returnCode;
	RFs fileSystem; //For file operation create a file system
	TInt numSuccessful = 0;

	User::LeaveIfError(fileSystem.Connect());
	
	//Open the file in the read mode
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));

	CleanupClosePushL(logFile);

	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
	
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
	CleanupStack::PushL(hBuffer);

	TPtr8 ptrString = hBuffer->Des();  //To access the buffer

	// Read from position 0: start of file
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
	
	
	// the test case writes 5 elements 100 times, but we only check these things:
	// 1. that the long test message with one parameter is written 100 times
	// 2. that the test message with one param is written 100 times
	// 3. that the end of test message has been written
	
	TPtrC8 ptrStringOffsetForSearching;
	returnCode = ptrString.Find(KTestMessageOneParamExpected);

	if (returnCode > 0)
		{
		numSuccessful++;
		}
		
	TInt newLength;   // allow length to be watched during debugging
	TInt loop;
	
	ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length()));
	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
		{
		returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
		if (returnCode > 0)
			{
			numSuccessful++;
			}
			
		newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestMessageOneParamExpected().Length();
	 	if (newLength < 0)
	 		{
	 		User::Leave(KErrUnknown);
	 		}

		ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
		
		}


	returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected);

	if (returnCode > 0)
		{
		numSuccessful++;
		}
		
	newLength = ptrString.Length()-returnCode-KTestTooLongMessageOneParamExpected().Length();
	ptrStringOffsetForSearching.Set(ptrString.Right(newLength));
	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
		{
		returnCode = ptrStringOffsetForSearching.Find(KTestTooLongMessageOneParamExpected); //find the next occurance
		if (returnCode > 0)
			{
			numSuccessful++;
			}
			
		if (loop < (KMultipleWriteStressTimes - 1))
			{
			newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestTooLongMessageOneParamExpected().Length();
	 		if (newLength < 0)
	 			{
	 			User::Leave(KErrUnknown);
	 			}
			ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
			}
		
		}

	returnCode = ptrString.Find(KTestEndMessage8); 
	if (returnCode > 0)
		{
		numSuccessful++;
		}

	
	CleanupStack::PopAndDestroy(hBuffer);
	CleanupStack::PopAndDestroy();	//logFile
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:101,代码来源:step_028_xx.cpp


注:本文中的TPtr8::Find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。