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


C++ TBuf8::Format方法代码示例

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


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

示例1: OnEndPrefixMappingL

/**
This method is a notification of the end of the scope of a prefix-URI mapping.
This method is called after the corresponding DoEndElementL method.
@param				aPrefix is the Namespace prefix that was mapped.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode)
{
	_LIT8(KOnEndPrefMapFuncName,"OnEndPrefixMapping()\r\n");
	_LIT8(KInfoOnEndPref,"\tPrefix mapping end prefix: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	
	iLog.Write(KOnEndPrefMapFuncName);
	
	if (aErrorCode == KErrNone)
	{
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		
		info2.Copy(aPrefix.DesC());		
		
		info.Format(KInfoOnEndPref,&info2);
	
		iLog.Write(info);
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:33,代码来源:testcontenthandler.cpp

示例2: OnContentL

/**
This method is a callback that sends the content of the element.
Not all the content may be returned in one go. The data may be sent in chunks.
When an OnEndElementL is received this means there is no more content to be sent.
@param				aBytes is the raw content data for the element. 
					The client is responsible for converting the data to the 
					required character set if necessary.
					In some instances the content may be binary and must not be converted.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnContentL(const TDesC8& aBytes, TInt aErrorCode)
	 {
	_LIT8(KOnContentFuncName,"OnContent()\r\n");
	_LIT8(KInfoOnContent,"\tContent of element: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	iLog.Write(KOnContentFuncName);
	if (aErrorCode == KErrNone)
		{
		if(aBytes.Length() >= KShortInfoSize)
			{ 
			TPtrC8 bytes = aBytes.Ptr();
			HBufC8* buf1 = HBufC8::NewL(aBytes.Length() + 100);
			buf1->Des().Format(KInfoOnContent,&bytes);
			iLog.Write(*buf1);
			}
		info2.Copy(aBytes);
		info2.Trim();
		if (info2.Length())
			{
			info.Format(KInfoOnContent,&info2);
			iLog.Write(info);
			}
		}
		else
			{
			TBuf8<KShortInfoSize> info;
			info.Format(KInfoOnError,aErrorCode);
			iLog.Write(info);
			}
	  }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:43,代码来源:testcontenthandler.cpp

示例3: if

void CScreenDriverVT100::Clear(const TRect& aRect)
//
// Clear a rectangle of the screen
//
	{
	TInt j;
	TBuf8<0x100> buf;
	for (j=aRect.iTl.iY; j<=aRect.iBr.iY; j++)
		{
		TUint8 *ptr=iScreenBuffer+(aRect.iTl.iX+j*KScreenWidth);
		Mem::FillZ(ptr, aRect.iBr.iX-aRect.iTl.iX);
		}
	if ((aRect.iTl.iY == aRect.iBr.iY) && (aRect.iTl.iX==0) && (aRect.iBr.iX==KScreenWidth-1))
		{
		// Optimisation: one whole line
		buf.Format(_L8("\x1b[%02d;%02dH"), aRect.iTl.iY, 1);
		Print(buf);
		// Erase line
		buf.Format(_L8("\x1b[2K"));
		Print(buf);
		Print(_L8("\x1b[01;01H"));
		}
	else if ((aRect.iTl.iY == 0) && (aRect.iBr.iY == KScreenHeight-1) &&
						(aRect.iTl.iX == 0) && (aRect.iBr.iX == KScreenWidth-1))
		{
		// Optimisation: whole screen
		buf.Format(_L8("\x1b[2J"));
		Print(buf);
		Print(_L8("\x1b[01;01H"));
		}
	else
		Update(aRect);
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:33,代码来源:wd_vt100.cpp

示例4: OnIgnorableWhiteSpaceL

/**
This method is a notification of ignorable whitespace in element content.
@param				aBytes are the ignored bytes from the document being parsed.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode)
{
	_LIT8(KOnIgnorWhiteFuncName,"OnIgnorableWhiteSpace()\r\n");	
	_LIT8(KInfoOnIgnorWhiteSpace,"\tIgnoring white space: %S length: %d \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	
	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	
	iLog.Write(KOnIgnorWhiteFuncName);
	
	if (aErrorCode == KErrNone)
	{
		info2.Copy(aBytes);
		info2.Trim();
		
		if (info2.Length())
		{
			info.Format(KInfoOnIgnorWhiteSpace,&info2,info2.Length());
			iLog.Write(info);
		}
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:35,代码来源:testcontenthandler.cpp

示例5:

TBool CScreenDriverVT100::ScrollUp(const TRect& aRect)
//
// Scroll a rectangle of the screen up one line, don't update bottom line
//
	{
	TInt j;
	for (j=aRect.iTl.iY; j<aRect.iBr.iY; j++)
		{
		TUint8 *ptr=iScreenBuffer+(aRect.iTl.iX+j*KScreenWidth);
		Mem::Copy(ptr, ptr+KScreenWidth, aRect.iBr.iX-aRect.iTl.iX);
		}
	if ((aRect.iTl.iX<=1) && (aRect.iBr.iX>=KScreenWidth-2))
		{
		// Optimisation: range of whole lines
		TBuf8<0x100> buf;
		// cursor pos
		buf.Format(_L8("\x1b[%02d;%02dH\xd\xa\xba\x1b[%02dC\xba"), aRect.iBr.iY, 1, aRect.iBr.iX);
		Print(buf);
		// set scroll region
		buf.Format(_L8("\x1b[%02d;%02dr\xd\xa"), aRect.iTl.iY+1, aRect.iBr.iY);
		Print(buf);
		Print(_L8("\x1b[01;01H"));
		}
	else
		Update(aRect);

	return(ETrue);
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:28,代码来源:wd_vt100.cpp

示例6: OnSkippedEntityL

/**
This method is a notification of a skipped entity. If the parser encounters an 
external entity it does not need to expand it - it can return the entity as aName 
for the client to deal with.
@param				aName is the name of the skipped entity.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnSkippedEntityL(const RString& aName, TInt aErrorCode)
{
	_LIT8(KOnSkipEntFuncName,"OnSkippedEntity()\r\n");	
	_LIT8(KInfoOnEndPref,"\tSkipped entity: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	
	iLog.Write(KOnSkipEntFuncName);

	if (aErrorCode == KErrNone)
	{
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		
		info2.Copy(aName.DesC());		
		
		info.Format(KInfoOnEndPref,&info2);
	
		iLog.Write(info);
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}	
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:34,代码来源:testcontenthandler.cpp

示例7: OnStartDocumentL

/**
This method is a callback to indicate the start of the document.
@param				aDocParam Specifies the various parameters of the document.
					aDocParam.iCharacterSetName The character encoding of the document.
@param				aErrorCode is the error code. 
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode)
{
	_LIT8(KOnStartDocumentFuncName,"OnStartDocument()\r\n");
	_LIT8(KInfoOnStartDocP,"\tDocument start \tparameters: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
		
	iLog.Write(KOnStartDocumentFuncName);

	if (aErrorCode == KErrNone)
	{
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		
		info2.Copy(aDocParam.CharacterSetName().DesC());		

		info.Format(KInfoOnStartDocP,&info2);
		iLog.Write(info);
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:32,代码来源:testcontenthandler.cpp

示例8: OnEndElementL

/**
This method is a callback to indicate the end of the element has been reached.
@param				aElement is a handle to the element's details.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode)
{
	_LIT8(KOnEndElementFuncName,"OnEndElement()\r\n");
	_LIT8(KInfoOnEndElePU,"\tElement end namespace: %S \t prefix: %S \tname: %S\r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");

	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	TBuf8<KShortInfoSize> info3;
	TBuf8<KShortInfoSize> info4;
	
	iLog.Write(KOnEndElementFuncName);
	if (aErrorCode == KErrNone)
	{
		info2.Copy(aElement.LocalName().DesC());		
		info3.Copy(aElement.Uri().DesC());		
		info4.Copy(aElement.Prefix().DesC());
		
		info.Format(KInfoOnEndElePU,&info3,&info4,&info2);	
		iLog.Write(info);
	}
	else
	{
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}	
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:33,代码来源:testcontenthandler.cpp

示例9: DoInserts

void DoInserts(TInt aProcId, TInt aRecId1, TInt aRecId2)
	{
	TEST(TheDb != 0);
	
	TTime now;
	now.UniversalTime();
	TInt64 seed = now.Int64();
	
	const TInt KMaxFailingAllocationNo = 20;
	TInt lockcnt = 0;
	
	for(TInt recno=0;recno<KTestRecordCnt;)
		{
		//Insert record 1 under OOM simulation
		TInt failingAllocationNo = Math::Rand(seed) % (KMaxFailingAllocationNo + 1);
		__UHEAP_SETFAIL(RHeap::EDeterministic, failingAllocationNo );
		TBuf8<100> sql;
		sql.Format(_L8("INSERT INTO A VALUES(%d)"), aRecId1);
		TInt err = sqlite3_exec(TheDb, (const char*)sql.PtrZ(), 0, 0, 0);
		__UHEAP_SETFAIL(RHeap::ENone, 0);	
		TEST(err == SQLITE_NOMEM || err == SQLITE_BUSY || err == SQLITE_OK);
		if(err == SQLITE_BUSY)
			{
			++lockcnt;
			User::After(1);
			continue;	
			}
		else if(err == SQLITE_OK)
			{
			++recno;
			if((recno % 100) == 0)
				{
				RDebug::Print(_L("Process %d: %d records inserted.\r\n"), aProcId, recno);	
				}
			continue;	
			}
		//Insert record 2
		sql.Format(_L8("INSERT INTO A VALUES(%d)"), aRecId2);
		err = sqlite3_exec(TheDb, (const char*)sql.PtrZ(), 0, 0, 0);
		TEST(err == SQLITE_BUSY || err == SQLITE_OK);
		if(err == SQLITE_BUSY)
			{
			++lockcnt;
			User::After(1);
			continue;	
			}
		//SQLITE_OK case
		++recno;
		if((recno % 100) == 0)
			{
			RDebug::Print(_L("Process %d: %d records inserted.\r\n"), aProcId, recno);	
			}
		}
	RDebug::Print(_L("Process %d inserted %d records. %d locks occured.\r\n"), aProcId, KTestRecordCnt, lockcnt);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:55,代码来源:t_sqlitewsdinsert.cpp

示例10: MakeSurePanicDebugFileExistsL

// ---------------------------------------------------------
// CPosTp30::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp30::StartL()
    {
    _LIT(KTimeErr, "The request time for several simultaneously requests is > n*'request time for one request'");
    MakeSurePanicDebugFileExistsL();

    iDatabase = UseGeneratedDbFileL();
    delete iDatabase;
    iDatabase=NULL;
    iUseLogFromThreadIsDisabled = ETrue;
    AppendSearchResultsL();
    iAsyncSearch = ETrue;
    TTime start, stop;
    start.UniversalTime();
    StartMultipleClientsL(1);
    stop.UniversalTime();
	
	TInt64 msecOne = (stop.Int64() - start.Int64())/1000;
	
    _LIT8(KTrace, "%d simultaneously search request(s) = %d mseconds");
	TBuf8<100> msg;
	msg.Format(KTrace, 1, msecOne);
    iLog->Put(msg);

    start.UniversalTime();
    StartMultipleClientsL(KNoMultipleClients);
    stop.UniversalTime();
	iAsyncSearch = EFalse;

	TInt64 msecSeveral = (stop.Int64() - start.Int64())/1000;
    msg.Format(KTrace, KNoMultipleClients, msecSeveral);
    iLog->Put(msg);

    AssertTrueSecL((msecOne*KNoMultipleClients) >= msecSeveral, KTimeErr);

    iLog->Put(_L("Testing simultaneously search syncronously and remove all syncronously"));

    iRemoveTest=ETrue;
    StartMultipleClientsL(3);
    iRemoveTest=EFalse;

    delete iDatabase;
    iDatabase = NULL;
    iDatabase = UseGeneratedDbFileL();
    
    iLog->Put(_L("Testing simultaneously search asyncronously"));
    iAsyncSearch =  ETrue;
    StartMultipleClientsL(KNoMultipleClients);

////

    iLog->Put(_L("Testing simultaneously search asyncronously and remove all syncronously"));
    iRemoveTest=ETrue;
    StartMultipleClientsL(3);
    
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:61,代码来源:FT_CPosTp30.cpp

示例11:

// ----------------------------------------------------------------------------
// CSdpMediaField::EncodeL
// ----------------------------------------------------------------------------
//
EXPORT_C void
CSdpMediaField::EncodeL(RWriteStream& aStream, TBool aRecurse) const
{
    RStringF headername = iPool.StringF( SdpCodecStringConstants::EMedia,
                                         SdpCodecStringConstants::Table );
    aStream.WriteL(headername.DesC());
    aStream.WriteL(iMedia.DesC());
    aStream.WriteL(KSPStr);
    TBuf8<80> text;
    text.Format(_L8("%u"), iPort);
    aStream.WriteL(text);
    if(iPortCount>0)
    {
        aStream.WriteL(_L8("/"));
        text.Format(_L8("%u"), iPortCount);
        aStream.WriteL(text);
    }
    aStream.WriteL(KSPStr);
    aStream.WriteL(iProtocol.DesC());
    aStream.WriteL(KSPStr);
    aStream.WriteL(*iFormatList);
    aStream.WriteL(KCRLFStr);
    if(aRecurse)
    {
        SdpUtil::EncodeBufferL(*iInfo,
                               SdpCodecStringConstants::EInfo, aStream);
        SdpCodecTemplate<CSdpConnectionField>::EncodeArrayL(*iConnectionFields,
                aStream);
        SdpCodecTemplate<CSdpBandwidthField>::EncodeArrayL(*iBandwidthFields,
                aStream);
        SdpCodecTemplate<CSdpKeyField>::EncodeL(Key(), aStream);

        for (TInt i = 0; i < iAttributeFields->Count(); i++)
        {
            if (!(((*iAttributeFields)[i])->IsFmtAttribute()))
            {
                ((*iAttributeFields)[i])->EncodeL(aStream);
            }
        }

        for (TInt i = 0; i < iFmtAttrFields->Count(); i++)
        {
            ((*iFmtAttrFields)[i])->EncodeL(aStream);

            for (TInt j=0; j<iAttributeFields->Count(); j++)
            {
                if ((((*iAttributeFields)[j])->IsFmtAttribute()) &&
                        ((*iAttributeFields)[j])->BelongsTo(*(*iFmtAttrFields)[i]))
                {
                    ((*iAttributeFields)[j])->EncodeL(aStream);
                }
            }
        }
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:59,代码来源:SdpMediaField.cpp

示例12: OnStartElementL

/**
This method is a callback to indicate an element has been parsed.
@param				aElement is a handle to the element's details.
@param				aAttributes contains the attributes for the element.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, 
								 TInt aErrorCode)
{
	_LIT8(KOnStartElementFuncName,"OnStartElement()\r\n");
	_LIT8(KInfoOnStartElePU,"\tElement start namespace: %S \t prefix: %S \tname: %S\r\n");
	_LIT8(KInfoOnAttributePU,"\t\tAttribute namaspace: %S \t prefix: %S \tname: %S \t value: %S\r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");

	iLog.Write(KOnStartElementFuncName);
	
	if (aErrorCode == KErrNone)
	{
		
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		TBuf8<KShortInfoSize> info3;
		TBuf8<KShortInfoSize> info4;
		TBuf8<KShortInfoSize> info5;

		info2.Copy(aElement.LocalName().DesC());		
		info3.Copy(aElement.Uri().DesC());		
		info4.Copy(aElement.Prefix().DesC());
		
		info.Format(KInfoOnStartElePU,&info3,&info4,&info2);	
		iLog.Write(info);
		
		RArray <RAttribute> array = aAttributes;
		TInt size = array.Count();
		
		RAttribute attr;
		
		if ( size > 0 )
		{
			for ( TInt i = 0; i < size; i++)
			{
				attr = array[i];
				
				info2.Copy(attr.Attribute().LocalName().DesC());
				info3.Copy(attr.Attribute().Uri().DesC());		
				info4.Copy(attr.Attribute().Prefix().DesC());		
				info5.Copy(attr.Value().DesC());		
				
				info.Format(KInfoOnAttributePU,&info3,&info4,&info2,&info5);
				iLog.Write(info);
			}
		}
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:61,代码来源:testcontenthandler.cpp

示例13: GenerateInternalKey

TInt CConfigImpl::GenerateInternalKey(const TDesC8& aSection,TBuf8<15>& aKeyName)
	{
	TPtrC8 lastKey;
	TInt ret=GetKeyCount(aSection,lastKey);
	if (ret<0)
		{
		return ret;		
		}
	//either "mediaX" or "X"
	//TInt key=ret;

	if(aSection.Compare(KPrimaryFilterSection)== 0 ) 
	{
		TInt lastKeyValue=0;
		if(lastKey.Length())
			{
			TLex8 lex(lastKey);
			TInt err = lex.Val(lastKeyValue);
			if(err != KErrNone)
				return err;
			}
		aKeyName.Format(_L8("%03d"),++lastKeyValue);
	}
	else if(aSection.Compare(KSecondaryFilterSection) == 0)
	{
		TInt lastKeyValue=0;
		if(lastKey.Length())
			{
			TLex8 lex(lastKey);
			TInt err = lex.Val(lastKeyValue);
			if(err != KErrNone)
				return err;
			}
		aKeyName.Format(_L8("%04d"),++lastKeyValue);
	}
	else
	{
		TInt lastKeyValue=0;
		if(lastKey.Length())
			{
			TLex8 lex(lastKey);
			TInt err = lex.Val(lastKeyValue);
			if(err != KErrNone)
				return err;
			}
		aKeyName.Format(_L8("%d"),++lastKeyValue);
	}	
	return KErrNone;	
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:49,代码来源:sysconfigimpl.cpp

示例14: SetDtmfString

TInt CATDtmfVts::SetDtmfString(const TDesC& aDtmfString)
	{
	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDtmfVts::SetDtmfString()"));
	
	if (!StringIsDtmf(aDtmfString))
		{
		return KErrArgument;
		}
	
	TInt nLen = aDtmfString.Length();
	for (TInt n = 0; n < nLen; n++)
		{
		if (n == 0)
			{
			iTxBuffer.Format(KLtsyVTSFirstCharFormat, (TUint8)(aDtmfString[n]));
			}
		else
			{
			TBuf8<16> buf;
			buf.Format(KLtsyVTSMoreCharFormat, (TUint8)(aDtmfString[n]));
			
			if ((buf.Length() + iTxBuffer.Length()) >= KLtsyGenericBufferSize)
				{
				return KErrOverflow;
				}
			iTxBuffer.Append(buf);
			}
		}
	
	//Converts the content of this descriptor to upper case.
	iTxBuffer.UpperCase();
	iTxBuffer.Append(KLtsyCarriageReturn);
	
	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:35,代码来源:atdtmfvts.cpp

示例15: SetParamL

// -----------------------------------------------------------------------------
// CSIPParamContainerBase::SetParamL
// -----------------------------------------------------------------------------
//
void CSIPParamContainerBase::SetParamL(RStringF aName, TInt aValue)
	{
	__ASSERT_ALWAYS(aValue >= 0, User::Leave(KErrSipCodecAnyParam));
	TBuf8<KMaxNumericValueAsTextLength> valueAsText;
	valueAsText.Format(KTIntFormat,aValue);
	SetParamL(aName,valueAsText);
	}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:11,代码来源:CSIPParamContainerBase.cpp


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