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


C++ TPtr8::AppendFormat方法代码示例

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


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

示例1: UsernameTokenL

EXPORT_C TInt CSenWsSecurityHeader::UsernameTokenL(const TDesC8& aUsername,
                                    const TDesC8& aPassword,
                                    HBufC8*& aToken)
    {
    TPtrC8 nsPrefix = KSecurityXmlNsPrefix();
    aToken = HBufC8::NewLC( KUsernameTokenStartTagFmt().Length() +
                            KUsernameFmt().Length() +
                            KUsernameTokenEndTag().Length() +
                            KPasswordStartTagDefaultFmt().Length() +
                            KPasswordEndTagFmt().Length() +
                            aPassword.Length() +
                            aUsername.Length() + 
                            nsPrefix.Length() * 6 );

    TPtr8 ptr = aToken->Des();
//    ptr.Format(KNameTokenFormat, &nsPrefix, &nsPrefix, &aUsername, &nsPrefix, &nsPrefix);
    ptr.Format(KUsernameTokenStartTagFmt, &nsPrefix);
    ptr.AppendFormat(KUsernameFmt, &nsPrefix, &aUsername, &nsPrefix);
    ptr.AppendFormat(KPasswordStartTagDefaultFmt, 
                     &nsPrefix, &aPassword); // no Type -attribute used
    ptr.AppendFormat(KPasswordEndTagFmt, &nsPrefix);
    ptr.AppendFormat(KUsernameTokenEndTag, &nsPrefix);
    CleanupStack::Pop();    // aToken
    return KErrNone;
    }
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:25,代码来源:senwssecurityheader.cpp

示例2: DetermineAccessInfoL

