本文整理汇总了C++中RBuf8::CreateL方法的典型用法代码示例。如果您正苦于以下问题:C++ RBuf8::CreateL方法的具体用法?C++ RBuf8::CreateL怎么用?C++ RBuf8::CreateL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RBuf8
的用法示例。
在下文中一共展示了RBuf8::CreateL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDataL
// ---------------------------------------------------------------------------
// Data request from CatalogsPCConnectivityPlugin
// First ask the size from server, then give correct size CBufFlat
// ---------------------------------------------------------------------------
//
void RCatalogsPCConnectivityClient::GetDataL(
TDataType& aMimeType, CBufFlat& aData )
{
TPckgBuf<TInt> pckgSize;
TPckgBuf<TDataType> pckgMIME;
User::LeaveIfError( SendReceive(
ECatalogsPCConnectivityGetSize,
TIpcArgs( &pckgMIME, &pckgSize ) ) );
TInt size = pckgSize();
aMimeType = pckgMIME();
RBuf8 desData;
desData.CreateL( size );
desData.CleanupClosePushL();
User::LeaveIfError( SendReceive(
ECatalogsPCConnectivityGetData,
TIpcArgs( &desData ) ) );
aData.Reset();
aData.ExpandL( 0, size );
aData.Write( 0, desData, size );
CleanupStack::Pop(); //desData
desData.Close();
}
示例2: ConnectCompleteL
/**
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);
}
}
示例3: GenerateHashAndReturnInHexFormatL
/**
Auxilary function should be called only when we need to generate hash values from the screen and returns its hex format.
@param aHexString the output MD5 hash hex string obtained from iBitmapDevice
*/
EXPORT_C void CTHashReferenceImages::GenerateHashAndReturnInHexFormatL(TDes &aHexString)
{
TInt bufLen = CFbsBitmap::ScanLineLength(iBitmapDevice->SizeInPixels().iWidth, iBitmapDevice->DisplayMode());
RBuf8 buff;
buff.CreateL(bufLen);
CleanupClosePushL(buff);
CMD5 *md = CMD5::NewL();
CleanupStack::PushL(md);
for (TPoint pos(0, 0); pos.iY < iBitmapDevice->SizeInPixels().iHeight; pos.iY++)
{
iBitmapDevice->GetScanLine(buff,pos,iBitmapDevice->SizeInPixels().iWidth,iBitmapDevice->DisplayMode());
md->Update(buff);
}
TBuf8<KLengthOfHashValue> hashString;
//md will be reset after calling CMD5::Final() as Final will call Reset.
hashString.Copy(md->Final());
aHexString.Zero();
for(TInt icount=0; icount < hashString.Length(); icount++)
{
aHexString.AppendNumFixedWidth(hashString[icount], EHex, 4);
}
CleanupStack::PopAndDestroy(2, &buff);
}
示例4: InsertIntoUriTblL
/**
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;
}
示例5: InternalizeDesL
TInt InternalizeDesL(RBuf8& aDes, RReadStream& aStream)
{
TInt length = aStream.ReadInt32L();
aDes.Close();
if (length > 0)
{
aDes.CreateL(aStream, length);
}
else
{
aDes.CreateL(KNullDesC8);
}
return length;
}
示例6: TestSendAPDUReqL
/**
* @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
}
示例7: 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;
}
示例8: 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;
}
示例9: fileSize
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;
}
示例10: 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);
}
示例11: 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);
}
示例12: GetParametersResponseL
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);
}
}
示例13: RunL
void CUPnPRControlChannelAO::RunL()
{
switch ( iState )
{
case ERecv:
{
iTimer->Cancel ();
if( iInComingAction.MaxLength() != KErrUnknown )
{
if ( iCompleteBuffer.Length() == 0 )
{
iCompleteBuffer.CreateL(iInComingAction.MessageDes().Length());
}
else
{
TInt oldLen = iCompleteBuffer.Length();
iCompleteBuffer.ReAlloc ( oldLen + iInComingAction.MessageDes().Length() );
}
iCompleteBuffer.Append(iInComingAction.MessageDes());
if( iCompleteBuffer.Length() == iInComingAction.MaxLength() )
{
iInComingAction.ClearFlags();
SenddataL();
iState = EStop;
}
else
{
iControlChannel.Recv(iInComingAction, iStatus);
iState = ERecv;
SetActive();
}
}
else
{
iExepecteBufLen = iInComingAction.MaxLength();
RBuf8 completeData;
completeData.CreateL( iExepecteBufLen );
completeData.Append(iInComingAction.MessageDes());
iControlChannel.Recv(iInComingAction, iStatus);
SenddataL();
iState = EStop;
}
_LIT(KInfoLogFile, "CUPnPRControlChannelAO::RunL().... \n");
iManager->INFO_PRINTF1(KInfoLogFile);
}
break;
case EStop:
{
CActiveScheduler::Stop();
_LIT(KInfoLogFile1, "CUPnPRControlChannelAO::RunL() Stop.... \n");
iManager->INFO_PRINTF1(KInfoLogFile1);
}
break;
}
}
示例14: ConstructL
void CTestAppUi::ConstructL()
{
// Complete the UI framework's construction of the App UI.
BaseConstructL(CEikAppUi::ENoAppResourceFile);
iPropertyObs = new(ELeave) CPropertyObserver;
iPropertyObs->StartL();
//Signal that application is started
RSemaphore sem;
TInt err = sem.OpenGlobal(KStartShmaTestAppGood);
if(err == KErrNone)
{
sem.Signal();
sem.Close();
}
RFs fs;
err = fs.Connect();
User::LeaveIfError(err);
CleanupClosePushL(fs);
RFile file;
err = file.Open(fs, KPanicFile, EFileRead);
if (err == KErrNotFound)
{
CleanupStack::PopAndDestroy(&fs);
// We are not using the file, so just return
return;
}
else
{
User::LeaveIfError(err);
CleanupClosePushL(file);
TBuf8<30> buf;
err = file.Read(buf);
User::LeaveIfError(err);
CleanupStack::PopAndDestroy(&file);
err = fs.Delete(KPanicFile);
RBuf8 writableArgs;
writableArgs.CreateL(buf, 30);
CleanupClosePushL(writableArgs);
TPtr16 args16 = writableArgs.Expand();
_LIT(KTestGoodProcPanic, "Panic");
if (args16 == KPanicCommandLineOption1)
User::Panic(KTestGoodProcPanic, KProcPanic);
else if (args16 == KPanicCommandLineOption2)
User::Panic(KTestGoodProcPanic, KErrNone);
CleanupStack::PopAndDestroy(2, &fs);
}
}
示例15: GetOrSetParametersL
void CConnection::GetOrSetParametersL()
{
if (ServiceProvider() == NULL)
{
SetReturn(KErrNotReady);
return;
}
if (iCommsDataObject)
{
SetReturn(KErrInUse);
return;
}
TInt cdoLength = Message().GetDesLengthL(0);
RBuf8 cdoBuffer;
cdoBuffer.CreateL(cdoLength);
CleanupClosePushL(cdoBuffer);
SafeMessage().ReadL(0, cdoBuffer);
TPtrC8 des(cdoBuffer);
iCommsDataObject = static_cast<XCommsDataObject*>(SMetaDataECom::LoadL(des));
// Last minute sanity check
if ((iCommsDataObject->OperationMode() == XCommsDataObject::EOperationGet
&& !iCommsDataObject->IsGetSupported())
|| (iCommsDataObject->OperationMode() == XCommsDataObject::EOperationSet
&& !iCommsDataObject->IsSetSupported()))
{
CleanupStack::PopAndDestroy(); // cdoBuffer
delete iCommsDataObject;
iCommsDataObject = NULL;
SetReturn(KErrCorrupt);
return;
}
// iCommsDataObject passed as *& and will be updated by the TGetOrSetParameters message
// upon error
RNodeInterface* sp = ServiceProvider();
if (sp == NULL)
{
delete iCommsDataObject;
iCommsDataObject = NULL;
SetReturn(KErrNotReady);
return;
}
TGetOrSetParameters msg(SafeMessage(), iCommsDataObject);
CMMSockSubSession::ReceivedL(SafeMessage().Function(), msg);
DontCompleteCurrentRequest(); //TLegacyControlMessage will complete the message
CleanupStack::PopAndDestroy(); // cdoBuffer
}