本文整理汇总了C++中TDes8::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes8::Append方法的具体用法?C++ TDes8::Append怎么用?C++ TDes8::Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes8
的用法示例。
在下文中一共展示了TDes8::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoBuf
EXPORT_C void CTestUtils::DoBuf(TDes8& buf, const TDesC& label, const TDesC8& data)
{
buf.Zero();
buf.Copy(label);
buf.Append(data);
buf.Append(_L("\r\n"));
}
示例2: InterfaceToBearer
/**
Convert data from the API's form (as we're given it by RemCon) the
bearer-specific form.
*/
TInt CCoreSerialConverter::InterfaceToBearer(TUid aInterfaceUid,
TUint aOperationId,
const TDesC8& aData,
TRemConMessageType aMsgType,
TDes8& aBearerData) const
{
TInt ret = KErrCorrupt;
if ( aData.Length() <= 10 )
{
if ( aMsgType == ERemConCommand )
{
aBearerData.Format(_L8("0x%08x 0x%02x %S %S"), aInterfaceUid, aOperationId, &KCmdText(), &aData);
// Pad it up in case aData was less than 4 characters.
while ( aBearerData.Length() < KRemConSerialBearerMessageLength )
{
aBearerData.Append(_L8(" "));
}
ret = KErrNone;
}
else if ( aMsgType == ERemConResponse )
{
aBearerData.Format(_L8("0x%08x 0x%02x %S %S"), aInterfaceUid, aOperationId, &KRspText(), &aData);
// Pad it up in case aData was less than 4 characters.
while ( aBearerData.Length() < KRemConSerialBearerMessageLength )
{
aBearerData.Append(_L8(" "));
}
ret = KErrNone;
}
}
return ret;
}
示例3: ValidateAndConvertPercentEncodedTriple
/**
Validates and Converts the valid Percent encoded triplets to Uppercase for specified
sub component of URI. For eg: Converts %3a to %3A
@param aData A reference to a string to be validated and converted to upper case.
@param aCaseNormalizedData A reference to a descriptor that is converted to
uppercase that is to be returned.
@return returns a bool whether it is a valid Percent encoded triplet
*/
TBool ValidateAndConvertPercentEncodedTriple(TDesC8& aData , TDes8& aCaseNormalizedData )
{
// See if the descriptor is actually long enough and
// Check that the three characters form an escape triple - first char is '%'
if( aData.Length() < KEscapeTripleLength || aData[KEscDelimiterPos] != KEscapeIndicator )
{
return EFalse;//do nothing
}
// Check that next two characters are valid
TInt mostSignificantDigitValue = KHexDigit().LocateF(aData[KMostSignificantNibblePos] );
TInt leastSignificantDigitValue = KHexDigit().LocateF(aData[KLeastSignificantNibblePos] );
if( mostSignificantDigitValue== KErrNotFound || leastSignificantDigitValue == KErrNotFound )
{
// Either of the characters were not a valid hex character
return EFalse;
}
aCaseNormalizedData.Zero();
aCaseNormalizedData.Append(KEscapeIndicator);
//Coverts most significant hex character to uppercase
(mostSignificantDigitValue >= 0 && mostSignificantDigitValue <= 0xF) ?
aCaseNormalizedData.Append(KHexDigit().Mid(mostSignificantDigitValue,1)) :
aCaseNormalizedData.Append(KHexDigit().Mid(mostSignificantDigitValue,1));
//Coverts least significant hex character to uppercase
(leastSignificantDigitValue >= 0 && leastSignificantDigitValue <= 0xF) ?
aCaseNormalizedData.Append(KHexDigit().Mid(leastSignificantDigitValue,1)) :
aCaseNormalizedData.Append(aData[KLeastSignificantNibblePos]);
return ETrue;
}
示例4: frameCount
// -----------------------------------------------------------------------------
// CG711PayloadFormatRead::GetNextFrameL
// Passes next audio frame decoded with DecodePayload(). Return ETrue if decoded
// frames are remaining.
// -----------------------------------------------------------------------------
//
TBool CG711PayloadFormatRead::GetNextFrame( TDes8& aToBuffer )
{
iFrameIndex++;
DP_G711_READ3( "CG711PayloadFormatRead::GetNextFrame - FrameCount: %d, FrameIndex: %d",
iFrameArray.Count(), iFrameIndex );
const TInt frameCount( iFrameArray.Count() );
if ( iFrameIndex == frameCount )
{
aToBuffer.Append( iFrameArray[iFrameIndex - 1] );
iFrameArray.Reset();
return EFalse;
}
else if ( iFrameIndex < frameCount )
{
aToBuffer.Append( iFrameArray[iFrameIndex - 1] );
return ETrue;
}
else
{
return EFalse;
}
}
示例5: FormatSqlStmt
static void FormatSqlStmt(TDes8& aSqlBuf, const char aSql[], TInt aRecIds[], TInt aRecCnt)
{
aSqlBuf.Copy(TPtrC8((const TUint8*)aSql));
aSqlBuf.Append(_L8("("));
for(TInt i=0;i<aRecCnt;++i)
{
aSqlBuf.AppendNum((TInt64)aRecIds[i]);
aSqlBuf.Append(_L8(","));
}
aSqlBuf.SetLength(aSqlBuf.Length() - 1);
aSqlBuf.Append(_L8(")"));
}
示例6: AddClockInfo
// -----------------------------------------------------------------------------
// CTransactionIDGenerator::AddClockInfo
// -----------------------------------------------------------------------------
//
void CTransactionIDGenerator::AddClockInfo( TDes8& aBuf ) const
{
TTime now;
now.UniversalTime();
TInt64 timeAsInt = now.Int64();
aBuf.Append( reinterpret_cast<const TUint8*>( &timeAsInt ),
sizeof( timeAsInt ) );
TUint ticks = User::TickCount();
aBuf.Append( reinterpret_cast<const TUint8*>( &ticks ), sizeof( ticks ) );
}
示例7: GetStopModeFunctionality
TBool TDebugFunctionality::GetStopModeFunctionality(TDes8& aDFBlock)
{
TUint32 size = GetStopModeFunctionalityBufSize();
if (aDFBlock.MaxLength() < size)
{
// Insufficient space to contain the debug functionality block
return EFalse;
}
TUint8* ptr = (TUint8*)&size;
aDFBlock.SetLength(0);
aDFBlock.Append(ptr, 4);
TVersion version = TVersion(KStopModeMajorVersionNumber, KStopModeMinorVersionNumber, KStopModePatchVersionNumber);
ptr = (TUint8*)&version;
aDFBlock.Append(ptr, sizeof(TVersion));
AppendBlock((const TSubBlock&)StopModeFunctionalityCore,aDFBlock);
AppendBlock((const TSubBlock&)StopModeFunctionalityFunctions,aDFBlock);
AppendBlock((const TSubBlock&)StopModeFunctionalityList,aDFBlock);
const TTagHeader& header = StopModeFunctionalityBuffers->iHeader;
aDFBlock.Append((TUint8*)&header, sizeof(TTagHeader));
for(TInt i=0; i<EBuffersLast; i++)
{
TTag tag;
TheDBufferManager.GetBufferDetails((TBufferType)i, tag);
aDFBlock.Append((TUint8*)&tag, sizeof(TTag));
}
if(aDFBlock.Length() != size - 4)
{
return EFalse;
}
TUint32* ptr32 = (TUint32*)aDFBlock.Ptr();
TUint32 checksum = 0;
for(TInt i=0; i<aDFBlock.Length(); i+=4)
{
checksum^=*ptr32;
ptr32++;
}
ptr = (TUint8*)&checksum;
aDFBlock.Append(ptr, 4);
return ETrue;
}
示例8: GetData
/**
* Get the data from the transaction
*
* Return the minimum of client buffer size and amount left to read
*/
TInt CDummyWSPCOTrans::GetData(TDes8& aBuffer, RWSPCOTrans::TDataType aDataType, TInt* aSizeLeft) const
{
__ASSERT_DEBUG(aBuffer.MaxSize()>0, User::Panic(_L("Client buffer not allocated"),0));
//const TDesC8* requestedData=*iDataArray[aDataType];
const TDesC8* requestedData= iDataArray[aDataType];
TInt bufferSize = aBuffer.MaxSize();
TInt reqSize = requestedData->Size();
TInt* offset = iOffsetArray.At(aDataType);
TInt retSize = Min(bufferSize, (reqSize - *offset));
aBuffer.Zero();
aBuffer.Append(requestedData->Mid(*offset, retSize));
*offset += retSize;
if (*offset==reqSize)
{
*aSizeLeft = 0;
*offset = 0;
return KErrNone;
}
else
{
*aSizeLeft = reqSize-*offset;
return RWAPConn::EMoreData;
}
}
示例9:
/**
* Convert a string to Hexadecimal
*
* @param aData String descriptor
* @param aDes Descriptor where Hex value is stored
*
* @return N/A
*
* @leave System wide error
*/
void CT_DataVerify::ConvertString2HexL( const TDesC8& aData, TDes8& aDes )
{
TBuf8<DataVerify::KCharlength> charBuf;
// Check that buffer is even number
if( ( aData.Length() % DataVerify::KCharlength ) != 0 )
{
User::Leave( KErrBadDescriptor );
}
// Go through the data and convert it two characters at a time
// buffer overflow does not occur because buffer is checked to be even number first
for( TInt i = 0, limit = aData.Length()-DataVerify::KCharlength; i <= limit; i+=DataVerify::KCharlength )
{
// Clean char buffer first
charBuf.Delete( 0, charBuf.Length() );
// Add KCharlength characters into buffer
for ( TInt j = 0; j < DataVerify::KCharlength; j++ )
{
charBuf.Append( aData[i+j] );
}
TUint number;
TLex8 converter = TLex8( charBuf );
// Two characters together represent a hex number in MD5 checksum
User::LeaveIfError( converter.Val( number, EHex ) );
aDes.Append( number );
}
}
示例10: Read
TPtrC8 Read(TDes8& aTempBuf, TPtrC8& aData, TInt aLength, TPtrC8& aOverflowData)
{
if (aLength <= aData.Length())
{
// Can read it from this buffer
TPtrC8 res(aData.Left(aLength));
aData.Set(aData.Mid(aLength));
return res;
}
else /*if (aLength > aData.Length())*/
{
// Descriptor spans wrap point, so need to copy into temp buf
aTempBuf.Copy(aData.Left(aTempBuf.MaxLength())); // If anyone's crazy enough to write a platsec diagnostic string longer than 2k, it gets truncated
TInt overflowLen = aLength - aData.Length();
aData.Set(aOverflowData); // Wrap aData
aOverflowData.Set(TPtrC8());
if (overflowLen > aData.Length())
{
ASSERT(EFalse); // Shouldn't happen
// in urel, return everything we've got
return aData;
}
aTempBuf.Append(aData.Left(overflowLen));
aData.Set(aData.Mid(overflowLen));
return TPtrC8(aTempBuf);
}
}
示例11: ReadString
TUint TInputManager::ReadString(TDes8& aStr)
{
TKeyCode key;
aStr.Zero();
while( (key = iConsole.Getch()) != EKeyEnter)
{
if (aStr.Length() == aStr.MaxLength())
return aStr.MaxLength();
if (key == EKeyBackspace)
{
if (aStr.Length() > 0)
{
aStr.Delete(aStr.Length()-1, 1);
ConsoleBackspace(1);
}
}
else
{
TUint8 keyChar(key);
aStr.Append(keyChar);
iConsole.Printf(_L("%c"), keyChar);
}
}
iConsole.Printf(_L("\n"));
return aStr.Length();
}
示例12: my_sprintf
static void my_sprintf(TDes8 &aBuf, const char *aFormat, ...)
{
VA_LIST list;
VA_START(list, aFormat);
Kern::AppendFormat(aBuf, aFormat, list);
aBuf.Append(TChar(0));
}
示例13: ReadNextLineL
TInt CTmsTestStep::ReadNextLineL( RFile &aFile, TDes8 &aLine )
// read a cr/lf limiited line from the file, assumes file is a valid file
// and that aLine is of sufficient length to hold the data
{
aLine.Zero();
TBuf8<1> chr;
for (;;)
{
aFile.Read(chr);
if ( chr.Length() == 0 )
{
break;
}
if (chr.CompareF(KRet) == 0)
{
// got a line, exctract newline as well
aFile.Read(chr);
break;
}
else
{
aLine.Append(chr);
}
}
return aLine.Length();
}
示例14: AppendBlock
/**
* Helper function to append a DebugFunctionalityXXX SubBlock
* into a TDes buffer
*/
void TDebugFunctionality::AppendBlock(const TSubBlock& aDFSubBlock, TDes8& aDFBlock)
{
// Copy the aSubDFBlock.header into aDFBlock (Note we don't put in a TSubBlock structure
// as the block is just that - a flat block so the pointer is not required)
TPtr8 SubDFBlockHdrPtr((TUint8*)&aDFSubBlock.iHeader,sizeof(TTagHeader),sizeof(TTagHeader));
aDFBlock.Append(SubDFBlockHdrPtr);
// Append all the Tags
for (TUint i=0; i<aDFSubBlock.iHeader.iNumTags; i++)
{
TPtr8 tmpPtr((TUint8*)&aDFSubBlock.iTagArray[i],sizeof(TTag),sizeof(TTag));
aDFBlock.Append(tmpPtr);
}
}
示例15:
// -----------------------------------------------------------------------------
// Converts from TDesC to TDesC8
// -----------------------------------------------------------------------------
//
void ConnMonUtils::TDesToTDes8( const TDes& aSrc, TDes8& aDest )
{
for ( TUint i = 0; i < aSrc.Length(); ++i )
{
aDest.Append( aSrc[i] & 0x00FF );
}
}