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


C++ TPtrC8::Ptr方法代码示例

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


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

示例1: assert_equals_des8

TBool assert_equals_des8(CTestExecuteLogger& aLogger, const TText8* aFile, TInt aLine, TInt aSeverity, 
	const TDesC8& aRes, const TDesC8& aExp, const TDesC& aMsg)
	{
	if(aRes != aExp)
		{
		TBuf<20> tempRes;
		TBuf<20> tempExp;
		
		TPtrC8 exp;
		TPtrC8 res;
		
		exp.Set(aExp.Ptr(), aExp.Length());
		res.Set(aRes.Ptr(), aRes.Length());
		
		if(exp.Length() > KMaxLogCharLength)
			{
			exp.Set(exp.Ptr(), KMaxLogCharLength);
			}
		
		if(res.Length() > KMaxLogCharLength)
			{
			res.Set(res.Ptr(), KMaxLogCharLength);
			}

		//8-bit copy to unicode for logging
		tempRes.Copy(res);
		tempExp.Copy(exp);
	
		aLogger.LogExtra(aFile, aLine, aSeverity, KAssertErrorEqualsTextDes, &tempRes, &tempExp, &aMsg);
		return EFalse;
		}
	return ETrue;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:33,代码来源:cctsyintegrationtestsuitebase.cpp

示例2: AppendObjectPropListL

EXPORT_C void CMTPTypeObjectPropList::AppendObjectPropListL(const CMTPTypeObjectPropList& aSource)
    {
    TInt chunkStatus = 0;
    TBool copyFirstChunk = ETrue;
    TUint srcElemNum = aSource.NumberOfElements();
    
    while (chunkStatus != KMTPChunkSequenceCompletion)
        {
        TPtrC8 tmpPtrRawData;
        if (copyFirstChunk)
            {
            chunkStatus = aSource.FirstReadChunk(tmpPtrRawData);
            tmpPtrRawData.Set(tmpPtrRawData.Ptr() + sizeof(TUint32), tmpPtrRawData.Length() - sizeof(TUint32));
            copyFirstChunk = EFalse;
            }
        else
            {
            chunkStatus = aSource.NextReadChunk(tmpPtrRawData);
            }
        
        const TUint8* srcPtr = tmpPtrRawData.Ptr();
        MemoryCopyL(iRevPageEnd, iRevDataEnd, srcPtr, tmpPtrRawData.Length());
        IncreaseIndexL(iRevPageEnd, iRevDataEnd, tmpPtrRawData.Length(), ETrue);
        }
    
    iNumberOfElements += srcElemNum;
    memcpy(&(iIOPages[0][KReservedTransportHeaderSize]), &iNumberOfElements, sizeof(TUint32));
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:28,代码来源:cmtptypeobjectproplist.cpp

示例3: SetArrayL

EXPORT_C void CMTPTypeObjectPropListElement::SetArrayL(TInt aElementId, const CMTPTypeArray& aArray)
    {
    if(EValue != aElementId)
        {
        User::Leave(KErrArgument);
        }
    
    SetDataType(aArray.Type());
    TUint32 num = aArray.NumElements();
    
    
    TUint pageIndex = iPageIndex;
    TUint bufIndex = iBufIndex;
    
    // Set number of array elements
    iPropList->IncreaseIndexL(pageIndex, bufIndex, KPropElemHeaderSize, ETrue);
    iPropList->MemoryCopyL(pageIndex, bufIndex, &num, sizeof(TUint32));

    TPtrC8 srcPtr;
    aArray.FirstReadChunk(srcPtr);
    srcPtr.Set(srcPtr.Ptr() + sizeof(TUint32), srcPtr.Length() - sizeof(TUint32));
    
    iPropList->IncreaseIndexL(pageIndex, bufIndex, sizeof(TUint32), ETrue);
    TUint arrayWidth = iPropList->ArrayElemWidth(iDataType);
    iValueSize = sizeof(TUint32) + num * arrayWidth;
    iPropList->MemoryCopyL(pageIndex, bufIndex, srcPtr.Ptr(), num * arrayWidth);
    iArrayBuffered = EFalse;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:28,代码来源:cmtptypeobjectproplist.cpp

示例4: if

EXPORT_C int Tptrc8ToWcharp(TPtrC8& aSrc, wchar_t* aDes, int& n_size)
{
    int retval = ESuccess;
    unsigned int ilen = aSrc.Length();
    int minusone = -1;
    
    if (0 == ilen)
    {
    	return EDescriptorNoData;
    }
    else if(!aDes)
    {
    	return EInvalidPointer;
    }
	else if(n_size < ilen)
	{
		n_size = ilen;
		return EInvalidSize;
	}
	
	if(minusone != mbstowcs(aDes, (const char*)aSrc.Ptr(), ilen))
	{
	    aDes[ilen] = L'\0';
	}
	else 
	{
		retval = EInvalidMBSSequence;
	}
	
	return retval;	
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:31,代码来源:descriptor8towchar.cpp

示例5: CheckBufFill

/**
    Check if the buffer is filled with aFill character.
    @param  aBufPtr buffer descriptor
    @param  aFill filling character
    @return ETrue if the buffer is filled with aFill byte.
*/
static TBool CheckBufFill(const TPtrC8& aBufPtr, TUint8 aFill)
{
    const TUint32 bufSz = (TUint32)aBufPtr.Size();
    
    //-- optimised by using DWORD granularity
    if(bufSz % sizeof(TUint32) == 0)
    {
        TUint32 wordPattern = aFill;
        wordPattern <<= 8; wordPattern |= aFill;
        wordPattern <<= 8; wordPattern |= aFill;
        wordPattern <<= 8; wordPattern |= aFill;

        const TUint nWords = bufSz / sizeof(TUint32);
        const TUint32* pWords = (const TUint32*) aBufPtr.Ptr();

        for(TUint32 i=0; i<nWords; ++i)
        {
            if(pWords[i] != wordPattern)
                return EFalse;
        }

        return ETrue;
    }
    
    //-- dumb implementation
    for(TUint32 i=0; i<bufSz; ++i)
    {
        if(aBufPtr[i] != aFill)
            return EFalse;
    }

    return ETrue;
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:39,代码来源:win_media_device.cpp

示例6: if

TUint8 CNcmNtb16Parser::DataTUint8(TUint aOffset, const TUint8* aBuf, TInt aBufLen)
    {
    if (0 == iQueLen)
        {
        return aBuf[iDataOffset + aOffset];
        }
    else if (iDataLen <= aOffset)
        {
        return aBuf[aOffset - iDataLen];
        }
    else
        {
        TInt    i = 1;
        TPtrC8* pPtr = &iBufQueue[0];
        TUint   totalOffset = pPtr->Length() - iDataOffset;
        while(totalOffset <= aOffset)
            {
            pPtr = &iBufQueue[i];
            totalOffset += pPtr->Length();
            i++;
            __ASSERT_DEBUG(i<=iQueLen, User::Panic(KNTBParsePanic, __LINE__));
            }
        return pPtr->Ptr()[pPtr->Length() + aOffset - totalOffset];
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:25,代码来源:ncmntbparser.cpp

示例7: 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;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:45,代码来源:SqlStatementImpl.cpp

示例8: ConvertByteL

// -----------------------------------------------------------------------------
// TBTSUDataConverter::ConvertByteL
// -----------------------------------------------------------------------------
//
TUint8 TBTSUDataConverter::ConvertByteL( const TPtrC8& aData )
    {
    if ( aData.Length() != sizeof(TUint8) )
        {
        User::Leave( KErrArgument );
        }
    return *aData.Ptr();
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:12,代码来源:BTSUDataConverter.cpp

示例9: ConvertDataUnsignedL

// -----------------------------------------------------------------------------
// TBTSUDataConverter::ConvertDataUnsignedL
// -----------------------------------------------------------------------------
//
TUint32 TBTSUDataConverter::ConvertDataUnsignedL( const TPtrC8& aData )
    {
    if ( aData.Size() != sizeof(TUint32) )
        {
        User::Leave( KErrArgument );
        }
    return BigEndian::Get32(aData.Ptr());
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:12,代码来源:BTSUDataConverter.cpp

示例10:

void CResourceManager::GetMd5(const TDesC8& aString, TUint8* aMd5)
{
    CMD5 *md5 = CMD5::NewL();
    CleanupStack::PushL(md5);
    TPtrC8 ptrHash = md5->Hash(aString);
    const TUint8* p = ptrHash.Ptr();
    Mem::Copy(aMd5, p, ptrHash.Length());
    CleanupStack::PopAndDestroy(md5);
}
开发者ID:github188,项目名称:homebrew,代码行数:9,代码来源:ResourceManager.cpp

示例11: SendDataRxCmdL

TInt CBulkOnlyTransport::SendDataRxCmdL(const MClientCommandServiceReq* aCommand,
                                        TDes8& aCopyBuf,
                                        TInt& aLen)
{
    __MSFNLOG

    TInt r = KErrNone;
    SendCbwL(aCommand, TBotCbw::EDataIn, aLen);

    // store initial length as data is appended to the buffer
    TInt startPos = aCopyBuf.Length();

    TInt len = aLen;

    while (len)
    {
        if(len > KResponsePacketSize)
            iBulkDataTd.SaveData(KResponsePacketSize);
        else
            iBulkDataTd.SaveData(len);
        iBulkPipeIn.Transfer(iBulkDataTd, iStatus);
        User::WaitForRequest(iStatus);

        r = iStatus.Int();
        if (r != KErrNone)
        {
            if (r == KErrUsbStalled)
            {
                __BOTPRINT(_L("SendDataRxCmdL ClearRemoteStall"));
                iBulkPipeIn.ClearRemoteStall();
#ifdef MASSSTORAGE_PUBLISHER
                TMsPublisher publisher(TMsPublisher::KStallProperty);
#endif
                break;
            }
            DoResetRecovery();
            __BOTPRINT1(_L("Usb transfer error %d"),r);
            User::Leave(KErrGeneral);
        }

        TPtrC8 data = iBulkDataTd.Buffer();
        aCopyBuf.Append(data.Ptr(), data.Length());
        if(len > KResponsePacketSize)
            len -= KResponsePacketSize;
        else
            len = 0;
    }

    ReceiveCswL();
    TUint32 lenReceived = 0;

    r = ProcessInTransferL(lenReceived);
    aLen = lenReceived;
    aCopyBuf.SetLength(startPos + lenReceived);

    return r;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:57,代码来源:cbulkonlytransport.cpp

示例12: ConvertDataSignedL

// -----------------------------------------------------------------------------
// TBTSUDataConverter::ConvertDataSignedL
// -----------------------------------------------------------------------------
//
TInt32 TBTSUDataConverter::ConvertDataSignedL( const TPtrC8& aData )
    {
    if ( aData.Length() != sizeof(TInt32) )
        {
        User::Leave( KErrArgument );
        }
    TUint32 rawVal = BigEndian::Get32(aData.Ptr());
    return *reinterpret_cast<TInt32*>(&rawVal); // reinterpret cast to extract signed nature "unscathed"
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:13,代码来源:BTSUDataConverter.cpp

示例13: Write

EXPORT_C TInt CMTPTypeOpaqueData::Write( const TPtrC8 &aDes)
    {
    if(iBuffer.MaxSize() != 0)
        {
        iBuffer.Close();
        }
    
    iPtrBuffer.Set(const_cast<TUint8*>(aDes.Ptr()), aDes.Length(), aDes.Size());
    return KErrNone;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:10,代码来源:cmtptypeopaquedata.cpp

示例14: ConstructL

// ----------------------------------------------------------------------------
// UntrustedCertificateInfoSymbian::ConstructL()
// ----------------------------------------------------------------------------
//
void UntrustedCertificateInfoSymbian::ConstructL(const QByteArray &aEncodedCert)
{
    TPtrC8 encodedCert( reinterpret_cast<const TText8*>( aEncodedCert.constData() ),
        aEncodedCert.length() );

    ASSERT( mCert == 0 );
    mCert = CX509Certificate::NewL( encodedCert );

    HBufC16* subjectBuf = NULL;
    X509CertNameParser::SubjectFullNameL( *mCert, subjectBuf );
    CleanupStack::PushL( subjectBuf );
    QT_TRYCATCH_LEAVING( mSubjectName =
        QString::fromUtf16(subjectBuf->Ptr(), subjectBuf->Length()) );
    CleanupStack::PopAndDestroy( subjectBuf );

    HBufC16* issuerBuf = NULL;
    X509CertNameParser::IssuerFullNameL( *mCert, issuerBuf );
    CleanupStack::PushL( issuerBuf );
    QT_TRYCATCH_LEAVING( mIssuerName =
        QString::fromUtf16(issuerBuf->Ptr(), issuerBuf->Length()));
    CleanupStack::PopAndDestroy( issuerBuf );

    TPtrC8 fingerprint = mCert->Fingerprint();
    QT_TRYCATCH_LEAVING( mFingerprint = QByteArray::fromRawData(
        reinterpret_cast<const char*>(fingerprint.Ptr()), fingerprint.Length()) );

    mMd5Fingerprint = Md5FingerprintL( mCert->Encoding() );

    TPtrC8 serialNumber = mCert->SerialNumber();
    QT_TRYCATCH_LEAVING( mSerialNumber = QByteArray::fromRawData(
        reinterpret_cast<const char*>(serialNumber.Ptr()), serialNumber.Length()) );

    const CValidityPeriod& validityPeriod = mCert->ValidityPeriod();
    convertDateTime(validityPeriod.Start(), mValidFrom);
    convertDateTime(validityPeriod.Finish(), mValidTo);

    mFormat = X509Certificate;

    const CSigningAlgorithmIdentifier& alg = mCert->SigningAlgorithm();
    mDigestAlgorithm = mapAlgorithm(alg.DigestAlgorithm().Algorithm());
    mAsymmetricAlgorithm = mapAlgorithm(alg.AsymmetricAlgorithm().Algorithm());
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:46,代码来源:untrustedcertificateinfo_symbian.cpp

示例15: CheckBuf

TInt TMetaVarLenBase::CheckBuf( TPtrC8& aBuffer )
	{
	// Check if the descriptor is long enough
	if (aBuffer.Length() < (TInt)sizeof(TUint32))
		{
		return KErrArgument;
		}
	
	// Check if the descriptor is long enough
    TBuf8<sizeof(TUint32)> lenSubBuf;
    lenSubBuf.Copy(aBuffer.Ptr(), sizeof(TUint32));
    TUint length = *((TUint32*)lenSubBuf.Ptr());	
	if (aBuffer.Length() < (TInt)length)
		{
		return KErrArgument;
		}

	aBuffer.Set(aBuffer.Ptr() + sizeof(TUint32), aBuffer.Length() - sizeof(TUint32)); //update pointer
	return length;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:20,代码来源:MetaType.cpp


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