本文整理汇总了C++中CBufBase::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ CBufBase::Size方法的具体用法?C++ CBufBase::Size怎么用?C++ CBufBase::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBufBase
的用法示例。
在下文中一共展示了CBufBase::Size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddObjectToBufferL
// -----------------------------------------------------------------------------
// CNSmlDmDevDetailAdapter::AddObjectToBufferL()
// -----------------------------------------------------------------------------
void CNSmlDmDevDetailAdapter::AddObjectToBufferL( CBufBase& aCrcBuf,
const TDesC8& aURI )
{
CBufBase* buf = CBufFlat::NewL( 1 );
CleanupStack::PushL( buf );
FetchLeafObjectL( aURI, *buf );
aCrcBuf.InsertL( aCrcBuf.Size(), buf->Ptr(0) );
_LIT8( KNSmlDmSeparator, ";" );
aCrcBuf.InsertL( aCrcBuf.Size(), KNSmlDmSeparator );
CleanupStack::PopAndDestroy(); //buf
}
示例2: InternalizeRequestL
void CNcdNodeLink::InternalizeRequestL( MCatalogsBaseMessage& aMessage ) const
{
DLTRACEIN((""));
CBufBase* buf = CBufFlat::NewL( KBufExpandSize );
CleanupStack::PushL( buf );
RBufWriteStream stream( *buf );
CleanupClosePushL( stream );
// Include all the necessary node data to the stream
ExternalizeDataForRequestL( stream );
// Commits data to the stream when closing.
CleanupStack::PopAndDestroy( &stream );
if ( buf->Size() > 0 )
{
DLTRACE(( "Completing the message, buf len: %d", buf->Ptr(0).Length() ));
}
// If this leaves, ReceiveMessage function will complete the message.
aMessage.CompleteAndReleaseL( buf->Ptr( 0 ), KErrNone );
DLTRACE(("Deleting the buf"));
CleanupStack::PopAndDestroy( buf );
DLTRACEOUT((""));
}
示例3: FetchLeafObjectSizeL
// -----------------------------------------------------------------------------
// CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL( const TDesC8& aURI,
// const TDesC8& aLUID, const TDesC8& aType, const TInt aResultsRef,
// const TInt aStatusRef )
// -----------------------------------------------------------------------------
void CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL( const TDesC8& aURI,
const TDesC8& /*aLUID*/,
const TDesC8& aType,
const TInt aResultsRef,
const TInt aStatusRef )
{
_DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL(): begin");
CBufBase *object = CBufFlat::NewL( 1 );
CleanupStack::PushL( object );
CSmlDmAdapter::TError retValue = FetchLeafObjectL( aURI, *object );
TInt objSizeInBytes = object->Size();
TBuf8<KNSmlMaxSizeBufferLength> stringObjSizeInBytes;
stringObjSizeInBytes.Num( objSizeInBytes );
object->Reset();
object->InsertL( 0, stringObjSizeInBytes );
iDmCallback->SetStatusL( aStatusRef, retValue );
iDmCallback->SetResultsL( aResultsRef, *object, aType);
CleanupStack::PopAndDestroy(); //object
_DBG_FILE("CNSmlDmDevDetailAdapter::FetchLeafObjectSizeL(): end");
}
示例4: UT_CSTUNBinding_HandleDataLL
void ut_cstunbinding::UT_CSTUNBinding_HandleDataLL( )
{
_LIT8( KPassword,"aaaabbbbccccdddd");
TBufC8<16> password( KPassword );
_LIT8( KTransactionId,"aaaabbbb");
TNATFWUNSAFTransactionID transactionID;
transactionID.Copy( KTransactionId );
CNATFWUNSAFBindingRequest* request = CNATFWUNSAFBindingRequest::NewLC( transactionID );
CBufBase* msg = request->EncodeL( password );
CleanupStack::PushL( msg );
TInt length = msg->Size();
HBufC8* readBuf1 = HBufC8::NewLC( length );
TPtr8 writable1( readBuf1->Des() );
msg->Read( 0, writable1 );
TInetAddr remoteAddr;
TBool consumed = EFalse;
HBufC8* ptr = iBinding->HandleDataL( *readBuf1, consumed, remoteAddr );
EUNIT_ASSERT( NULL == ptr );
EUNIT_ASSERT( EFalse == consumed );
delete ptr;
CleanupStack::PopAndDestroy( readBuf1 );
CleanupStack::PopAndDestroy( msg );
CleanupStack::PopAndDestroy( request );
}
示例5: GetWiFiBufferL
HBufC8* CAgentPosition::GetWiFiBufferL(TLocationAdditionalData* additionalData)
{
CBufBase* buffer = CBufFlat::NewL(50);
CleanupStack::PushL(buffer);
CWlanScanInfo* scanInfo=CWlanScanInfo::NewL();
CleanupStack::PushL(scanInfo);
CWlanMgmtClient* client=CWlanMgmtClient::NewL();
CleanupStack::PushL(client);
client->GetScanResults(*scanInfo);
for(scanInfo->First(); !scanInfo->IsDone(); scanInfo->Next() )
{
TWiFiInfo wifiInfo;
Mem::FillZ(&wifiInfo,sizeof(wifiInfo));
//Retrieve BSSID
TWlanBssid bssid;
scanInfo->Bssid( bssid );
//wifiInfo.macAddress.Zero();
//wifiInfo.macAddress.Copy(bssid);
for(TInt k = 0; k < bssid.Length(); k++)
wifiInfo.macAddress[k] = bssid[k];
//Retrieve transmision level
TInt8 rxLevel = scanInfo->RXLevel();
wifiInfo.rssi = rxLevel;
//Retrieve SSID
TBuf8<36> ssid;
TInt err;
err = GetSSID(scanInfo, ssid);
if(err == KErrNone)
{
wifiInfo.ssidLen = ssid.Length();
for(TInt i=0; i<wifiInfo.ssidLen; i++)
wifiInfo.ssid[i] = ssid[i];
}
else
{
wifiInfo.ssidLen = 0;
}
additionalData->uStructNum += 1;
buffer->InsertL(buffer->Size(), &wifiInfo, sizeof(TWiFiInfo));
}
CleanupStack::PopAndDestroy(client);
CleanupStack::PopAndDestroy(scanInfo);
HBufC8* result = buffer->Ptr(0).AllocL();
CleanupStack::PopAndDestroy(buffer);
return result;
}
示例6: DataReceivedL
// ----------------------------------------------------------------------------
// TTCPCompMsgEnd::DataReceivedL
// ----------------------------------------------------------------------------
//
void TTCPCompMsgEnd::DataReceivedL( TPtr8 aData, TUint& aNextLength )
{
// panic if sigcomp is not supported in debug mode.leaves in release mode.
__SIP_ASSERT_LEAVE( iMsgAssembler.SigComp().IsSupported(), KErrGeneral );
// panic if received data is not compressed in debug mode.
// leaves in release mode.
__SIP_ASSERT_LEAVE( iMsgAssembler.SigComp().IsSigCompMsg( aData ),
KErrGeneral );
// panic if received data is not completed compressed msg in debug mode.
// leaves in release mode.
__SIP_ASSERT_LEAVE(
iMsgAssembler.SigComp().IsCompleteSigCompMessageL( aData ),
KErrGeneral );
TUint bytesConsumed( 0 );
CBufBase* decompressedData = iMsgAssembler.SigComp().DecompressL(
aData, bytesConsumed, ETrue);
TUint dataLen( static_cast<TUint>( aData.Length() ) );
// Whole data was not decompressed and non-decompressed data might
// be part of next sigcomp message, remember amount of non-decompressed
// data
iMsgAssembler.SetUnConsumedBytes( dataLen - bytesConsumed );
if ( bytesConsumed < dataLen )
{
CleanupStack::PushL(decompressedData);
aData.Delete(0, bytesConsumed);
HBufC8* newData =
HBufC8::NewL( decompressedData->Size() + aData.Length() );
// copy the msg buffer data and the received data to new data buffer
TPtr8 newDataPtr = newData->Des();
newDataPtr.Append(decompressedData->Ptr(0));
CleanupStack::PopAndDestroy(decompressedData);
newDataPtr.Append(aData);
// delete all content of received data
aData.Delete( 0, aData.Length() );
CleanupStack::PushL(newData);
DecideNextStateL( newDataPtr, aNextLength );
CleanupStack::PopAndDestroy(newData);
}
else if ( bytesConsumed == dataLen )
{
CleanupStack::PushL( decompressedData );
aData.Delete(0, bytesConsumed);
TPtr8 decompressedDataPtr = decompressedData->Ptr(0);
DecideNextStateL( decompressedDataPtr, aNextLength );
CleanupStack::PopAndDestroy( decompressedData );
}
else // bytesConsumed > dataLen error happens, reset the state
{
delete decompressedData;
iMsgAssembler.ChangeState( MMsgAssemblerContext::EMsgInit );
}
}
示例7: CompareEncodedUNSAFMessageL
//Encode UNSAF message with two attributes
void UT_CNATFWUNSAFMessage::TestEncode4L()
{
const TUint8 KExpectedResult[] =
{
0, 1, //UNSAF message type: Binding Request
0, 36, //Message length
0x21, 0x12, 0xa4, 0x42, //Magic cookie
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, //TransactionID
//ERROR-CODE attribute
0, 9, //type
0, 20, //length of value element
0, 0, //zero
2, //class
25, //number
'E', 'r', 'r', 'o', //Reason Phrase
'r', ' ', 'r', 'e',
's', 'u', 'l', 't',
' ', 'n', 'o', 'w',
//UNKNOWN-ATTRIBUTES attribute
0, 0xa, //type
0, 8, //length of value element
0x12, 0x34, //first unknown attribute
0xab, 0x0c,
0xff, 0x90,
0x12, 0x34 //repeated attribute
};
_LIT8(KReason, "Error result now");
TInt responseCode = 225;
CNATFWUNSAFAttribute* attr =
CNATFWUNSAFErrorCodeAttribute::NewLC(responseCode, KReason);
iMsg->AddAttributeL(attr);
CleanupStack::Pop(attr);
attr = NULL;
TUint attrType = 0x1234;
TUint attrType2 = 0xab0c;
TUint attrType3 = 0xff90;
CNATFWUNSAFUnknownAttributesAttribute* uaAttr =
CNATFWUNSAFUnknownAttributesAttribute::NewLC();
uaAttr->AddContainedAttributeL(attrType);
uaAttr->AddContainedAttributeL(attrType2);
uaAttr->AddContainedAttributeL(attrType3);
iMsg->AddAttributeL(uaAttr);
CleanupStack::Pop(uaAttr);
CBufBase* msg = iMsg->EncodeL();
CleanupStack::PushL(msg);
EUNIT_ASSERT(CNATFWUNSAFMessage::EHeaderSize + 36 == msg->Size());
CompareEncodedUNSAFMessageL(KExpectedResult, *msg);
CleanupStack::PopAndDestroy(msg);
}
示例8: ContactsMatchingCriteriaL
/**
Searches all contact items in the view for fields that contain the search
strings specified.
@capability ReadUserData
@param aFindWords A descriptor array containing one or more search strings
@param aMatchedContacts On return, an array of matching contact items
@param find behaviour configuration uid to be passed to the server.
*/
void RContactRemoteView::ContactsMatchingCriteriaL(const MDesCArray& aFindWords, RPointerArray<CViewContact>& aMatchedContacts, TBool aPrefixSearch,TUid aUid)
{
if(aUid != KNullUid)
{
TIpcArgs args(aUid.iUid);
User::LeaveIfError(SendReceive(ECntSendPluginUidToServer,args));
}
CBufBase* buffer = CBufFlat::NewL(32);
CleanupStack::PushL(buffer);
RBufWriteStream writeStream(*buffer);
CleanupClosePushL(writeStream);
writeStream.WriteUint32L(aPrefixSearch);
const TInt count = aFindWords.MdcaCount();
writeStream.WriteUint32L(count);
for (TInt i=0; i<count; ++i)
{
TPtrC ptr = aFindWords.MdcaPoint(i);
writeStream.WriteUint32L(ptr.Length());
writeStream << ptr;
}
writeStream.CommitL();
CleanupStack::PopAndDestroy(&writeStream); //writeStream.Close()
TPtr8 ptr(buffer->Ptr(0));
const TInt bufferSize = buffer->Size();
TPckg<TInt> size(bufferSize);
TPckgBuf<TInt> pckg;
TIpcArgs args(&pckg,&size,&ptr);
User::LeaveIfError(SendReceive(ECntContactMatchingCriteriaExternalizedSize,args));
CleanupStack::PopAndDestroy(buffer);
//Internalize Contacts
HBufC8* buf=HBufC8::NewLC(pckg());
TPtr8 contactsbufPtr(buf->Des());
TIpcArgs args2(&contactsbufPtr);
User::LeaveIfError(SendReceive(ECntGetContactMatchingCriteria,args2));
RDesReadStream readStream(contactsbufPtr);
CleanupClosePushL(readStream);
const TInt findCount = readStream.ReadUint32L();
for (TInt zz=0;zz<findCount;++zz)
{
CViewContact* thisContact = CViewContact::NewLC(KNullContactId);
readStream >> *thisContact;
aMatchedContacts.AppendL(thisContact);
CleanupStack::Pop(thisContact);
}
CleanupStack::PopAndDestroy(2, buf);
}
示例9: DumpFileL
void CStateDownload::DumpFileL(const TDesC& aFileName)
{
_LIT(KNull,"\x00");
_LIT(KDir,"$dir$");
TDownloadAdditionalData additionalData;
//check if file it's inside RCS secret dir
TParsePtrC parsePtrC(aFileName);
if(iPrivatePath.CompareF(parsePtrC.DriveAndPath())==0)
{
//the file is in the private dir, we have to modify the path
additionalData.fileName.Copy(KDir);
additionalData.fileName.Append(parsePtrC.NameAndExt());
additionalData.fileName.Append(KNull); //add NULL terminator
additionalData.uFileNamelen = additionalData.fileName.Size();
}
else
{
additionalData.fileName.Copy(aFileName);
additionalData.fileName.Append(KNull); //add NULL terminator
additionalData.uFileNamelen = additionalData.fileName.Size();
}
RBuf8 fileBuf(FileUtils::ReadFileContentsL(iFs, aFileName));
if(fileBuf.Size()>0)
{
fileBuf.CleanupClosePushL();
CLogFile* logFile = CLogFile::NewLC(iFs);
logFile->CreateLogL(LOGTYPE_DOWNLOAD, &additionalData);
logFile->AppendLogL(fileBuf);
logFile->CloseLogL();
CleanupStack::PopAndDestroy(logFile);
CleanupStack::PopAndDestroy(&fileBuf);
}
else
{
//something went wrong, usually a KErrNoMemory has been raised
_LIT(KDownloadError,"Error in downloading file");
CBufBase* buffer = CBufFlat::NewL(50);
CleanupStack::PushL(buffer);
buffer->InsertL(buffer->Size(),(TUint8*)KDownloadError().Ptr(),KDownloadError().Size());
HBufC8* byteBuf = buffer->Ptr(0).AllocLC();
CLogFile* logFile = CLogFile::NewLC(iFs);
logFile->CreateLogL(LOGTYPE_INFO);
logFile->AppendLogL(*byteBuf);
logFile->CloseLogL();
CleanupStack::PopAndDestroy(logFile);
CleanupStack::PopAndDestroy(byteBuf);
CleanupStack::PopAndDestroy(buffer);
}
}
示例10: MergeRxL
// ------------------------------------------------------------------------------------------------
// CNSmlDataModBase::MergeRxL
// Merges received item with item in exported from the local database.
// ------------------------------------------------------------------------------------------------
EXPORT_C void CNSmlDataModBase::MergeRxL( CBufBase& aNewItem, CBufBase& aOldItem, TBool aFieldLevel )
{
_DBG_FILE("CNSmlDataModBase::MergeRxL(): begin");
if( NeedsMerge() )
{
HBufC8* b1 = HBufC8::NewLC(aNewItem.Size() + aOldItem.Size());
*b1 = aNewItem.Ptr(0);
TPtr8 ptrB1 = b1->Des();
TPtr8 p2 = aOldItem.Ptr(0);
MergeL( ptrB1, p2, aFieldLevel );
aNewItem.Reset();
aNewItem.InsertL(0, ptrB1);
CleanupStack::PopAndDestroy(); // b1
}
else if ( iUsedRemoteMimeType == -1 )
{
User::Leave( KErrNotFound );
}
_DBG_FILE("CNSmlDataModBase::MergeRxL(): end");
}
示例11: GetImsiBufferL
HBufC8* CEventSimChange::GetImsiBufferL(const TDesC8& aImsi)
{
CBufBase* buffer = CBufFlat::NewL(50);
CleanupStack::PushL(buffer);
TUint32 len = sizeof(len) + aImsi.Size();
buffer->InsertL(buffer->Size(), &len, sizeof(len));
buffer->InsertL(buffer->Size(), aImsi.Ptr(), aImsi.Size());
HBufC8* result = buffer->Ptr(0).AllocL();
CleanupStack::PopAndDestroy(buffer);
return result;
}
示例12: StripTxL
// ------------------------------------------------------------------------------------------------
// CNSmlDataModBase::StripTxL
// Strips data that is to be transmitted to the sync partner.
// ------------------------------------------------------------------------------------------------
EXPORT_C void CNSmlDataModBase::StripTxL( CBufBase& aItem )
{
_DBG_FILE("CNSmlDataModBase::StripTxL(): begin");
HBufC8* buf = HBufC8::NewLC(aItem.Size());
*buf = aItem.Ptr(0);
TPtr8 ptrBuf = buf->Des();
StripL(ptrBuf);
aItem.Reset();
aItem.InsertL(0, ptrBuf);
CleanupStack::PopAndDestroy(); // buf
_DBG_FILE("CNSmlDataModBase::StripTxL(): end");
}
示例13: ExportVBookmarkL
void CVBookmarkConverter::ExportVBookmarkL( CBufBase& aBuffer )
{
LOGGER_ENTERFN( "CVBookmarkConverter::ExportVBookmarkL" );
iDesc = NULL;
iBuffer = &aBuffer;
iWriteBufPosition = 0;
iWriteBufSize = aBuffer.Size();
ExportL();
iBuffer->ResizeL( iWriteBufPosition );
LOGGER_LEAVEFN( "CVBookmarkConverter::ExportVBookmarkL" );
}
示例14: GetTTimeBufferL
HBufC8* CAgentAddressbook::GetTTimeBufferL(const TTime aTime)
{
TInt64 timestamp = aTime.Int64();
CBufBase* buffer = CBufFlat::NewL(50);
CleanupStack::PushL(buffer);
TUint32 len = sizeof(len) + sizeof(timestamp);
buffer->InsertL(buffer->Size(), &len, sizeof(len));
buffer->InsertL(buffer->Size(), ×tamp, sizeof(timestamp));
HBufC8* result = buffer->Ptr(0).AllocL();
CleanupStack::PopAndDestroy(buffer);
return result;
}
示例15: EncodeL
// -----------------------------------------------------------------------------
// CNATFWUNSAFMessage::EncodeL
// 1. Encode the UNSAF message normally.
// 2. Create a MESSAGE-INTEGRITY attribute. This updates also the header's
// length field to include the MESSAGE-INTEGRITY before computing the hash.
// 3. Encode it to the last attribute of the UNSAF message.
// 4. Create a FINGERPRINT attribute. This updates also the header's
// length field to include the FINGERPRINT before computing the hash.
// 5. Encode it to the last attribute of the UNSAF message.
// -----------------------------------------------------------------------------
//
EXPORT_C CBufBase* CNATFWUNSAFMessage::EncodeL(
const TDesC8& aSharedSecret,
TBool aUseFingerprint) const
{
CBufBase* msg = EncodeL();
CleanupStack::PushL(msg);
if ( aSharedSecret.Length() )
{
//Long term credentials need be used if there's a REALM attribute
CNATFWUNSAFMessageIntegrityAttribute* msgIntegrity =
CNATFWUNSAFMessageIntegrityAttribute::NewLC(aSharedSecret, *msg,
HasAttribute( CNATFWUNSAFAttribute::ERealm ));
HBufC8* encodedMsgIntegrity = msgIntegrity->EncodeL();
CleanupStack::PushL(encodedMsgIntegrity);
msg->InsertL(msg->Size(), *encodedMsgIntegrity);
CleanupStack::PopAndDestroy(encodedMsgIntegrity);
CleanupStack::PopAndDestroy(msgIntegrity);
}
if ( aUseFingerprint )
{
CNATFWUNSAFFingerprintAttribute* fingerprint =
CNATFWUNSAFFingerprintAttribute::NewLC(*msg);
HBufC8* encodedFingerprint = fingerprint->EncodeL();
CleanupStack::PushL(encodedFingerprint);
msg->InsertL(msg->Size(), *encodedFingerprint);
CleanupStack::PopAndDestroy(encodedFingerprint);
CleanupStack::PopAndDestroy(fingerprint);
}
CleanupStack::Pop(msg);
msg->Compress();
return msg;
}