本文整理汇总了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);
}
}
示例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));
}
}
示例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;
}