本文整理汇总了C++中TPtr8::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtr8::Copy方法的具体用法?C++ TPtr8::Copy怎么用?C++ TPtr8::Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtr8
的用法示例。
在下文中一共展示了TPtr8::Copy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadArrayL
// -----------------------------------------------------------------------------
// CMceItcSender::ReadArrayL
// -----------------------------------------------------------------------------
//
CDesC8Array* CMceItcSender::ReadArrayL( TMceIds& aIds,
TMceItcFunctions aITCFunction,
const TDesC8& aData )
{
MCECLI_DEBUG("CMceItcSender::ReadArrayL(inout), Entry");
Mem::FillZ( &iITCMsgArgs, sizeof( iITCMsgArgs ) );
aIds.iMsgType = KMceNotAssigned;
CMceMsgTextArray* textArray = new (ELeave) CMceMsgTextArray();
CleanupStack::PushL( textArray );
HBufC8* arrayBuf = HBufC8::NewLC( KMceMaxSizeInReadStream );
TPtr8 arrayBufPtr = arrayBuf->Des();
arrayBufPtr.Copy( aData );
iITCMsgArgs.Set ( EMceItcArgContext, &arrayBufPtr );
SendL ( aIds, aITCFunction );
textArray->DecodeL( *arrayBuf );
CDesC8Array* array = textArray->iArray;
CleanupStack::PopAndDestroy( arrayBuf );//arrayBuf
CleanupStack::PopAndDestroy( textArray );//textArray
MCECLI_DEBUG("CMceItcSender::ReadArrayL(inout), Exit");
return array;
}
示例2: WriteL
// -----------------------------------------------------------------------------
// CCapInfo::WriteL(const TDesC& aText)
// Writes one element to capability buffer.
// -----------------------------------------------------------------------------
//
void CCapInfo::WriteL(const TDesC& aText)
{
if (aText.Length() > iBuf.MaxLength())
{
User::Leave(KErrTooBig);
}
iBuf=aText;
iBuf.Trim();
FormatElement(iBuf);
TPtr8 ptr = iHeapBuf->Des();
if ( iBuf.Length()+2 > ptr.MaxLength() )
{
User::Leave(KErrTooBig);
}
//unicode conversion
HBufC8* convBuf = HBufC8::NewLC( iBuf.Size() );
TPtr8 convPtr = convBuf->Des();
CnvUtfConverter::ConvertFromUnicodeToUtf8(convPtr, iBuf);
ptr.Copy(convPtr);
ptr.Append( KLineFeed ); // linefeed
CleanupStack::PopAndDestroy( convBuf );
TInt pos=iCapabilityBuf->Size();
iCapabilityBuf->InsertL(pos, ptr);
iBuf=KNullDesC;
}
示例3: AllocateChannelL
// ---------------------------------------------------------------------------
// Allocates a channel
// ---------------------------------------------------------------------------
//
void CDunIrPlugin::AllocateChannelL()
{
FTRACE(FPrint(_L("CDunIrPlugin::AllocateChannelL()")));
HBufC8* channelName = HBufC8::NewMaxLC( KIrChannelName().Length() );
TPtr8 channelNamePtr = channelName->Des();
channelNamePtr.Copy( KIrChannelName );
iTransporter->AllocateChannelL( &iIrPort,
KDunIrPluginUid,
channelNamePtr,
ETrue );
iTransporter->AddConnMonCallbackL( &iIrPort,
this,
EDunReaderUpstream,
EFalse );
iTransporter->AddConnMonCallbackL( &iIrPort,
this,
EDunWriterUpstream,
EFalse );
iTransporter->AddConnMonCallbackL( &iIrPort,
this,
EDunReaderDownstream,
EFalse );
iTransporter->AddConnMonCallbackL( &iIrPort,
this,
EDunWriterDownstream,
EFalse );
iTransporter->IssueTransferRequestsL( &iIrPort );
CleanupStack::PopAndDestroy( channelName );
FTRACE(FPrint(_L("CDunIrPlugin::AllocateChannelL() complete")));
}
示例4: TestingCancelled
// ---------------------------------------------------------------------------
// Provides default implementation required for cancellation of testing
// ---------------------------------------------------------------------------
//
void COMASuplPosTesterCategory::TestingCancelled(const TDesC8& aInfo)
{
if(iCallBack)
{
HBufC8* infoBuf = NULL;
TRAPD(err, infoBuf = HBufC8::NewL(aInfo.Length() + KExtraBuffer));
if(err != KErrNone)
{
iCallBack->TestingCancelled(aInfo);
}
else
{
TPtr8 info = infoBuf->Des();
info.Copy(aInfo);
info.Append(KSessionId);
info.AppendNum(iTestNo);
iCallBack->TestingComplete(info);
}
delete infoBuf;
iCallBack->UpdateSessionTestSummary(iInfo, iWarning, iError);
}
else
{
Cancel();
iTestHandler->Cancel();
iTestingStatus = ETestCancelled;
CActiveScheduler::Stop();
iInfo++;
iLogger->WriteLine(aInfo, iTestNo);
}
}
示例5: TestingAborted
// ---------------------------------------------------------------------------
//Provides implementation required for aborting testing
// ---------------------------------------------------------------------------
//
void COMASuplPositionVelocityTest::TestingAborted(const TDesC8& /*aInfo*/)
{
if(iCallBack)
{
HBufC8* infoBuf = NULL;
TRAPD(err, infoBuf = HBufC8::NewL(KPositionVelocityTestAborted().Length() + KExtraBuffer));
if(err != KErrNone)
{
iCallBack->TestingAborted(KPositionVelocityTestAborted);
}
else
{
TPtr8 info = infoBuf->Des();
info.Copy(KPositionVelocityTestAborted);
info.Append(KSessionId);
info.AppendNum(iTestNo);
iCallBack->TestingAborted(info);
}
delete infoBuf;
iCallBack->UpdateSessionTestSummary(iInfo, iWarning, iError);
}
else
{
Cancel();
iTestHandler->Cancel();
iTestingStatus = ETestAborted;
CActiveScheduler::Stop();
iError++;
iLogger->WriteLine(KPositionVelocityTestAborted, iTestNo);
}
}
示例6: Read
void CT_DataRGavdp::Read(const TDesC& aSection, const TInt aAsyncErrorIndex)
{
TPtrC inputStr;
if( GetStringFromConfig(aSection, KFldExpectedData, inputStr))
{
if (!iReadExpectBuffer)
iReadExpectBuffer = HBufC8::NewL(512);
TPtr8 des = iReadExpectBuffer->Des();
des.Copy(inputStr);
}
else
{
if (iReadExpectBuffer)
{
delete iReadExpectBuffer;
iReadExpectBuffer = NULL;
}
}
INFO_PRINTF1(KLogInfoReading);
iReadBuffer = HBufC8::NewL(512);
iReadBuffer->Des().SetMax();
iReadBufferDes.Set(iReadBuffer->Des());
iSockets[0].Read(iReadBufferDes,iActive->iStatus);
iActive->Activate(aAsyncErrorIndex);
IncOutstanding();
}
示例7: ptr
void CDHCPIP6Control::GetRawOptionDataL(TUint aOpCode, TPtr8& aPtr )
{
HBufC8* buf = NULL;
DHCPv6::CDHCPMessageHeaderIP6 msg(buf);
CleanupClosePushL(msg);
TPtr8 ptr( const_cast<TUint8*>(iValidMsg.Ptr()), iValidMsg.Length(), iValidMsg.Length() );
msg.iRecord.ParseL(ptr); //no check necessary
DHCPv6::COptionNode* pOption = msg.GetOptions().FindOption(aOpCode);
if (!pOption)
{
#ifdef SYMBIAN_TCPIPDHCP_UPDATE
// The option is not found try to get the option through DHCP INFORM message
//by calling RequestInformOrCompleteCallL
CleanupStack::PopAndDestroy();
TUint opcode = aOpCode;
TPtr8 optPtr(reinterpret_cast<TUint8*>(&opcode),1,1);
return(RequestInformOrCompleteCallL(optPtr));
#else
User::Leave(KErrNotFound);
#endif //SYMBIAN_TCPIPDHCP_UPDATE
}
ptr.Set(pOption->GetBodyDes());
if (ptr.Length() > aPtr.MaxLength())
{
User::Leave(KErrOverflow);
}
aPtr.Copy(ptr);
CleanupStack::PopAndDestroy();
}
示例8:
void CRFC3984Encode::PayloadizeFrameSingleNALModeL(
TDes8& aBuffer,
TUint32 /*aTimeStamp*/,
TUint32& /*aMarkerBit*/,
TInt& aNalCount )
{
// This implementation assumes the NAL units for one frame are seperated
// by 0x001 or 0x0001 start codes
// Resetting iBufferIndex for this new frame, always do this for new frame
// because this is used to find start codes within one frame
iBufferIndex = 0;
TInt startIndex = 0; // holds first byte-index of NALU
TInt endIndex = 0; // hold byte-index of next to last byte of NALU
TInt size = 0;
HBufC8 * pBuffer = 0;
// loop to find and packetize all NAL Units in the frame
while ( ETrue )
{
startIndex = TMccCodecInfo::FindAvcNaluStart( iBufferIndex, aBuffer );
if ( KErrNotFound == startIndex )
{
break;
}
endIndex = TMccCodecInfo::FindAvcNaluEnd( iBufferIndex, aBuffer );
if ( KErrNotFound == endIndex )
{
break;
}
if ( startIndex == endIndex )
{
break;
}
// finding size of the NAL unit
size = endIndex - startIndex;
__ASSERT_ALWAYS( size > 0, User::Leave( KErrGeneral ) ); // some flaw in logic
pBuffer = HBufC8::NewLC( size );
TPtr8 aPtr = pBuffer->Des();
// Now the size and start Index is known, copying the data
aPtr.Copy( aBuffer.Mid( startIndex, size ) );
// Now inserting pointer
iPayloadizedBuffers.InsertL( pBuffer, iNalCount );
CleanupStack::Pop( pBuffer );
pBuffer = NULL; // ownership transferred
iNalCount++;
}
aNalCount = iNalCount;
}
示例9: HandleControlPaneRightSoftKeyPressedL
/**
* Handle the rightSoftKeyPressed event.
* @return ETrue if the command was handled, EFalse if not
*/
TBool Csymbian_ua_guiSettingItemListView::HandleControlPaneRightSoftKeyPressedL (TInt aCommand)
{
TUint8 domain[256] = {0};
TPtr8 cDomain (domain, sizeof (domain));
TUint8 user[64] = {0};
TPtr8 cUser (user, sizeof (user));
TUint8 pass[64] = {0};
TPtr8 cPass (pass, sizeof (pass));
cDomain.Copy (iSettings->Ed_registrar());
cUser.Copy (iSettings->Ed_user());
cPass.Copy (iSettings->Ed_password());
symbian_ua_set_account ( (char*) domain, (char*) user, (char*) pass, false, false);
AppUi()->ActivateLocalViewL (TUid::Uid (ESymbian_ua_guiContainerViewId));
return ETrue;
}
示例10:
DMAD_EXPORT_C HBufC8* TDmAdUtil::BuildUriL(const TDesC8& aUriPath, const TDesC8& aUriSeg)
{
HBufC8* uri = HBufC8::NewL(aUriPath.Length() + 1 + aUriSeg.Length());
TPtr8 uriDesc = uri->Des();
uriDesc.Copy(aUriPath);
uriDesc.Append(KDmAdSeparator);
uriDesc.Append(aUriSeg);
return uri;
}
示例11: WriteClosingTags
// ---------------------------------------------------------------------------
// CGpxConverterAO::WriteClosingTags
// Close GPX file
// ---------------------------------------------------------------------------
void CGpxConverterAO::WriteClosingTags()
{
LOG("CGpxConverterAO::WriteClosingTags ,begin");
TPtr8 writePtr = iWriteBuf->Des();
// end segment
if ( !iFixLost )
{
writePtr.Copy( KTagSegmentEnd );
iGpxFile.Write( writePtr );
}
// closing tags
writePtr.Copy( KTagTrackEnd );
writePtr.Append( KTagGpxEnd );
iGpxFile.Write( writePtr );
LOG("CGpxConverterAO::WriteClosingTags ,end");
}
示例12: AllocateChannelL
// ---------------------------------------------------------------------------
// Allocates a free channel
// ---------------------------------------------------------------------------
//
void CDunBtPlugin::AllocateChannelL( TBool& aNoFreeChans,
TBtCleanupInfo& aCleanupInfo )
{
FTRACE(FPrint(_L("CDunBtPlugin::AllocateChannelL()")));
// iDataSocket has new data socket information so copy it to iBTPorts
TBtPortEntity* foundEntity = NULL;
TInt foundIndex = GetFirstFreePort( foundEntity );
if ( !foundEntity ) // free not found so add new
{
TBtPortEntity newEntity;
iBTPorts.AppendL( newEntity );
aCleanupInfo.iNewEntity = ETrue;
aCleanupInfo.iEntityIndex = iBTPorts.Count() - 1;
foundEntity = &iBTPorts[ aCleanupInfo.iEntityIndex ];
}
else // free found so change array
{
aCleanupInfo.iNewEntity = EFalse;
aCleanupInfo.iEntityIndex = foundIndex;
foundEntity = &iBTPorts[ foundIndex ];
}
foundEntity->iChannelNum = iEntity.iChannelNum;
foundEntity->iBTPort = iEntity.iBTPort;
RSocket* socket = &foundEntity->iBTPort;
HBufC8* channelName = HBufC8::NewMaxLC( KBtChannelName().Length() +
KCharactersInTInt );
TPtr8 channelNamePtr = channelName->Des();
channelNamePtr.Copy( KBtChannelName );
channelNamePtr.AppendNum( iEntity.iChannelNum );
iTransporter->AllocateChannelL( socket,
KDunBtPluginUid,
channelNamePtr,
EFalse,
aNoFreeChans );
iTransporter->AddConnMonCallbackL( socket,
this,
EDunReaderUpstream,
EFalse );
iTransporter->AddConnMonCallbackL( socket,
this,
EDunWriterUpstream,
EFalse );
iTransporter->AddConnMonCallbackL( socket,
this,
EDunReaderDownstream,
ETrue );
iTransporter->AddConnMonCallbackL( socket,
this,
EDunWriterDownstream,
EFalse );
iTransporter->IssueTransferRequestsL( socket );
CleanupStack::PopAndDestroy( channelName );
FTRACE(FPrint(_L("CDunBtPlugin::AllocateChannelL() complete")));
}
示例13: al_SetDataFormat
TInt COpenMAXALTestModule::al_SetDataFormat( CStifItemParser& aItem )
{
TInt status(KErrNone);
TInt type;
TInt contType(0);
TPtrC mimetype;
status = aItem.GetNextInt(type);
switch(type)
{
case XA_DATAFORMAT_MIME:
{
status = aItem.GetNextString(mimetype);
if(!status)
{
status = aItem.GetNextInt(contType);
if(!status)
{
if(m_MimeType)
{
delete m_MimeType;
m_MimeType = NULL;
}
m_MimeType = HBufC8::NewL(mimetype.Length()+1);
TPtr8 desc = m_MimeType->Des();
desc.Copy(mimetype);
m_Mime.formatType = XA_DATAFORMAT_MIME;
m_Mime.mimeType = (XAchar*) desc.PtrZ();
m_Mime.containerType = contType;
}
else
{
status = KErrGeneral;
}
}
else
{
status = KErrGeneral;
}
}
break;
case XA_DATAFORMAT_PCM:
case XA_DATAFORMAT_RAWIMAGE:
break;
default:
status = KErrGeneral;
break;
}
return status;
}
示例14: Write
/** Writing data
@param aPos position to write
@param aSrc source buffer
@return KErrNone or KErrOverflow in case of an error
*/
TInt CTestProxyDrive::Write (TInt64 aPos, const TDesC8& aSrc)
{
__FNLOG ("CTestProxyDrive::Write");
// TInt64 is not supported by Copy()
ASSERT(0 == I64HIGH(aPos));
if (!aSrc.Length())
{ return KErrNone; }
if ( (static_cast<TUint>(iMediaBuf.Length()) <= I64LOW(aPos)) && (static_cast<TUint>(iMediaBuf.Length()) <= I64LOW(aPos) + static_cast<TUint>(aSrc.Length())) )
{ return KErrOverflow; }
TPtr8 ptr (&iMediaBuf[I64LOW(aPos)], aSrc.Length(), aSrc.Length());
ptr.Copy(aSrc);
return KErrNone;
}
示例15: ParseCoordinateData
TReal CGpsDataHandler::ParseCoordinateData() {
TPtr8 pBuffer = iBuffer->Des();
TReal aAngle;
TReal aResult = 0.0;
TInt aFindResult;
aFindResult = pBuffer.Find(_L8(","));
if(aFindResult != KErrNotFound) {
HBufC8* aField = HBufC8::NewL(aFindResult);
CleanupStack::PushL(aField);
TPtr8 pField = aField->Des();
pField.Copy(pBuffer.Ptr(), aFindResult);
pBuffer.Delete(0, aFindResult+1);
TLex8 aFieldLex(pField.Ptr());
if(aFieldLex.Val(aAngle, '.') == KErrNone) {
TInt32 aDegrees;
Math::Int(aDegrees, aAngle / 100.0);
TInt32 aMinutes;
Math::Int(aMinutes, aAngle - aDegrees * 100);
TReal aDecimal;
Math::Frac(aDecimal, aAngle);
aResult = aDegrees + (aMinutes + aDecimal) / 60.0;
if(pBuffer[0] == TUint('S') || pBuffer[0] == TUint('W')) {
aResult = -aResult;
}
aFindResult = pBuffer.Find(_L8(","));
if(aFindResult != KErrNotFound) {
pBuffer.Delete(0, aFindResult+1);
}
}
CleanupStack::PopAndDestroy();
}
return aResult;
}