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


C++ RBuf8类代码示例

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


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

示例1: main

int main()
{
    __UHEAP_MARK;
    int retval =ESuccess;
    wchar_t* mywcharstring = NULL;
    RBuf8 myRBuf;
    myRBuf.CreateL(10);
    myRBuf.CleanupClosePushL();
    retval = WcharToRbuf8 (mywcharstring, myRBuf);

    if (retval == EInvalidPointer)
    {
    printf("wchartorbuf8 negative1 Passed\n");
    }
    else
    {
    assert_failed = true;
    printf("wchartorbuf8 negative1 Failed\n");
    }      
    CleanupStack::PopAndDestroy(1);
    __UHEAP_MARKEND;
    testResultXml("test_wchartorbuf8_negative1");
	
	return 0;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:25,代码来源:test_wchartorbuf8_negative1.cpp

示例2: CleanupClosePushL

CResourceFile* CSsmCommandListResourceReaderImpl::CInitialiser::OpenResourceFileL(const TDesC& aFileName)
	{
	// open the resource file
	RFile file;
	CleanupClosePushL(file);
	User::LeaveIfError(file.Open(iFs, aFileName, EFileRead | EFileShareReadersOnly));

	// read entire resource file into a buffer
	TInt fileSize(0);
	User::LeaveIfError(file.Size(fileSize));
	RBuf8 buf;
	buf.CreateL(fileSize);
	CleanupClosePushL(buf);
	User::LeaveIfError(file.Read(buf));

	// create a CResourceFile from the buffer and add it to array (the CResourceFile takes its own copy of the buffer)
	CResourceFile* const resourceFile = CResourceFile::NewL(buf);
	CleanupStack::PushL(resourceFile);
	iResourcePool.AppendL(resourceFile);
	CleanupStack::Pop(resourceFile);
	iResourcePool.AppendL(aFileName);
	CleanupStack::PopAndDestroy(&buf);
	CleanupStack::PopAndDestroy(&file);
	return resourceFile;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:25,代码来源:ssmcommandlistresourcereaderimpl.cpp

示例3: DLTRACEIN

HBufC8* CNcdRequestBase::ExternalizeL() 
    {
    DLTRACEIN((""));
    
    const TXmlEngSerializationOptions KSerializationOptions = 
        TXmlEngSerializationOptions( 0x09, KSerializationOptionUtf8 );
    
#ifndef RD_XML_ENGINE_API_CHANGE
    TXmlEngString str;
    iDocument.SaveL(str, iRoot, KSerializationOptions);
    
    str.PushL();
    
    HBufC8* buf = HBufC8::NewL( str.Size() );
    *buf = str.PtrC8();
   
    // Free the original C-string
    CleanupStack::PopAndDestroy();        
#else
    
    RBuf8 rbuf;
    iDocument.SaveL( rbuf, iRoot, KSerializationOptions );

    CleanupClosePushL( rbuf );
    HBufC8* buf = rbuf.AllocL();
    CleanupStack::PopAndDestroy();  // rbuf

#endif
    
    DLTRACEOUT((""));
    return buf;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:32,代码来源:ncdrequestbase.cpp

示例4: SetReturn

void CConnection::GetParametersResponseL(TBool aReturnLength)
	{
    if (ServiceProvider() == NULL || !iCommsDataObject)
        {
    	SetReturn(KErrNotReady);
    	return;
        }

    if (aReturnLength)
    	{
    	// Client requesting required buffer length for the serialised object
    	iCommsDataObjectLength = iCommsDataObject->Length();
    	SetReturn(iCommsDataObjectLength);
    	}
    else
    	{
		RBuf8 cdoBuffer;
		cdoBuffer.CreateL(iCommsDataObjectLength);
		CleanupClosePushL(cdoBuffer);
		User::LeaveIfError(iCommsDataObject->Store(cdoBuffer));
		Message().WriteL(0, cdoBuffer);
		CleanupStack::PopAndDestroy();	// queryBundleBuffer

		delete iCommsDataObject;
		iCommsDataObject = NULL;
		iCommsDataObjectLength = 0;

		SetReturn(KErrNone);
    	}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:30,代码来源:ss_conn.cpp

示例5: ConstructL

void CSifTransportServer::ConstructL(const TDesC& aServerName, TInt aShutdownPeriodUs)
/**
	Second-phase construction initializes the superclass and
	starts the server.
 */
	{
	// Define a key (KSifOperationKey) which would be used to notify the client of any new operations.
    TInt ret = RProperty::Define(KUidSystemCategory, KSifOperationKey, RProperty::EByteArray, KSecurityPolicyWDD, KSecurityPolicyNone,(sizeof(TInt) * KMaxNumberOfOperations));
    if (ret != KErrAlreadyExists && ret != KErrNone)
        {
        User::Leave(ret);
        }

    if(ret == KErrNone)
        {
        // Create a empty CSifOperationKey object and publish it.
        CSifOperationKey* nullKey = CSifOperationKey::NewL();
        CleanupStack::PushL(nullKey);
        RBuf8 nullKeyBuffer;
        nullKeyBuffer.CleanupClosePushL();
        ExternalizeRefObjectL(*nullKey, nullKeyBuffer);
        User::LeaveIfError(RProperty::Set(KUidSystemCategory, KSifOperationKey, nullKeyBuffer));
		CleanupStack::PopAndDestroy(2, nullKey);
        }
    
    CScsServer::ConstructL(aShutdownPeriodUs);
	StartL(aServerName);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:28,代码来源:siftransportserver.cpp

示例6: main

int main()
{
    __UHEAP_MARK;
    int retval =ESuccess;
    char* mycharstring = "Hello Char String";
    int char_length= strlen(mycharstring);
    RBuf8 myRBuf;
    myRBuf.CreateL(30);
    myRBuf.CleanupClosePushL();
    retval = CharToRbuf8 (mycharstring, myRBuf);

    int buf_len = myRBuf.Length();
    if (retval ==ESuccess &&\
    char_length == buf_len &&\
    strncmp("Hello Char String",(char*)myRBuf.Ptr() , 17) ==0 )
    {
    printf("CharToRbuf8 content check Passed\n");
    }
    else
    {
    assert_failed = true;
    printf("CharToRbuf8 content check Failed\n");
    }      
    CleanupStack::PopAndDestroy(1);
    __UHEAP_MARKEND;
    testResultXml("test_chartorbuf8_content_check");
	return 0;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:28,代码来源:test_chartorbuf8_content_check.cpp

示例7: ILibSocketWrapper_recv

int ILibSocketWrapper_recv(int socketObject, char *buffer, int bufferLength)
{
	RSocket *s = (RSocket*)SocketArray[socketObject];
	RBuf8 *buf = new RBuf8();
	
	TRequestStatus status;
	TSockXfrLength aLen;
	int RetVal=0;
	
	if(buf->Create(bufferLength)==KErrNone)
	{
		s->RecvOneOrMore(*buf,0,status,aLen);
		User::WaitForRequest(status);
		if(status!=KErrNone)
		{
			RetVal = 0;
		}
		else
		{
			RetVal = aLen();
			Mem::Copy(buffer,(void*)buf->Ptr(),RetVal);
		}
	}
	buf->Close();
	delete buf;
	return(RetVal);
}
开发者ID:GufCab,项目名称:Semester-Projekt---Test-Kode,代码行数:27,代码来源:ILibSocketWrapper.cpp

示例8: WriteL

/** This user-side method uses the RFile Session methods to find the end of the file described by iCSVFile.
It then appends performance data metrics by element from the passed array, with each element separated by a comma character.
@param aPerformanceData is the constant array of performance data stored as TDesC
@return KErrNone if command was prepared correctly and a system wide error code otherwise.
 */
void CUptCsvGenerator::WriteL(const RArray<TPtrC8>& aPerformanceConfig)
	{
	// find end of this file, and append the passed data from here.
	TInt filesize;
	iCsvFile.Size(filesize);
	iCsvFile.Seek(ESeekStart, filesize);
	
	RBuf8 buf; 
	CleanupClosePushL(buf);
	//create a buf large enough to contain the passed data and comma separators
	TInt numbytes = 5*aPerformanceConfig.Count()*sizeof(TPtrC8);
	buf.CreateL(numbytes);
		
	//for the number of elements in the passed array:- append each element, separated by a comma, to the buffer
	for(TInt i=0; i!=aPerformanceConfig.Count(); i++) //could replace aPerformance.Count() with structure paramter Parameter.Count
		{
		buf.Append(aPerformanceConfig[i]);
		//may reimplement this
		if(i!=aPerformanceConfig.Count()) 	
			buf.Append(KCsvComma);  

		}
	//write the buffer to the given file	
	User::LeaveIfError(iCsvFile.Write(buf));
	
	
	//close and cleanup the heap objects
	buf.Close();
	CleanupStack::PopAndDestroy(&buf);

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

示例9: OstTraceFunctionEntry0

// -------------------------------------------------------------------------------------
// CUpnpTmClientProfileService::SetClientProfileActionL
// @param aAction  Pointer to UPnP action object
// @return Returns upnp error code
// ---------------------------------------------------------------------------------
//
TUpnpErrorCode CUpnpTmClientProfileService::SetClientProfileActionL( CUpnpAction* aAction )
{
    OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL_ENTRY );
    TUint profileIdInt;
    // Fetch the value for profile ID argument
    TLex8 lex( aAction->ArgumentValue(KProfileId) );
    lex.Val(profileIdInt);
    OstTrace1( TRACE_ERROR, CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::SetClientProfileActionL;profileIdInt=%d", profileIdInt );

    // Fetch the value for client profile argument
    const TDesC8& clientProfile = aAction->ArgumentValue(KClientProfile);

    RBuf8 resultProfileBuf;
    TTerminalModeErrorCode ret = iTmServerImpl.SetClientProfile( profileIdInt,clientProfile,resultProfileBuf );
    if ( ret != ETerminalModeSuccess )
    {
        resultProfileBuf.Close();
        OstTrace0( TRACE_ERROR, DUP1_CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::SetClientProfileActionL" );
        return TUpnpErrorCode( ret );
    }
    CleanupClosePushL(resultProfileBuf);
    aAction->SetArgumentL( KResultProfile , resultProfileBuf );
    CleanupStack::PopAndDestroy(&resultProfileBuf);
    OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL_EXIT );
    return EHttpOk;
}
开发者ID:kuailexs,项目名称:symbiandump-mw4,代码行数:32,代码来源:upnptmclientprofileservice.cpp

示例10: OpenEtelServerL

/**
 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0001
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the NackSmsStored API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySmsFUNegative::TestNackSmsStoredL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, EFalse);
	config.PushL();

    OpenEtelServerL(EUseExtendedError);
    CleanupStack::PushL(TCleanupItem(Cleanup,this));
    OpenPhoneL();

    RMobileSmsMessaging messaging;
    TInt err = messaging.Open(iPhone);
    ASSERT_EQUALS(KErrNone, err);
    CleanupClosePushL(messaging);
 
    RBuf8 data;
    CleanupClosePushL(data);
    
    TRequestStatus reqStatus;
    TRequestStatus mockLtsyStatus;
    RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 receiveAttr;
    RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg receiveAttrPckg(receiveAttr);
  
    _LIT8(KMessage, "Happy New Year");
    TBuf8<100> forMsg;
  
    // receiving message:
    messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg);

    TSmsMsg smsMsg;
    TSmsMsg* smsMsgPtr(&smsMsg);
    TBool ind(EFalse);
    
    smsMsg.iSmsClass2 = ETrue;
    smsMsg.iDeleteAfterClientAck = ETrue;
    smsMsg.iSmsMsg.Copy(KMessage);

    TMockLtsyData2<TBool, TSmsMsg*> compTsyData(ind, smsMsgPtr);
    compTsyData.SerialiseL(data);

    iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data);
    
    User::WaitForRequest(reqStatus);    
    ASSERT_EQUALS(KErrNone, reqStatus.Int());
    AssertMockLtsyStatusL();
    
    TDesC8* msgPtr = const_cast<TDesC8*>(&KMessage);
    TInt rpCause(0);
    TMockLtsyData2<TDesC8*, TInt> expTsyData(msgPtr, rpCause);
    data.Close();
    expTsyData.SerialiseL(data);

    messaging.NackSmsStored(reqStatus, KMessage, rpCause); 

    User::WaitForRequest(reqStatus);
    ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
    AssertMockLtsyStatusL();
    
    CleanupStack::PopAndDestroy(4, &config);    //  messaging, this, data, config
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:69,代码来源:cctsysmsfunegative.cpp

示例11: OpenEtelServerL

/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0016
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the SendAPDUReq API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestSendAPDUReqL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimSendApduRequest::KLtsyDispatchSimSendApduRequestApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMmCustomAPI customApi;
	OpenCustomApiLC(customApi);
	
	TBuf8<3> info;
	info.Append(1);
	info.Append(1);
	info.Append(1);
	
	RBuf8 dataBuf;
	CleanupClosePushL(dataBuf);
	_LIT8(KApduDataExp,"APDU DATA EXP ");
	dataBuf.CreateL(KApduDataExp);
	
	RMmCustomAPI::TApdu apdu(info,dataBuf);
	
	TRequestStatus status;
	customApi.SendAPDUReq(status, apdu);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(4, &config);	// dataBuf, customApi, this, config		
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:43,代码来源:cctsysimfunegative.cpp

示例12: id

/**
Inserts the data into the URITbl. 

@param aUri URI object
@param [out] aUriId The URI will be filled upon successful insertion. This ID
	uniquelly indentifies the URI.

@return Returns the number of rows inserted. Normally 1. Otherwise returns with
		system-wide error code.
*/
TInt CUriListInterface::InsertIntoUriTblL ( const TUriC8& aUri, TInt& aUriId )
	{
	const TDesC8& id ( iStringPool.String (URILIST::EId,URILIST::Table).DesC() );
	aUriId = GetMaxIdValueL ( KUriTblName(), id ) + 1;
	_LIT8 ( KUriTblInsertStmt, "INSERT INTO %S VALUES (:V1, :V2, :V3, :V4, :V5, :V6, :V7, :V8)" );
	
	RBuf8 sqlStmt;
	sqlStmt.CreateL ( KMaxDbStmtLen );
	CleanupClosePushL ( sqlStmt );
	sqlStmt.Format ( KUriTblInsertStmt(), &(KUriTblName()) );
	MDBTransaction* dbTrans = iDbAccessor->PrepareTransactionL ( sqlStmt );
	CleanupStack::PopAndDestroy (); // sqlStmt
	CleanupStack::PushL ( TCleanupItem ( CUriListInterface::DestroyTransObj, dbTrans ) );
	// We are having 8 parameters for this query. First bind the query with parameter position 0 
	// and so on
	dbTrans->BindIntL ( URILIST::EId, aUriId ); 
	dbTrans->BindTextL ( URILIST::EScheme, aUri.IsPresent(EUriScheme) ? aUri.Extract ( EUriScheme ) : KNullDesC8() );
	dbTrans->BindTextL ( URILIST::EUserInfo, aUri.IsPresent(EUriUserinfo) ? aUri.Extract ( EUriUserinfo ) : KNullDesC8() );
	dbTrans->BindTextL ( URILIST::EHost, aUri.IsPresent(EUriHost) ? aUri.Extract ( EUriHost ) : KNullDesC8() ); 
	dbTrans->BindTextL ( URILIST::EPort, aUri.IsPresent(EUriPort) ? aUri.Extract ( EUriPort ) : KNullDesC8() );
	dbTrans->BindTextL ( URILIST::EPath, aUri.IsPresent(EUriPath) ? aUri.Extract ( EUriPath ) : KNullDesC8() ); 
	dbTrans->BindTextL ( URILIST::EQuery, aUri.IsPresent(EUriQuery) ? aUri.Extract ( EUriQuery ) : KNullDesC8() );  
	dbTrans->BindTextL ( URILIST::EFragments, aUri.IsPresent(EUriFragment) ? aUri.Extract ( EUriFragment ) : KNullDesC8() );  				

	TInt result = dbTrans->ExecuteL ();
	CleanupStack::PopAndDestroy (); //dbTrans
	return result;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:38,代码来源:urilistinterface.cpp

示例13: SetTestStepResult

/**
 * @see GetInfoCpm test case NET-CONFIGURATOR-I-0018-HP
 *
 * doTestStepL virtual function does the below action
 * Connect to a configurator
 * Configurator get the module inidata section. Inidata section contains
   module initialisation information in the module's configuration file.
 * close the connection to configuator
 * Expected:-GetInfoCpm return kerrNone
*/
TVerdict CGetInfoCpm::doTestStepL()
	{

	SetTestStepResult(EFail);
	_LIT8(KNameDummyCpm,"DummyCpm");

	RBuf8 data;
	data.Create(100);
	TInt actualdatasize;

	//Configurator call to get the module inidata section
	TInt error = iConfigurator.GetModuleIniData(KNameDummyCpm(), data, actualdatasize);
	if (error == KErrOverflow)
		{
		INFO_PRINTF2(_L("GetModuleIniData returned KErrOverflow (%d)  \n"), error);
		data.ReAlloc(actualdatasize);
	    error = iConfigurator.GetModuleIniData(KNameDummyCpm(), data, actualdatasize);
	  	}
	else if (error == KErrRSModuleUnknown )
		{
		INFO_PRINTF2(_L("GetModuleIniData returned KErrRSModuleUnknown (%d)  \n"), error);
		}
	else if (error == KErrNone)
		{
	    INFO_PRINTF1(_L("GetModuleIniData Sucessful"));
	    SetTestStepResult(EPass);
		}
	else
		{
		INFO_PRINTF2(_L("GetModuleIniData  (DummyCpm) returned Error (%d)  \n"), error);
		}

    data.Close();
	return TestStepResult();
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:45,代码来源:getinienumerateStep.cpp

示例14: new

/**
Upcall from the Agent
*/
void CPppAgentNotificationHandler::ConnectCompleteL()
	{
	TBool pop = EFalse;
	CPppProvisionInfo* pppInfo = const_cast<CPppProvisionInfo*>(static_cast<const CPppProvisionInfo*>(GetExtension(STypeId::CreateSTypeId(CPppProvisionInfo::EUid, CPppProvisionInfo::ETypeId))));
	if (!pppInfo) // not provisioned yet
		{
		pppInfo = new (ELeave) CPppProvisionInfo;
		CleanupStack::PushL(pppInfo);
		pop = ETrue;
		}

	const TInt KMaxExcessData = 1503 * 2; // from PPP HDLC
	RBuf8 excessData;
	CleanupClosePushL(excessData);
	excessData.CreateL(KMaxExcessData);

	(void)ReadExcessData(excessData);
	User::LeaveIfError(pppInfo->SetExcessData(excessData));

	CleanupStack::PopAndDestroy(&excessData);

	pppInfo->SetIsDialIn(QueryIsDialIn());

	if (pop)
		{
		AppendExtensionL(pppInfo);
		CleanupStack::Pop(pppInfo);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:32,代码来源:pppmcpr.cpp

示例15: WriteApiNameL

void CUptCsvGenerator::WriteApiNameL(const TInt aApiEnum)
	{
	// find end of this file, and append the passed data from here.
	TInt filesize;
	iCsvFile.Size(filesize);
	iCsvFile.Seek(ESeekStart, filesize);
		
	RBuf8 buf; 
	CleanupClosePushL(buf);
	//create a buf large enough to contain the passed data and comma separators
	TInt numbytes = 1024;//2*sizeof(TPtrC8);
	buf.CreateL(numbytes);
		
	//read the APIenum (which is the same as the first element of aPerformanceData)
	//use this enum value to write the name of the API being tested
	TApiNames getApiName;
	buf.Append(getApiName.GetApiIdString(aApiEnum));
	buf.Append(KCsvComma); 
	
	//write the buffer to the given file	
	User::LeaveIfError(iCsvFile.Write(buf));
		
		
	//close and cleanup the heap objects
	buf.Close();
	CleanupStack::PopAndDestroy(&buf);
		
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:28,代码来源:te_perfcsvgenerator.cpp


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