本文整理汇总了C++中TDesC16::AllocLC方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC16::AllocLC方法的具体用法?C++ TDesC16::AllocLC怎么用?C++ TDesC16::AllocLC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC16
的用法示例。
在下文中一共展示了TDesC16::AllocLC方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2:
// -----------------------------------------------------------------------------
// CSyncMLFilterProperty::AddDefaultValueText16L
// Adds default value for text16 property.
// This is useful only if data type is text16.
// -----------------------------------------------------------------------------
EXPORT_C void CSyncMLFilterProperty::AddDefaultValueText16L(
TDesC16& aNewDefaultValue, const TBool aSelected )
{
if ( iDataTypeForDefaultValues != ESyncMLDataTypeText16 )
{
User::Leave( KErrNotSupported );
}
if ( aNewDefaultValue.Length() > iMaxTextLength )
{
User::Leave( KErrArgument );
}
iDefaultValueText16List.AppendL( aNewDefaultValue.AllocLC() );
CleanupStack::Pop(); // aNewDefaultValue.AllocLC()
iDefaultValueSelected.AppendL( aSelected );
}