// ----------------------------------------------------------------------------
// CNetworkInfo::DetermineAccessInfoL
// Valid LAC and CellId are included also when iInfo.iAreaKnown is EFalse.
// ----------------------------------------------------------------------------
//
void CNetworkInfo::DetermineAccessInfoL()
	{
	iAccessInfoValue.Close();

	if ( iAccessType == i3gppGeran ||
	     iAccessType == i3gppUtranFdd ||
		 iAccessType == i3gppUtranTdd ||
		 iAccessType == i3gppCdma2000 )
		{
		//Long enough to hold:
		//	MCC: 3 digits
		//  MNC: 2 or 3 digits (depending on MCC value)
		//  LAC: 4 hex digits (16 bits)
		//  Cell Identity: 4 or 7 hex digits (16 or 28 bits)
		const TInt KAccessInfoStringLength = 18;
		HBufC8* accessInfo = HBufC8::NewLC( KAccessInfoStringLength );		
		TPtr8 ptr = accessInfo->Des();		

		//MCC = TBuf<4> RMobilePhone::TMobilePhoneNetworkCountryCode;
		//MNC = TBuf<8> RMobilePhone::TMobilePhoneNetworkIdentity;

		ptr.Append( iInfo.iMobileCountryCode.Left( 3 ) );		
		ptr.Append( iInfo.iMobileNetworkCode.Left( 3 ) );

		//LAC is a 16 bit value
		const TUint KLacMask = 0xffff;
		//Include leading zeros
		_LIT8( K16BitFormat, "%04x" );
		ptr.AppendFormat( K16BitFormat, iInfo.iLocationAreaCode & KLacMask );

		if ( iAccessType == i3gppGeran )
			{
			//CI (Cell Identity) is a 16 bit value
			const TUint KCellIdMask = 0xffff;
			ptr.AppendFormat( K16BitFormat, iInfo.iCellId & KCellIdMask );
			}
		else
			{
			//UMTS Cell Identity is a 28 bit value
			const TUint KUmtsCellIdMask = 0xfffffff;
			_LIT8( KUmtsCellIdFormat, "%07x" );
			ptr.AppendFormat( KUmtsCellIdFormat,
							  iInfo.iCellId & KUmtsCellIdMask );
			}

		iAccessInfoValue = SIPStrings::Pool().OpenFStringL( *accessInfo );		
		CleanupStack::PopAndDestroy( accessInfo );
		}
	else
		{		
		iAccessInfoValue = SIPStrings::StringF( SipStrConsts::EEmpty );
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:58,代码来源:NetworkInfo.cpp

示例3: HexDump

// ==========================================================================
// METHOD:  HexDump
//
// DESIGN:  
// ==========================================================================
void CLogFileHandler::HexDump( const TDesC8& /*aClassName*/,
                               const TDesC8& /*aFuncName*/,
                               const TDesC8& aBuffer )
    {
	TInt remainingLength = aBuffer.Length();
	TInt i = 0;
	
	while( remainingLength > 0 )
		{
        const TInt KHexDumpWidth=32;
		TInt n = Min( KHexDumpWidth, remainingLength );
		
		// Add the starting byte number.
        _LIT8(KFirstFormatString,"%04x : ");
		iFormatBuffer8.Format(KFirstFormatString, i);
		
		// Add hex values.
		TInt j;
		for (j=0; j<n; j++)
		    {		    
            _LIT8(KSecondFormatString,"%02x ");
			iFormatBuffer8.AppendFormat(KSecondFormatString, aBuffer[i+j]);
		    } // end for
			
        // Fill in incomplete lines.			
		while (j<KHexDumpWidth)
		    {		    
            _LIT8(KThreeSpaces,"   ");
			iFormatBuffer8.Append(KThreeSpaces);
			j++;
		    } // end while
		    
		// Add text representation.
        _LIT8(KTwoSpaces," ");
		iFormatBuffer8.Append(KTwoSpaces);
		for (j=0; j<n; j++)
		    {		    
            _LIT8(KThirdFormatString,"%c");
			iFormatBuffer8.AppendFormat( KThirdFormatString, aBuffer[i+j] );
		    } // end for
		
		iOutputBuffer.SetLength( 0 );		
		TRAP_IGNORE( WriteLineL( iFormatBuffer8 ) );
		
		remainingLength -= n;
		i += n;
		
		} // end while
		    
    } // END HexDump
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:55,代码来源:DebugLog.cpp

示例4:

HBufC8* MainWindow::DoMD5(const TDesC8& aString)
        {
        TBuf8<1024> string;
        string.Append(aString);
        string.Append(MD5_KEY);

        CMD5* md5 = CMD5::NewL();
        CleanupStack::PushL(md5);
        TPtrC8 hashedSig = md5->Hash(string);
        HBufC8* buf = HBufC8::NewL(hashedSig.Length() * 2);
        TPtr8 bufPtr = buf->Des();

        for (TInt i = 0; i < hashedSig.Length(); i++)
                bufPtr.AppendFormat(_L8("%+02x"), hashedSig[i]);

        CleanupStack::PopAndDestroy(md5);
        return buf;
        }
开发者ID:is00hcw,项目名称:mobile-sdk,代码行数:18,代码来源:mainwindow.cpp

示例5: ParaseResponseHeaders

void UPPayHttpConnection::ParaseResponseHeaders(RHTTPResponse resp)
{
	RHTTPHeaders headers = resp.GetHeaderCollection();
	THTTPHdrVal aHeaderValue;
	iStatusCode = resp.StatusCode();
	if (iStatusCode >= 200 && iStatusCode < 300)
	{
		
		RStringF contLength = stringPool.OpenFStringL(_L8("Content-Length"));
		headers.GetField(contLength, 0, aHeaderValue);
		contLength.Close();
		if (aHeaderValue.Type() == THTTPHdrVal::KTIntVal)
		{
			iContentLength = aHeaderValue.Int();
		}
		else
		{
			iContentLength = 200 * 1024;
		}
		//		if(iContentStartPos != 0)
		//		{
		//			HBufC8* fieldValBuf = HBufC8::NewLC(KMaxHeaderValueLength);
		//			RStringF  contentrange= stringPool.OpenFStringL(_L8("Content-Range"));
		//			TPtrC8 rawField(fieldValBuf->Des());
		//			if(headers.GetRawField(contentrange,rawField)==KErrNone)
		//			{
		//				fieldValBuf->Des().Zero();
		//			}
		//			contentrange.Close ( );
		//			CleanupStack::PopAndDestroy(fieldValBuf);
		//		}
	}
	//
	//	else
	//	{
	//		Stop(); 
	//		iObserver.StateChange(EHttpError);
	//	}

	if (response_header)
	{
		delete response_header;
	}
	response_header = HBufC8::NewL(2048);
	Mem::FillZ((void*) response_header->Ptr(), 2048);
	TPtr8 headPtr = response_header->Des();
	TVersion ver = resp.Version();
	headPtr.AppendFormat(_L8("HTTP/%d.%d %d "), ver.iMajor, ver.iMinor, iStatusCode);
	headPtr.Append(resp.StatusText().DesC());
	headPtr.Append(add2);

	RHTTPHeaders hdr = resp.GetHeaderCollection();
	THTTPHdrFieldIter it = hdr.Fields();
	THTTPHdrVal fieldVal;
	HBufC8* fieldValBuf = HBufC8::NewLC(KMaxHeaderValueLength);
	while (it.AtEnd() == EFalse)
	{
		RStringTokenF fieldName = it();
		RStringF fieldNameStr = stringPool.StringF(fieldName);
		TPtrC8 rawField(fieldValBuf->Des());
		if (hdr.GetRawField(fieldNameStr, rawField) == KErrNone)
		{
			headPtr.Append(fieldNameStr.DesC());
			headPtr.Append(add1);
			headPtr.Append(rawField);
			headPtr.Append(add2);
			fieldValBuf->Des().Zero();
		}
		++it;
	}
	CleanupStack::PopAndDestroy(fieldValBuf);
	
	if (iStatusCode == 301 || iStatusCode == 302)
	{
		if (iObserver)
		{
			iObserver->StateChange(ERedirect);
		}
	}
}
开发者ID:zhonghualee,项目名称:TestSymbian,代码行数:80,代码来源:UPPayHttpConnection.cpp


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