本文整理汇总了C++中TDes8::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes8::Copy方法的具体用法?C++ TDes8::Copy怎么用?C++ TDes8::Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes8
的用法示例。
在下文中一共展示了TDes8::Copy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecognizeFileL
TBool CRefTestAgentManager::RecognizeFileL(const TDesC& aFileName, const TDesC8& aBuffer, TDes8& aFileMimeType, TDes8& aContentMimeType) const
{
TBool result = EFalse;
// Check filename extension
TPtrC extension(aFileName.Right(KRtaExtensionContent().Length()));
if(extension.CompareF(KRtaExtensionContent) == 0)
{
// It's a content file ready for applications to read
aFileMimeType.Copy(KRtaMimeContent());
CRefTestAgentArchive::GetDefaultMimeTypeFromHeaderL(aBuffer, aContentMimeType);
result = ETrue;
}
else
{
extension.Set(aFileName.Right(KRtaExtensionContentRights().Length()));
if(extension.CompareF(KRtaExtensionContentRights) == 0)
{
// It's a content and rights file ready for the supplier API
aFileMimeType.Copy(KRtaMimeContentRights());
result = ETrue;
}
else
{
extension.Set(aFileName.Right(KRtaExtensionRights().Length()));
if(extension.CompareF(KRtaExtensionRights) == 0)
{
// It's a content and rights file ready for the supplier API
aFileMimeType.Copy(KXmlRORights());
result = ETrue;
}
}
}
return result;
}
示例2: GetSSID
/**
* Function that retrieves SSID of current scanned network
*
* The SSID is the Information Element with ID = 0
* The SSID can be at most 32 bytes, so the aSSID should have the capacity for 32 bytes
*
* Returns KErrNone if successful or the type of error ocurred
*/
TInt CAgentPosition::GetSSID(CWlanScanInfo *scanInfo, TDes8 &aSSID)
{
TInt error;
TUint8 ie;
TUint8 length;
TUint8 vdata[40];
const TUint8 *data = &vdata[0];
if((error = scanInfo->FirstIE(ie, length, &data)) == KErrNone)
{
if(ie == 0)
{
aSSID.Copy(data, length);
return KErrNone;
}
}
else
return error;
while((error = scanInfo->NextIE(ie, length, &data)) == KErrNone)
{
if(ie == 0)
{
aSSID.Copy(data, length);
return KErrNone;
}
}
return error;
}
示例3: Compensate
// ---------------------------------------------------------------------------
// CSensorDataCompensatorAxisDataHandler::Compensate
// ---------------------------------------------------------------------------
//
TInt CSensorDataCompensatorAxisDataHandler::Compensate( TDes8& aData )
{
FUNC_LOG;
TInt err( KErrNone );
TInt x( 0 );
TInt y( 0 );
TInt z( 0 );
TRACE_MATRIX( "Axis data compensation matrix", iMatrix );
if ( KSensrvChannelTypeIdMagnetometerXYZAxisData == iDataType )
{
INFO( "Compensating magnetometer data" );
TPckgBuf<TSensrvMagnetometerAxisData> pckg;
if ( aData.MaxSize() == pckg.MaxSize() )
{
pckg.Copy( aData );
iMatrix.Transform( x, y, z, pckg().iAxisXRaw, pckg().iAxisYRaw, pckg().iAxisZRaw );
INFO_3( "Compensated data Magnetometer raw [X: %d], [Y: %d], [Z: %d]", x, y, z );
pckg().iAxisXRaw = x;
pckg().iAxisYRaw = y;
pckg().iAxisZRaw = z;
iMatrix.Transform( x, y, z, pckg().iAxisXCalibrated, pckg().iAxisYCalibrated, pckg().iAxisZCalibrated );
INFO_3( "Compensated data Magnetometer calib [X: %d], [Y: %d], [Z: %d]", x, y, z );
pckg().iAxisXCalibrated = x;
pckg().iAxisYCalibrated = y;
pckg().iAxisZCalibrated = z;
aData.Copy( pckg );
}
else
{
err = KErrArgument;
}
}
else
{
INFO( "Compensating accelerometer data" );
TPckgBuf<TSensrvAccelerometerAxisData> pckg;
if ( aData.MaxSize() == pckg.MaxSize() )
{
pckg.Copy( aData );
iMatrix.Transform( x, y, z, pckg().iAxisX, pckg().iAxisY, pckg().iAxisZ );
INFO_3( "Compensated data accelerometer[X: %d], [Y: %d], [Z: %d]", x, y, z );
pckg().iAxisX = x;
pckg().iAxisY = y;
pckg().iAxisZ = z;
aData.Copy( pckg );
}
else
{
err = KErrArgument;
}
}
ERROR( err, "Axis data compensation error" );
return err;
}
示例4: ExtractEnumeratorComponentsL
LOCAL_C void ExtractEnumeratorComponentsL(
const TDesC8& aMessageBuffer,
TDes8& aStore,
TDes8& aNamespace,
TDes8& aHashKey )
{
TInt len;
TInt offset;
TInt total = aMessageBuffer.Length();
offset = 0;
len = aMessageBuffer[offset];
if ( len <= 0 || len > KMaxWmDrmStoreNameSize || offset + len + 1> total )
{
User::Leave( KErrArgument );
}
aStore.Copy( aMessageBuffer.Mid( offset + 1, len ) );
offset += len + 1;
if ( offset >= total )
{
User::Leave( KErrArgument );
}
len = aMessageBuffer[offset];
if ( len <= 0 || len > KMaxWmDrmNamespaceNameSize || offset + len + 1 > total )
{
User::Leave( KErrArgument );
}
aNamespace.Copy( aMessageBuffer.Mid( offset + 1, len ) );
offset += len + 1;
len = aMessageBuffer[offset];
if ( offset >= total )
{
User::Leave( KErrArgument );
}
if ( ( len > 0 && len != KWmDrmIdSize ) || offset + len + 1 > total )
{
User::Leave( KErrArgument );
}
else if ( len > 0 )
{
aHashKey.Copy( aMessageBuffer.Mid( offset + 1, len ) );
}
else
{
aHashKey.SetLength( 0 );
}
}
示例5: StraightCopy
TInt CImConvertCharconv::StraightCopy( const TDesC& aBufIn, TDes8& rBufOut)
{
TInt inLen=aBufIn.Length();
TInt outMaxLen=rBufOut.MaxLength();
if (inLen >= outMaxLen)
{
TPtrC16 in = aBufIn.Left(outMaxLen);
rBufOut.Copy(in);
return (inLen-outMaxLen);
}
else
rBufOut.Copy(aBufIn);
return 0;
}
示例6: TranslateCrLf
LOCAL_C TInt TranslateCrLf(TDes8 &aDes)
//
// Search for CR/LF characters in a string and replace them with
// '\r' '\n' format. Also replaces unprintable characters with "?"
//
{
TText8 buf[KBlockSize];
TText8 *pS=(TText8*)aDes.Ptr();
TText8 *pSE=pS+aDes.Size();
TText8 *pT=&buf[0];
TText8 *pTMax=pT+(KBlockSize-1);
for (; pS<pSE; pS++,pT++)
{
if (pT>=pTMax)
return(KErrTooBig);
if (*pS=='\xD'||*pS=='\xA')
{
*pT++='\\';
*pT=(*pS=='\xD')?'r':'n';
}
else if (((TChar)*pS).IsPrint())
*pT=*pS;
else
*pT='\?';
}
*pT=0;
if ((pT-&buf[0])>aDes.MaxLength())
return(KErrTooBig);
aDes.Copy(&buf[0]);
return(KErrNone);
}
示例7: BearerToInterface
TInt CCoreSerialConverter::BearerToInterface(const TDesC8& aBearerData,
TUid& aInterfaceUid,
TUint& aOperationId,
TRemConMessageType& aMsgType,
TDes8& aData) const
{
TInt ret = KErrCorrupt;
// We read KRemConSerialBearerMessageLength bytes at a time, so we should
// get precisely one message.
if ( aBearerData.Length() == KRemConSerialBearerMessageLength )
{
TPtrC8 ptr;
ptr.Set(aBearerData);
TPtrC8 interfaceUid;
interfaceUid.Set(ptr.Mid(2, 8));
TLex8 interfaceLex(interfaceUid);
TUint uid = 0;
ret = interfaceLex.Val(uid, EHex);
if ( ret == KErrNone )
{
aInterfaceUid = TUid::Uid(uid);
TPtrC8 operationId;
operationId.Set(ptr.Mid(13, 2));
TLex8 operationLex(operationId);
TUint id = 0;
ret = operationLex.Val(id, EHex);
if ( ret == KErrNone )
{
aOperationId = id;
TPtrC8 data;
data.Set(ptr.Mid(16, 3));
if ( data == KCmdText() )
{
aMsgType = ERemConCommand;
}
else if ( data == KRspText() )
{
aMsgType = ERemConResponse;
}
else
{
ret = KErrCorrupt;
}
if ( ret == KErrNone )
{
TPtrC8 data;
data.Set(ptr.Mid(20, 10));
aData.Copy(data);
}
}
}
}
return ret;
}
示例8: 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"));
}
示例9: ColumnBinary
/**
Copies the content of a binary column, identified by aColumnIndex, to the place refered by aDest parameter.
If the destination buffer is not big enough, the function will copy as much data as possible and will
return KErrOverflow.
@param aColumnIndex Column index
@param aDest Refers to the place where the column data will be copied.
@return KErrNone, if the function completes successfully,
otherwise one of the other system-wide error codes.
@panic SqlDb 5 Column index out of bounds.
@panic SqlDb 11 Statement cursor not positioned on a row
*/
TInt CSqlStatementImpl::ColumnBinary(TInt aColumnIndex, TDes8& aDest)
{
__ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex));
__ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow));
iColumnValBufIt.MoveTo(aColumnIndex);
TInt err = KErrNone;
//The binary column value has not been transferred to the client side if its length is >= KSqlMaxDesLen bytes.
//In this case an additional call to the server is made to get the column value.
if(!iColumnValBufIt.IsPresent())
{
if(iColumnValBufIt.Type() != ESqlBinary)
{
aDest.Zero();
return err;
}
err = iSqlStmtSession.ReadColumnValue(aColumnIndex, aDest);
}
else
{
TPtrC8 src = iColumnValBufIt.Binary();
TInt len = src.Length();
if(len > aDest.MaxLength())
{
len = aDest.MaxLength();
err = KErrOverflow;
}
aDest.Copy(src.Ptr(), len);
}
return err;
}
示例10: InvokeSyncFunctionL
void CSmtpClientMtm::InvokeSyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TDes8& aParameter)
/** Invokes a synchronous SMTP-specific operation.
@param aFunctionId Specifies which operation to perform. The only valid ID is KSMTPMTMIsConnected.
@param aSelection A selection of messages for the operation.
@param aParameter Not used
*/
{
__ASSERT_DEBUG(iMsvEntry!=NULL,gPanic(ESmtcMTMNoCMsvEntrySet));
TInt error = KErrNone;
switch (aFunctionId)
{
case KSMTPMTMIsConnected:
{
TPckgBuf<TImSmtpProgress> progress;
Session().TransferCommandL(aSelection, KSMTPMTMIsConnected, aParameter, progress);
aParameter.Copy(progress);
return;
}
default:
error=KErrNotSupported;
__ASSERT_DEBUG(EFalse,gPanic(ESmtcUnknownSyncFunction));
}
User::LeaveIfError(error);
}
示例11: GetStateL
// ---------------------------------------------------------------------------
// CFotaDB::GetStateL
// Gets pkg state from db
// ---------------------------------------------------------------------------
TPackageState CFotaDB::GetStateL(const TInt aPkgId, TDes8& aPkgURL)
{
RDbView view;
TPackageState s;
CleanupClosePushL(view);
s.iState = RFotaEngineSession::EIdle; // default state is idle
HBufC* select = HBufC::NewLC(KSelect_where_packageid().Length() + 10);
select->Des().Format(KSelect_where_packageid, aPkgId);
TInt err = view.Prepare(iStateDB, TDbQuery(*select));
__LEAVE_IF_ERROR(err);
view.EvaluateAll();
view.FirstL();
while (view.AtRow())
{
view.GetL();
HBufC8* url;
s = RowToStateL(url, view);
CleanupStack::PushL(url);
aPkgURL.Copy(url->Des());
CleanupStack::PopAndDestroy(); // url
view.NextL();
}
CleanupStack::PopAndDestroy(); //select
CleanupStack::PopAndDestroy(); //view
return s;
}
示例12: GAVDP_SecurityControlIndication
TInt CT_DataRGavdp::GAVDP_SecurityControlIndication(TSEID /*aSEID*/, TDes8& aSecurityDataInOut)
{
INFO_PRINTF1(KLogInfoSecurityControlIndication);
//verify
CheckEvent(EGAVDP_SecurityControlIndication);
HBufC16* securityDataInOut = HBufC16::NewL(aSecurityDataInOut.Length());
securityDataInOut->Des().Copy(aSecurityDataInOut);
if (KLogDataFixed().Compare(*securityDataInOut)==0)
{
INFO_PRINTF1(KLogInfoSecurityDataUnchanged);
}
else if(KLogDataChange().Compare(*securityDataInOut)==0)
{
aSecurityDataInOut.Copy(KLogDataChanged());
INFO_PRINTF2(KLogInfoSecurityDataChanged, &KLogDataChanged());
}
else
{
ERR_PRINTF1(KLogErrReceivedSecurityData);
SetAsyncError(iCmdIndex, KErrGeneral);
}
delete securityDataInOut;
DecOutstanding();
return KErrNone;
}
示例13: 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);
}
}
示例14: GetData
// ---------------------------------------------------------------------------
// CSensrvDataHandler::GetData
// ---------------------------------------------------------------------------
//
TInt CSensrvDataHandler::GetData( TDes8& aDataPtr )
{
COMPONENT_TRACE( ( _L( "Sensrv Client - CSensrvDataHandler::GetData - Start" ) ) );
TInt err( KErrNone );
if( aDataPtr.Length() < iChannelInfo.iDataItemSize )
{
// aDataPtr is too small
err = KErrOverflow;
}
else if( iGetDataCount >= iReadBufferCount || !iReadBuffer )
{
// data not found.
err = KErrNotFound;
}
else
{
// set data
TUint8* ptr = const_cast<TUint8*>( iReadBuffer->Des().Ptr() );
ptr += ( iGetDataCount * iChannelInfo.iDataItemSize );
aDataPtr.Copy( ptr, iChannelInfo.iDataItemSize );
++iGetDataCount;
}
COMPONENT_TRACE( ( _L( "Sensrv Client - CSensrvDataHandler::GetData - Return %d" ), err ) );
return err;
}
示例15: ReadNextBlockL
// ==========================================================================
// FUNCTION: ReadNextBlockL
// ==========================================================================
TBool CContainerStoreContentManager::ReadNextBlockL( CBufferedReader& aReader,
TDes8& aPlaintextBlock,
TBool aIsContentEncrypted )
{
TPtrC8 nextBlock = aReader.NextBlockL();
if ( aIsContentEncrypted )
{
iEncryption.DecryptL( nextBlock, aPlaintextBlock );
}
else
{
aPlaintextBlock.Copy( nextBlock );
}
// If this is the last block in the file then remove the pad bytes
TBool done = aReader.AtEofL();
if( done && aIsContentEncrypted )
{
iEncryption.RemovePaddingL( aPlaintextBlock );
} // end if
return done;
} // end ReadNextBlockL