当前位置: 首页>>代码示例>>C++>>正文


C++ CBufBase::Read方法代码示例

本文整理汇总了C++中CBufBase::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ CBufBase::Read方法的具体用法?C++ CBufBase::Read怎么用?C++ CBufBase::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBufBase的用法示例。


在下文中一共展示了CBufBase::Read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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 );  
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:27,代码来源:ut_cstunbinding.cpp

示例2: GenerateL

// ---------------------------------------------------------------------------
// CNSmlDmACLParser::GenerateL()
// Generates ACL data string from the kept data.
// ---------------------------------------------------------------------------
HBufC8* CNSmlDmACLParser::GenerateL()
	{
	CBufBase *acl = CBufFlat::NewL(32);
	CleanupStack::PushL(acl);

	CNSmlAclElement* aclElement=iCommandAcls;

	while(aclElement)
		{
		TBool anyServerIds=EFalse;
		if(aclElement->iAllServers||aclElement->iServerIds.Count())
			{
			anyServerIds = ETrue;
			switch(aclElement->iCommandType)
				{
				case EAclAdd:
					acl->InsertL(acl->Size(),KNSmlDmAclAddEqual);
					break;
				case EAclReplace:
					acl->InsertL(acl->Size(),KNSmlDmAclReplaceEqual);
					break;
				case EAclDelete:
					acl->InsertL(acl->Size(),KNSmlDmAclDeleteEqual);
					break;
				case EAclGet:
					acl->InsertL(acl->Size(),KNSmlDmAclGetEqual);
					break;
				case EAclExecute:
					acl->InsertL(acl->Size(),KNSmlDmAclExecEqual);
					break;
				default:
					User::Panic(KSmlDmTreeDbHandlerPanic,KErrArgument);
					break;
				}
			if(aclElement->iAllServers)
				{
				acl->InsertL(acl->Size(),KNSmlDmAclAll);
				}
			else
				{
				for(TInt i=0;i<aclElement->iServerIds.Count();i++)
					{
					acl->InsertL(acl->Size(),*aclElement->iServerIds[i]);
					if(i<aclElement->iServerIds.Count()-1)
						{
						acl->InsertL(acl->Size(),KNSmlDmAclServerIdSeparator);
						}
					}
				}
			}

		aclElement=aclElement->iNext;
		if(aclElement&&anyServerIds)
			{
			acl->InsertL(acl->Size(),KNSmlDmAclSeparator);
			}
		}
	
	HBufC8 *aclBuf = HBufC8::NewL(acl->Size());
	TPtr8 bufPtr = aclBuf->Des();
	acl->Read(0,bufPtr,acl->Size());
	CleanupStack::PopAndDestroy(); //acl
	return aclBuf;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:68,代码来源:nsmldmaclparser.cpp


注:本文中的CBufBase::Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。