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


C++ TBuf::AppendNumFixedWidth方法代码示例

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


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

示例1: OutputBinaryDataL

EXPORT_C void CMemSpyEngineOutputSink::OutputBinaryDataL( const TDesC& aFormat, const TUint8* aBufferAddress, const TUint8* aDisplayStartAddress, TInt aLength )
{
    _LIT(KAddresPostfix, ": ");
    _LIT(KDoubleSpace, "  ");
    _LIT(KSingleSpace, " ");

    const TInt maxLen = aLength;
    TInt len = aLength;
    const TUint8* pDataAddr = aBufferAddress;

    TBuf<81> out;
    TBuf<20> ascii;
    TInt offset = 0;
    const TUint8* a = pDataAddr;
    const TUint8* displayAddress = aDisplayStartAddress;
    //
    while(len>0)
    {
        out.Zero();
        ascii.Zero();
        out.AppendNumFixedWidth((TUint) displayAddress, EHex, 8);
        out.Append(KAddresPostfix);

        TUint b;
        for (b=0; b<16; b++)
        {
            TUint8 c = ' ';
            if	((pDataAddr + offset + b) < pDataAddr + maxLen)
            {
                c = *(pDataAddr + offset + b);
                out.AppendNumFixedWidth(c, EHex, 2);
            }
            else
            {
                out.Append(KDoubleSpace);
            }
            out.Append( KSingleSpace );
            if (c<=0x20 || c == 0x27 || c>=0x7f || c=='%')
                c=0x2e;
            ascii.Append(TChar(c));
        }
        out.Append(ascii);
        out.ZeroTerminate();

        FormatBuffer().Format( aFormat, &out );
        OutputLineL( FormatBuffer() );

        displayAddress += 16;
        a += 16;
        offset += 16;
        len -= 16;
    }
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:53,代码来源:MemSpyEngineOutputSink.cpp

示例2: ConnectL

// ---------------------------------------------------------
// CPosTp4723::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsClientPosTp4723::StartL()
    {
    ConnectL();
    SetupProxyPSYsL();
	
	TPositionModuleId modId = iUidSatInfoPsy;
    CRepository* repos = CRepository::NewL( KCRUidDefaultProxyConfiguration );    
    TBuf<40> idBuf;
    idBuf.AppendNumFixedWidth( modId.iUid, EHex, 8);
    TInt error = repos->Set(KDefaultProxyLastWorkingGpsPsy, idBuf);
    delete repos;
    User::LeaveIfError(error);
	
    TInt err = OpenPositioner();
    _LIT(KOpenErr, "Error when opening positioner, %d");
    AssertTrueL(err == KErrNone, KOpenErr, err);
    
    _LIT(KServiceName, "TP4723");
    iPositioner.SetRequestor(CRequestor::ERequestorService, 
		CRequestor::EFormatApplication, KServiceName);

    TPositionSatelliteInfo posInfo;
    // Request value should be 4722, even for TP4723...
    TInt request = 4722;
    
    // Default PSY won't pre-load Multi PSY since it is Internal
    VerifyPsyUnloadedL(iUidMultiPsy);
    // Default PSY should pre-load SetInfo PSY since it is External and supports GPS
    VerifyPsyLoadedL(iUidSatInfoPsy);
    
	//
	// Request 1
	//
    RequestL(posInfo, request, KEspectedErrorCodePSY1);    
      
    VerifyPositionFromL(posInfo, iUidSatInfoPsy);    
    VerifyRequestTimeLessThanL(1200000);
    
    VerifyPsyLoadedL(iUidSatInfoPsy);
    
    VerifyPositionL(posInfo, 40, 50, 60);
    }
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:48,代码来源:ctlbsclientpostp4723.cpp

示例3: FormSharedSecret

void CSmtpAuthCramMd5MechanismHelper::GetNextClientMessageL(TDes8& aNextMessage)
	{
	iNextClientMessage.Zero();

	if(iInProgress)
		{
		HBufC8* authbuffer = HBufC8::NewMaxLC(KImMailMaxBufferSize);//? 
		TPtr8 authbufferptr = authbuffer->Des();
		HBufC8* authbuffer2 = HBufC8::NewMaxLC(KImMailMaxBufferSize);//? 
		TPtr8 authbufferptr2 = authbuffer2->Des();
		HBufC8* authbuffer3 = HBufC8::NewMaxLC(KImMailMaxBufferSize);//? 
		TPtr8 authbufferptr3 = authbuffer3->Des();
		
		authbufferptr = iLastServerMessage;
		authbufferptr.Delete(0,4); //remove 334 from the begining of server response
		iEncoder.Decode(authbufferptr,authbufferptr2);
		//timestamp info now in authbufferptr2

		authbufferptr.Zero();
		authbufferptr3.Zero();
		authbufferptr = iSettings.Password();
		authbufferptr3 = FormSharedSecret(authbufferptr);
		authbufferptr.Zero();
		authbufferptr = authbufferptr3;  //now authbufferptr and authbufferptr3 contain the shared secret null padded to 64 bytes.
		TInt i=0;
		for (i=0; i<KMd5BlockLength; i++) 
			{
			authbufferptr[i] ^= 0x36; //ipad
			authbufferptr3[i] ^= 0x5c; //opad
			}

		authbufferptr.Append(authbufferptr2);

    	iMd5Hash->Reset();                                                                                                                                                                                                                                                                                                                ;
		authbufferptr2 = iMd5Hash->Hash(authbufferptr);

		authbufferptr3.Append(authbufferptr2);
		
		authbufferptr.Zero();
		iMd5Hash->Reset();
		authbufferptr = iMd5Hash->Hash(authbufferptr3);

		// MD5 algorithm ALWAYS returns 16 bytes of data - which will be converted into
		// 32 characters; each byte represented by a 2 character hex representation, 
		// eg 255="ff"
		TBuf<32> hexHash; 
		for (i=0;i<16;i++)
			{
			hexHash.AppendNumFixedWidth(authbufferptr[i],EHex,2);
			}

		authbufferptr3.Zero();
		authbufferptr3.Append(iSettings.LoginName());
		authbufferptr3.Append(_L8(" "));
		authbufferptr3.Append(hexHash);

		iEncoder.Encode(authbufferptr3, iNextClientMessage);
		iNextClientMessage.Append(KSmtpCrLf);
		CleanupStack::PopAndDestroy(3);	// authbufferptr3 ,authbufferptr2, authbufferptr
		aNextMessage = iNextClientMessage;
		}
	else
		{
		iNextClientMessage.Append(KSmtpAuthCommand);
		iNextClientMessage.Append(KCramMD5Mechanism);
		iNextClientMessage.Append(KSmtpCrLf);
		iInProgress=ETrue;
		aNextMessage = iNextClientMessage;
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:70,代码来源:smtpauthhelpers.cpp


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