本文整理汇总了C++中CBufBase::Compress方法的典型用法代码示例。如果您正苦于以下问题:C++ CBufBase::Compress方法的具体用法?C++ CBufBase::Compress怎么用?C++ CBufBase::Compress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBufBase
的用法示例。
在下文中一共展示了CBufBase::Compress方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExternalizeMPXCollectionTypeL
// -----------------------------------------------------------------------------
// CCommonTestClass::ExternalizeMPXCollectionTypeL()
// Returns: Symbian OS errors.
// -----------------------------------------------------------------------------
TInt CCommonTestClass::ExternalizeMPXCollectionTypeL()
{
FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL begin")));
iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL begin"));
TInt err = KErrNone;
if ( iType != NULL )
{
FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL started Externalize")));
iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL started Externalize"));
CBufBase* buffer = CBufFlat::NewL( 50 );
CleanupStack::PushL( buffer );
RBufWriteStream writeStream( *buffer );
CleanupClosePushL( writeStream );
iType->ExternalizeL( writeStream );
writeStream.CommitL();
buffer->Compress();
CleanupStack::PopAndDestroy( &writeStream );
CleanupStack::PopAndDestroy( buffer );
}
else
{
err = KErrBadTestParameter;
FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL Stif test script is wrong.")));
iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL Stif test script is wrong."));
}
FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL end err=%d"), err));
iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL end err=%d"), err);
return err;
}
示例2: MpxAttStreamingL
// -----------------------------------------------------------------------------
// CCommonTestClass::MpxAttStreamingL()
// Returns: Symbian OS errors.
// -----------------------------------------------------------------------------
TInt CCommonTestClass::MpxAttStreamingL(CStifItemParser& aItem)
{
FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL testing TMPXAttribute ExternalizeL and InternalizeL begin")));
iLog->Log(_L("CCommonTestClass::MpxAttStreamingL testing TMPXAttribute ExternalizeL and InternalizeL begin"));
TInt err=KErrNone;
TUint index;
// read in parameters
if ( aItem.GetNextInt(index) )
{
iLog->Log(_L("Missing Parameter: index."));
return KErrBadTestParameter;
}
if ( index >= iMPXAttArray.Count() )
{
iLog->Log(_L("Bad Parameter: index out of range."));
return KErrBadTestParameter;
}
FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL started ExternalizeL")));
iLog->Log(_L("CCommonTestClass::MpxAttStreamingL started ExternalizeL"));
CBufBase* buffer = CBufFlat::NewL( 50 );
CleanupStack::PushL( buffer );
RBufWriteStream writeStream( *buffer );
CleanupClosePushL( writeStream );
iMPXAttArray[index].ExternalizeL( writeStream );
writeStream.CommitL();
buffer->Compress();
CleanupStack::PopAndDestroy( &writeStream );
FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL started InternalizeL")));
iLog->Log(_L("CCommonTestClass::MpxAttStreamingL started InternalizeL"));
RBufReadStream readStream( *buffer );
CleanupClosePushL( readStream );
TMPXAttribute att;
att.InternalizeL( readStream );
CleanupStack::PopAndDestroy( &readStream );
CleanupStack::PopAndDestroy( buffer );
// verify streaming was correct
if ( !TMPXAttribute::Match(att, iMPXAttArray[index]) )
{
iLog->Log(_L("Streaming Failed Verification."));
err = KErrUnexpectedValue;
}
return err;
}
示例3: EncodeL
// -----------------------------------------------------------------------------
// CNATFWUNSAFMessage::EncodeL
// -----------------------------------------------------------------------------
//
EXPORT_C CBufBase* CNATFWUNSAFMessage::EncodeL() const
{
CBufBase* msg = EncodeMessageHeaderLC();
for (TInt i = 0; i < iAttributes.Count(); ++i)
{
if (iAttributes[i]->Type() != CNATFWUNSAFAttribute::EMessageIntegrity &&
iAttributes[i]->Type() != CNATFWUNSAFAttribute::EFingerprint)
{
HBufC8* attribute = iAttributes[i]->EncodeL();
CleanupStack::PushL(attribute);
msg->InsertL(msg->Size(), *attribute);
CleanupStack::PopAndDestroy(attribute);
}
}
CleanupStack::Pop(msg);
msg->Compress();
SetMessageLength(*msg);
return msg;
}
示例4: GoToNowPlaying
void PlayerController::GoToNowPlaying()
{
if (playerLaunched)
{
//Launch player
RWsSession wsSession;
User::LeaveIfError( wsSession.Connect() );
TApaTaskList list(wsSession);
TApaTask task = list.FindApp(KMusicPlayerAppUid);
CMPXParameter* param = new ( ELeave ) CMPXParameter();
CleanupStack::PushL( param );
param->iType.iUid = KMPXPluginTypePlaybackUid;
param->iCmdForward = EMPXCmdFwdNone;
CBufBase* buffer =
CBufFlat::NewL(3 );
CleanupStack::PushL( buffer );
RBufWriteStream writeStream( *buffer );
CleanupClosePushL( writeStream );
param->ExternalizeL( writeStream );
writeStream.CommitL();
buffer->Compress();
CleanupStack::PopAndDestroy( &writeStream );
if ( task.Exists() )
{
wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
buffer->Ptr( 0 ) );
}
else
{
RApaLsSession ls;
CleanupClosePushL( ls );
User::LeaveIfError( ls.Connect() );
TApaAppInfo appInfo;
User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) );
CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
apaCommandLine->SetExecutableNameL( appInfo.iFullName );
apaCommandLine->SetTailEndL( buffer->Ptr( 0 ) );
User::LeaveIfError( ls.StartApp( *apaCommandLine ) );
CleanupStack::PopAndDestroy(); // apaCommandLine
CleanupStack::PopAndDestroy(); // ls
}
CleanupStack::PopAndDestroy( buffer );
CleanupStack::PopAndDestroy( param );
wsSession.Close();
}
else if (radioLaunched)
{
RApaLsSession ls;
CleanupClosePushL( ls );
User::LeaveIfError( ls.Connect() );
TApaAppInfo appInfo;
User::LeaveIfError( ls.GetAppInfo( appInfo, KRadioUid ) );
CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
apaCommandLine->SetExecutableNameL( appInfo.iFullName );
User::LeaveIfError( ls.StartApp( *apaCommandLine ) );
CleanupStack::PopAndDestroy(); // apaCommandLine
CleanupStack::PopAndDestroy(); // ls
}
}