本文整理汇总了C++中TDes::MaxSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes::MaxSize方法的具体用法?C++ TDes::MaxSize怎么用?C++ TDes::MaxSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes
的用法示例。
在下文中一共展示了TDes::MaxSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadDesc
static void ReadDesc(TDes& aDes, const TDesC& aFilename, RFs& aFs)
{
RFile file;
TInt err = file.Open(aFs, aFilename, EFileRead);
TheTest(err == KErrNone);
CleanupClosePushL(file);
TPtr8 ptr(reinterpret_cast<TUint8*>(const_cast<TUint16*>(aDes.Ptr())), aDes.MaxSize());
err = file.Read(ptr);
TheTest(err == KErrNone);
aDes.SetLength(ptr.Length() / sizeof(TText));
CleanupStack::PopAndDestroy(&file);
}
示例2: GetContentToBufferL
EXPORT_C void CBasePlugin::GetContentToBufferL(
const TFSMailMsgId& aMailBoxId,
const TFSMailMsgId& /*aParentFolderId*/,
const TFSMailMsgId& aMessageId,
const TFSMailMsgId& aMessagePartId,
TDes& aBuffer,
const TUint aStartOffset )
{
__LOG_ENTER( "GetContentToBufferL" )
CMsgStoreMessage* msg = GetCachedMsgL( aMailBoxId.Id(), aMessageId.Id() );
//could the cache be extended to cache the child parts in this case ?
CMsgStoreMessagePart* part = msg->ChildPartL( aMessagePartId.Id(), ETrue );
CleanupStack::PushL( part );
TUint outSize = aBuffer.MaxSize();
/**@ look for ways to avoid the copying.*/
__LOG_WRITE8_FORMAT1_INFO( "Output buffer size: %d bytes.", outSize );
HBufC8* buf = HBufC8::NewLC( outSize );
TPtr8 ptr = buf->Des();
part->FetchContentToBufferL( ptr, aStartOffset );
__LOG_WRITE8_FORMAT1_INFO(
"Msgstore content buffer size: %d bytes.", buf->Size() );
TUint msgStoreSize = ptr.Size();
TUint theSize = outSize > msgStoreSize ? msgStoreSize : outSize;
TPtrC16 convert( reinterpret_cast<const TUint16*>( buf->Ptr() ), theSize/2 );
aBuffer = convert;
CleanupStack::PopAndDestroy( buf );
CleanupStack::PopAndDestroy( part );
__LOG_EXIT
} //GetContentToBufferL.