本文整理汇总了C++中TDesC8::AllocLC方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC8::AllocLC方法的具体用法?C++ TDesC8::AllocLC怎么用?C++ TDesC8::AllocLC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC8
的用法示例。
在下文中一共展示了TDesC8::AllocLC方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadArrayFromStringL
// -----------------------------------------------------------------------------
// ReadArrayFromStringL
// Reads the array from the string
// -----------------------------------------------------------------------------
//
LOCAL_C void ReadArrayFromStringL( const TDesC8& aString,
RPointerArray<HBufC8>& aArray )
{
RMemReadStream inRead( static_cast<const TAny*>( aString.Ptr() ), aString.Size() );
TInt size = 0;
HBufC8* addData = NULL;
TPtr8 dataBuffer(NULL,0,0);
CleanupClosePushL( inRead );
aArray.ResetAndDestroy();
for( TInt i = 0; i < aString.Size();)
{
// If there is not enough data to read the integer
// it means that it's an old version and the whole thing is the
// string since in previous versions only one string is stored
if(( aString.Size() - i) < sizeof(TInt) )
{
aArray.ResetAndDestroy();
addData = aString.AllocLC();
aArray.AppendL( addData );
CleanupStack::Pop();
CleanupStack::PopAndDestroy(); // inRead
return;
}
size = inRead.ReadInt32L();
i += sizeof(TInt);
// If the size is negative or the size left is not large enough
// it means that it's an old version and the whole thing is the
// string since in previous versions only one string is stored.
if( size < 0 || size > ( aString.Size() - i ) )
{
aArray.ResetAndDestroy();
addData = aString.AllocLC();
aArray.AppendL( addData );
CleanupStack::Pop();
CleanupStack::PopAndDestroy(); // inRead
return;
}
addData = HBufC8::NewMaxLC( size );
// Set the read buffer:
dataBuffer.Set(const_cast<TUint8*>(addData->Ptr()), 0, size);
// Read the data:
inRead.ReadL( dataBuffer );
aArray.AppendL( addData );
CleanupStack::Pop( addData );
i += size;
}
CleanupStack::PopAndDestroy();
return;
}
示例2: SetL
// -----------------------------------------------------------------------------
// CWPPushMessage::SetL
// -----------------------------------------------------------------------------
//
EXPORT_C void CWPPushMessage::SetL( const TDesC8& aHeader, const TDesC8& aBody )
{
HBufC8* header = aHeader.AllocLC();
HBufC8* body = aBody.AllocL();
CleanupStack::Pop(); // header
Set( header, body );
}
示例3: SetAnyFieldL
// -----------------------------------------------------------------------------
void CPresenceCacheBuddyInfo::SetAnyFieldL(
const TDesC16& aKey,
const TDesC8& aValue )
{
if( NPresenceCacheFieldName::KExpiry().CompareF( aKey ) == 0 )
{
TPckg<TInt64> expiryPck( iExpiryTime );
expiryPck.Copy( aValue );
// write also to key-value map
}
// Remove old values first
RemoveField( aKey );
HBufC8* valueBuffer = aValue.AllocLC();
HBufC* keyBuffer = aKey.AllocLC();
TInt insertPos = iIds.Find(0);
if ( insertPos < 0 )
{
insertPos = iIds.Count();
iIds.Append( keyBuffer );
iValues.Append( valueBuffer );
}
else
{
iIds[insertPos] = keyBuffer;
iValues[insertPos] = valueBuffer;
}
iHashMap.InsertL( keyBuffer, insertPos );
CleanupStack::Pop( keyBuffer );
CleanupStack::Pop( valueBuffer );
}
示例4: SetConfigKeyL
// -----------------------------------------------------------------------------
// CMceAvcCodec::SetConfigKeyL
// -----------------------------------------------------------------------------
//
EXPORT_C void CMceAvcCodec::SetConfigKeyL( const TDesC8& aConfigKey )
{
HBufC8* configKey = aConfigKey.AllocLC();
_FLAT_DATA->SetConfigKeyL( configKey );
CleanupStack::PopAndDestroy( configKey );
}
示例5: AppendRootIdL
// -----------------------------------------------------------------------------
// CSTSMidletInfo::AppendRootIdL
// Appends end entity ID value (hash of the end entity certificate) to array
// -----------------------------------------------------------------------------
void CSTSMidletInfo::AppendRootIdL(const TDesC8& aRootId)
{
HBufC8* rootBuf = aRootId.AllocLC();
//array takes the ownership
User::LeaveIfError(iRootIds.Append(rootBuf));
CleanupStack::Pop(rootBuf);
}
示例6: AppendEndEntityIdL
// -----------------------------------------------------------------------------
// CSTSMidletInfo::AppendEndEntityIdL
// Appends end entity ID value (hash of the end entity certificate) to array
// -----------------------------------------------------------------------------
void CSTSMidletInfo::AppendEndEntityIdL(const TDesC8& aEndEntityId)
{
HBufC8* endEntityBuf = aEndEntityId.AllocLC();
//array takes the ownership
User::LeaveIfError(iEndEntityIds.Append(endEntityBuf));
CleanupStack::Pop(endEntityBuf);
}
示例7: AddTransactionUrisL
void CPipeliningConfigTest::AddTransactionUrisL(const TDesC8& aUri, TInt aRepeatNumber)
{
for (TInt ii = 0; ii< aRepeatNumber; ++ii)
{
HBufC8* uri = aUri.AllocLC();
User::LeaveIfError(iTransactionUris.Append(uri));
CleanupStack::Pop(uri);
}
}
示例8: ConstructL
// -----------------------------------------------------------------------------
// CMceOutRefer::ConstructL
// -----------------------------------------------------------------------------
//
void CMceOutRefer::ConstructL( const TDesC8& aRecipient,
const TDesC8& aReferTo,
TType aType,
const TDesC8& aOriginator )
{
HBufC8* originator = aOriginator.AllocLC();
ConstructL( aRecipient, aReferTo, aType, originator );
CleanupStack::Pop( originator );
}
示例9: AddTypeL
// ---------------------------------------------------------
// CMediaDataClient::AddTypeL()
// ---------------------------------------------------------
//
TBool CMediaDataClient::AddTypeL( const TDesC8& aType )
{
if ( aType.Length() > COD_TYPE_MAX_LEN || !aType.Length() )
{
return EFalse;
}
HBufC8* type8 = aType.AllocLC();
iTypes->AppendL( *type8 );
CleanupStack::PopAndDestroy(); //type8
return ETrue;
}
示例10: SetSIPVersionL
// -----------------------------------------------------------------------------
// CSIPMessage::SetSIPVersionL
// -----------------------------------------------------------------------------
//
void CSIPMessage::SetSIPVersionL (const TDesC8& aSIPVersion)
{
__ASSERT_ALWAYS (SIPSyntaxCheck::SIPVersion(aSIPVersion),
User::Leave(KErrSipCodecSIPVersion));
HBufC8* tmp = aSIPVersion.AllocLC();
tmp->Des().UpperCase();
RStringF tmpString = SIPStrings::Pool().OpenFStringL(*tmp);
CleanupStack::PopAndDestroy(tmp);
iSIPVersion.Close();
iSIPVersion = tmpString;
}
示例11:
// -----------------------------------------------------------------------------
// SIPCodecUtils::CheckAndCreateTokenL
// -----------------------------------------------------------------------------
//
RStringF
SIPCodecUtils::CheckAndCreateTokenL(const TDesC8& aToken, TInt aLeaveCode)
{
HBufC8* tmp = aToken.AllocLC();
tmp->Des().Trim();
if (!SIPSyntaxCheck::Token(*tmp))
{
User::Leave(aLeaveCode);
}
RStringF tmpString = SIPStrings::Pool().OpenFStringL(*tmp);
CleanupStack::PopAndDestroy(tmp);
return tmpString;
}
示例12: CheckAndSetValueL
// -----------------------------------------------------------------------------
// SIPCodecUtils::CheckAndSetValueL
// -----------------------------------------------------------------------------
//
void SIPCodecUtils::CheckAndSetValueL(HBufC8*& aBuffer,
const TDesC8& aValue,
TInt aErr)
{
HBufC8* tmp = aValue.AllocLC();
tmp->Des().Trim();
if (!SIPSyntaxCheck::Token(*tmp))
{
User::Leave(aErr);
}
CleanupStack::Pop(tmp);
delete aBuffer;
aBuffer = tmp;
}
示例13: UpdateTurnSrvAddrL
// ---------------------------------------------------------------------------
// CNATFWDomainEntry::UpdateTurnSrvAddrL()
//
// ---------------------------------------------------------------------------
//
TInt CNATFWDomainEntry::UpdateTurnSrvAddrL( TInt aIndex, const TDesC8& aAddr )
{
if ( aIndex < 0 || aIndex >= iTurnSrvAddrArray.Count() )
{
return KErrArgument;
}
HBufC8* temp = aAddr.AllocLC();
delete iTurnSrvAddrArray[ aIndex ];
iTurnSrvAddrArray.Remove( aIndex );
iTurnSrvAddrArray.Compress();
iTurnSrvAddrArray.InsertL( temp, aIndex );
CleanupStack::Pop( temp );
return KErrNone;
}
示例14:
// -----------------------------------------------------------------------------
// CSyncMLFilterProperty::AddDefaultValueText8L
// Adds default value for text8 property.
// This is useful only if data type is text8.
// -----------------------------------------------------------------------------
EXPORT_C void CSyncMLFilterProperty::AddDefaultValueText8L(
TDesC8& aNewDefaultValue, const TBool aSelected )
{
if ( iDataTypeForDefaultValues != ESyncMLDataTypeText8 )
{
User::Leave( KErrNotSupported );
}
if ( aNewDefaultValue.Length() > iMaxTextLength )
{
User::Leave( KErrArgument );
}
iDefaultValueText8List.AppendL( aNewDefaultValue.AllocLC() );
CleanupStack::Pop(); // aNewDefaultValue.AllocLC()
iDefaultValueSelected.AppendL( aSelected );
}
示例15: UpdateStunPasswordL
// ---------------------------------------------------------------------------
// CNATFWDomainEntry::UpdateStunPasswordL()
//
// ---------------------------------------------------------------------------
//
TInt CNATFWDomainEntry::UpdateStunPasswordL( TInt aIndex,
const TDesC8& aPassword )
{
if ( aIndex < 0 || aIndex >= iStunPasswordArray.Count() )
{
return KErrArgument;
}
HBufC8* temp = aPassword.AllocLC();
delete iStunPasswordArray[ aIndex ];
iStunPasswordArray.Remove( aIndex );
iStunPasswordArray.Compress();
iStunPasswordArray.InsertL( temp, aIndex );
CleanupStack::Pop( temp );
return KErrNone;
}