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


C++ TDes8::Replace方法代码示例

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


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

示例1:

/**
 * @internalTechnology
 * Writes DER-encoded bit string contents to aBuf. Prepends
 * the actual bit string octets with extra octet containing
 * number of unused bits in the last octet. Before writing,
 * converts contents of the bit string to big-endian form.
 * @param aBuf Buffer to write to; must be long enough;
 *     see #CalculateContentsLengthDER method.
 */
void CASN1EncBitString::WriteContentsDERL(TDes8& aBuf) const
{
    if (iContents->Length() > 0)
    {
        aBuf[0] = iPadding;
        TUint len = iContents->Length();
        // We do not need to swap bits, as it is already done.
        aBuf.Replace(1, len, *iContents);
    }
    else
    {
        // no padding octet for the empty bit string
        aBuf.SetLength(0);
    }
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:24,代码来源:bitstrenc.cpp

示例2: WriteL

void RTestExecuteLogServ::WriteL(TDes8& aLogBuffer)
/**
 * @param aLogBuffer - pre-formatted narrow buffer
 * 
 * Synchronous write to the server
 */
	{
	_LIT8(KEnd,"\r\n");
	// Check to see if there's room to add CRLF
	if(aLogBuffer.Length()+2 > aLogBuffer.MaxLength())
		{
		HBufC8* buffer = NULL;
		TRAPD(err, buffer=HBufC8::NewL(aLogBuffer.Length()+2));
		if (KErrNoMemory == err)
			{
			aLogBuffer.Replace(aLogBuffer.Length()-2, 2, KEnd);
			TIpcArgs args;
			args.Set(0,&aLogBuffer);
			args.Set(1,aLogBuffer.Length());
			User::LeaveIfError(SendReceive(EWriteLog,args));
			}
		else
			{
			CleanupStack::PushL(buffer);
			TPtr8 ptr(buffer->Des());
			ptr.Copy(aLogBuffer);
			ptr.Append(KEnd);
			TIpcArgs args;
			args.Set(0,&ptr);
			args.Set(1,ptr.Length());
			User::LeaveIfError(SendReceive(EWriteLog,args));
			CleanupStack::PopAndDestroy(buffer);
			}
		}
	else
		{
		aLogBuffer.Append(KEnd);
		TIpcArgs args;
		args.Set(0,&aLogBuffer);
		args.Set(1,aLogBuffer.Length());
		User::LeaveIfError(SendReceive(EWriteLog,args));
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:43,代码来源:client.cpp

示例3: WinsRemovableDrivesL

// -----------------------------------------------------------------------------
// CEcmtMMCEvent::WinsRemovableDrivesL
// Public method to get descrpitor containing removable drives
// -----------------------------------------------------------------------------
//
void CEcmtMMCEvent::WinsRemovableDrivesL( TDes8& aBuff )
	{
	//update list to get number of drives up to date
	iWinsRemDrives->UpdateRemDrives();
	//allocate space for drive letters string
	char* drives = new char[sizeof(char)* 3* iWinsRemDrives->NumOfDrives()+1];
	User::LeaveIfNull( drives );
	//get letters
	iWinsRemDrives->GetRemovableDrives( drives );
	const TPtrC8 iWinsDrives( (const TUint8*) drives, (TInt) strlen(drives) );
	aBuff.Copy( iWinsDrives );
	//remove / from string
	TChar ch('\\');
	TInt pos=aBuff.Locate( ch );
	while ( pos != KErrNotFound )
	{
		aBuff.Replace( pos, 1, KBlank );
		pos=aBuff.Locate( ch );
	}
		
	delete [] drives;
	}
开发者ID:fedor4ever,项目名称:packaging,代码行数:27,代码来源:EcmtMMCEvent.cpp


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