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


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

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


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

示例1: OnEndElementL

void CSenXmlReader::OnEndElementL(const RTagInfo& aElement, TInt /* aErrorCode */)
    {
    if(!iContentHandler)
        {
        SENDEBUG_L("OnEndElementL: KErrSenXmlContentHandlerNotSet");
        User::Leave(KErrSenXmlContentHandlerNotSet);
        }


    const TPtrC8 localName = aElement.LocalName().DesC();
    const TPtrC8 nsUri = aElement.Uri().DesC();
    const TPtrC8 prefix = aElement.Prefix().DesC();

    TPtrC8 qualifiedName = localName;

    if (prefix != KNullDesC8)
        {
        HBufC8* pQName = HBufC8::NewLC(prefix.Length()+localName.Length()+
                                        KSenColon().Length());
        TPtr8 qName = pQName->Des();
        qName.Append(prefix);
        qName.Append(KSenColon);
        qName.Append(localName);
        qualifiedName.Set(qName);
        }


    iContentHandler->EndElement(nsUri,
                                localName,
                                qualifiedName);

    if (prefix != KNullDesC8)
        {
        CleanupStack::PopAndDestroy(); // pQName
        }

    }
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:37,代码来源:senxmlreader.cpp

示例2: data

QVariant QSymSQLResult::data(int idx)
{
    QVariant r;
    
    switch (d->stmt.ColumnType(idx)) {
    case ESqlBinary:
        {
            TPtrC8 data; 
            d->stmt.ColumnBinary(idx, data);
            return QByteArray(reinterpret_cast<const char *>(data.Ptr()), data.Length());
            break;
         }
    case ESqlInt:
        r = QVariant(d->stmt.ColumnInt(idx));
        break;
    case ESqlInt64:
        r = QVariant(d->stmt.ColumnInt64(idx));
        break;
    case ESqlReal:
        switch(numericalPrecisionPolicy()) {
        case QSql::LowPrecisionInt32:
            r = QVariant(d->stmt.ColumnInt(idx));
            break;
        case QSql::LowPrecisionInt64:
            r = QVariant(d->stmt.ColumnInt64(idx));
            break;
        case QSql::LowPrecisionDouble:
            r = QVariant(d->stmt.ColumnReal(idx));
            break;
        case QSql::HighPrecision:
        default:
            TPtrC res;
            d->stmt.ColumnText(idx, res);
            r = QVariant(qt_TDesC2QString(res));
            break;
        };
        break;
    case ESqlNull:
        r  = QVariant(QVariant::String);
        break;
    default:
        TPtrC res;
        d->stmt.ColumnText(idx, res);
        r = QVariant(qt_TDesC2QString(res));
        break;
    }

    return r;
}    
开发者ID:maxxant,项目名称:qt,代码行数:49,代码来源:qsql_symsql.cpp

示例3: DecodeEncodingVersionL

void CWspHeaderReader::DecodeEncodingVersionL(RHeaderField& aHeader) const
	{
	TPtrC8 rawData;
	aHeader.RawDataL(rawData);
	CheckLengthL(rawData, 1);
	TWspPrimitiveDecoder wspDecoder(rawData);
	
	if( !(CheckNullDesPartL(aHeader, rawData, 0)) )
		{
		// Check type and decode accordingly
		switch( wspDecoder.VarType() )
			{
			case TWspPrimitiveDecoder::ELengthVal:
				{
				TInt valLength = 0;
				TInt bytesRead = 0;
				TInt err = wspDecoder.LengthVal(valLength);
				User::LeaveIfError(err);
				bytesRead += err;
				if( wspDecoder.VarType() == TWspPrimitiveDecoder::E7BitVal )
					{
					TUint8 codePage = 0;
					err = wspDecoder.Val7Bit(codePage);
					User::LeaveIfError(err);
					bytesRead += err;
					SetNewIntegerPartL(aHeader, 0, codePage);
					if( bytesRead < rawData.Length() )
						{
						// Check for Null string first
						if( rawData[bytesRead] == 0 )
							SetNewFStringPartL(aHeader, 1, KNullDesC8());
						else
							DecodeGenericVersionL(aHeader, wspDecoder, 1);
						}
					}
				else
					User::Leave(KErrCorrupt);
				} break;
			case TWspPrimitiveDecoder::EString:
			case TWspPrimitiveDecoder::E7BitVal:
				{
				DecodeGenericVersionL(aHeader, wspDecoder, 0);
				} break;
			default:
				User::Leave(KErrCorrupt);
				break;
			}
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:49,代码来源:CWspHeaderReader.cpp

示例4: ReadNewVersionFileL

TInt CVersionFileReader::ReadNewVersionFileL(const TDesC& versionFile)
{
   iNewVersionArray->Reset();
   class RFs& fs = CCoeEnv::Static()->FsSession();
   class RFile file;
   TInt ret = file.Open(fs, versionFile, 
                        EFileStreamText | EFileRead);
   if(ret != KErrNone) {
      /* Could not open file, return the error code */
      return ret;
   }
   
   HBufC8* line = HBufC8::NewLC(40);
   TInt pos = -1;
   file.Seek(ESeekStart, pos);
   TPtr8 pLine = line->Des();
   ret = file.Read(pLine);
   if(line->Length() == 0) {
      // Empty file
      file.Close();
      return KErrEof;
   }
   file.Close();

   // The file contains a string that should match this regex:
   // [0-9]+\.[0-9]+\.[0-9]\+:[0-9]+\.[0-9]+\.[0-9]\+:[0-9]\+
   // The string is separated into three parts by ':'. 
   // The first part is the application version
   // The second part is the resource version
   // The third part is the mlfw version.
   const TChar colon = ':';
   const TChar dot = '.';
   while(line->Length() > 0) {
      if(line->Locate(colon) != KErrNotFound) {
         TPtrC8 part = line->Left(line->Locate(colon));
         TPtrC8 version = part.Left(part.LocateReverse(dot));
         TPtrC8 misc = part.Right(part.Length() - part.LocateReverse(dot) - 1);
         iNewVersionArray->AppendL(part);
         iNewVersionArray->AppendL(version);
         iNewVersionArray->AppendL(misc);
         line->Des().CopyF(line->Right(line->Length() - line->Locate(colon) - 1));
      } else {
         iNewVersionArray->AppendL(*line);
         break;
      }
   }
   CleanupStack::PopAndDestroy(line);
   return 0;
}
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:49,代码来源:VersionFileReader.cpp

示例5: ProcessResponseBodyDataL

void CHttpController::ProcessResponseBodyDataL( RHTTPTransaction& aTransaction )
	{
	MHTTPDataSupplier* body = aTransaction.Response().Body();

	TPtrC8 dataPart;
	body->GetNextDataPart( dataPart );

	if ( iOutputStream )
		{
		iOutputStream->WriteL( dataPart );
		}
	else
		{
		TInt bufLength( iResponseData->Des().Length() );
		TInt maxBufLength( iResponseData->Des().MaxLength() );
		if ( bufLength + dataPart.Length() > maxBufLength )
			{
			iResponseData = iResponseData->ReAllocL( bufLength + dataPart.Length() );
			}
		iResponseData->Des().Append( dataPart );
		}
	body->ReleaseData();
	StartTimeout();
	}
开发者ID:Symbian9,项目名称:symbian-http-engine,代码行数:24,代码来源:HttpController.cpp

示例6: WriteBufL

void CRDebugWriter::WriteBufL(const TDesC8& aBuf)
	{
	TInt maxLen = 256;

	// RDebug::Print only accepts 256 chars on the kernel side, so split the write up
	TInt pos = 0;
	while (pos < aBuf.Length())
		{
		TPtrC8 frag = aBuf.Mid(pos, Min(maxLen, aBuf.Length() - pos));
		//Exec::DebugPrint((TAny*)&frag, 1); // This is quicker than calling RDebugPrint - cuts down on a memory copy
		// ^ Except that you can't do it from non-euser code...
		LtkUtils::RawPrint(frag);
		pos += frag.Length();
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:15,代码来源:MiscServer.cpp

示例7: CheckPathMatch

TBool CExampleCookieManager::CheckPathMatch(CCookie& aCookie, const TUriC8& aUri) const
	{
	THTTPHdrVal attributeVal;
	aCookie.Attribute(CCookie::EPath, attributeVal);
	TPtrC8 cookiePath = RemoveQuotes(attributeVal.StrF().DesC());

	const TDesC8& uriPath = aUri.Extract(EUriPath);
	if(uriPath.Length() == 0)
		{
		// if the uri has no path then it matches against no cookie path
		// or a cookie path of just a /
		const TInt pathLength = cookiePath.Length();
		if(pathLength == 0 || pathLength == 1)
			return ETrue;
		}
	else if(uriPath.FindF(cookiePath) == 0)
		{
		TChar separator('/');
		// Check that the character after the matched bit is a / otherwise
		// /path would match against /path2
		const TInt uriLength = uriPath.Length();
		const TInt cookieLength = cookiePath.Length();

		if(uriLength == cookieLength)
			return ETrue;
		else if(uriLength > cookieLength)
			{
			if(cookiePath[cookieLength - 1] == TUint(separator))
				return ETrue;
			else if(uriPath[cookieLength] == TUint(separator))
				return ETrue;
			}
		}

	return EFalse;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:36,代码来源:examplecookiemanager.cpp

示例8: ReceiveMessageL

// -----------------------------------------------------------------------------
// CSeiForwardPlugin::ReceiveMessageL
// 
// 
// -----------------------------------------------------------------------------
//
void CSeiForwardPlugin::ReceiveMessageL( TInt aChannel, TPtrC8 aMessage )
	{
	RDebug::Print( _L( "EcmtSeiForwardPlugin::ReceiveMessageL: channel = %d" ), aChannel );
	
	HBufC8* buf = HBufC8::NewLC( KMaxMsgPrefixLen + 1 + aMessage.Length() );
	TPtr8 message = buf->Des();
		
	message.Format( KMsg, aChannel );
	message.Append( KBlanco );
	message.Append( aMessage );
		
	CEcmtMessageEvent* m = iMessaging->NewMessageEvent( TUid::Uid( KSEIFORWARDPLUGIN_IMPL_UID ), message );
	
	User::LeaveIfNull( m );
	iMessaging->GetMessageSender()->SendMessage( m );
	}
开发者ID:fedor4ever,项目名称:packaging,代码行数:22,代码来源:EcmtSeiForwardPlugin.cpp

示例9: IsNewComment

TBool CTestConfig::IsNewComment(const TDesC8& aSource, const TLex8& aLex) const
	{
	TBool ret(EFalse);

	const TPtrC8 token(aLex.MarkedToken());
	const TPtrC8 commentStart(KScriptCommentStart);
	const TInt commentStartLen(commentStart.Length());
	const TInt tokenLen(token.Length());

	if (commentStartLen <= tokenLen && token.Left(commentStartLen).Compare(commentStart) == 0)
		{
		ret = IsAtStartOfNewLine(aSource, aLex, ETrue);
		}

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

示例10: UsernameTokenL

EXPORT_C TInt CSenWsSecurityHeader::UsernameTokenL(const TDesC8& aUsername, HBufC8*& aToken)
    {
    TPtrC8 nsPrefix = KSecurityXmlNsPrefix();
    aToken = HBufC8::NewLC( KUsernameTokenStartTagFmt().Length() +
                            KUsernameFmt().Length() +
                            KUsernameTokenEndTag().Length() +
                            aUsername.Length() + 
                            nsPrefix.Length() * 4 );

    TPtr8 ptr = aToken->Des();
    ptr.Format(KUsernameTokenStartTagFmt, &nsPrefix);
    ptr.AppendFormat(KUsernameFmt, &nsPrefix, &aUsername, &nsPrefix);
    ptr.AppendFormat(KUsernameTokenEndTag, &nsPrefix);
    CleanupStack::Pop();    // aToken
    return KErrNone;
    }
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:16,代码来源:senwssecurityheader.cpp

示例11: IsTokenTextPair

// -----------------------------------------------------------------------------
// SdpUtil::IsTokenTextPair
// Checks if aValue is valid pair ("valid token":"valid byte-string")
// -----------------------------------------------------------------------------
//
TBool SdpUtil::IsTokenTextPair(
    const TDesC8& aValue, 
    TInt aStart,
    TInt aEnd )
	{
	// token ":" text
	TBool result = EFalse;
	if ( aStart >= 0 && aEnd <= aValue.Length() && aStart < aEnd )
		{
		TPtrC8 subVal = aValue.Mid( aStart, aEnd - aStart );
		TInt colonPos = subVal.Locate( KColonChar );
		result = colonPos != KErrNone &&
                 IsToken( subVal, 0, colonPos ) &&
                 IsByteString( subVal, colonPos + 1, subVal.Length() );
		}
	return result;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:22,代码来源:sdputil.cpp

示例12:

SHVStringBufferUTF8 SHVStringUTF8::Copy(const TPtrC8& aPtr)
{
SHVStringBufferUTF8 retVal;
size_t len = aPtr.Length();

	if (len)
	{
		retVal.Buffer = (SHVChar*)::malloc((len+1)*sizeof(SHVChar));
		if (retVal.Buffer)
		{
			memcpy(retVal.Buffer, aPtr.Ptr(), len*sizeof(SHVChar));
			retVal.Buffer[len] = 0;
		}
	}

	return retVal;
}
开发者ID:ElmerFuddDK,项目名称:libshiva,代码行数:17,代码来源:shvstringutf8.cpp

示例13: FrameworkVersion

TPtrC8 CIdWsfCoreServiceConsumer::FrameworkVersion()
    {
    TPtrC8 fwVersion = iService->FrameworkVersion();

#ifdef _SENDEBUG
    if(fwVersion.Length()>0)
        {
        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMaxLogLevel ,(fwVersion));
        }
    else
        {
        TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel ," - framework version not set - ");
        }
#endif

    return fwVersion;
    }
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:17,代码来源:idwsfcoreserviceconsumer.cpp

示例14: PopulateScaFieldsAndRemove

void CATSmsMessagingRead::PopulateScaFieldsAndRemove(TPtrC8& aPdu, RMobilePhone::TMobileAddress& aGsmServiceCentre)
//
// Populate the SCA field in the MM ETel structure from the SCA prepended in a received PDU.
//
	{
	const TUint8 KTONBitMask =0x70;
	const TUint8 KNPIBitMask=0x0f;
	const TUint8 KTONBitShift=4;
	const TUint8 KNPIBitShift=0;
	_LIT(KInternationalPrefix,"+");

	__ASSERT_ALWAYS(aPdu.Length()>0,Panic(ECMTHandlerDesPassedWithZeroLength));

	aGsmServiceCentre.iTypeOfNumber=(RMobilePhone::TMobileTON)0;
	aGsmServiceCentre.iNumberPlan=(RMobilePhone::TMobileNPI)0;
	aGsmServiceCentre.iTelNumber.Zero();
	
	TUint8 len=aPdu[0];
	
	if(len==0)
		{
		// A zero length SCA has been prepended - just strip this first byte off
		aPdu.Set(aPdu.Mid(len+1));
		return;
		}

	TUint8 numDes=aPdu[1];
	aGsmServiceCentre.iTypeOfNumber=(RMobilePhone::TMobileTON)((numDes&KTONBitMask)>>KTONBitShift);
	aGsmServiceCentre.iNumberPlan=(RMobilePhone::TMobileNPI)((numDes&KNPIBitMask)>>KNPIBitShift);

	if(aGsmServiceCentre.iTypeOfNumber==RMobilePhone::EInternationalNumber)
		aGsmServiceCentre.iTelNumber.Append(KInternationalPrefix);

	TInt i;
	TUint16 digit;
	for(i=2;i<(len+1);i++)
		{
		digit=(TUint16)((aPdu[i]&0x0f)+0x30);
		aGsmServiceCentre.iTelNumber.Append(digit);
		digit=(TUint16)(((aPdu[i]&0xf0)>>4)+0x30);
		if(digit==0x003f)		// 'F' is the padding digit at the end of a number
			break;
		aGsmServiceCentre.iTelNumber.Append(digit);
		}
	aPdu.Set(aPdu.Mid(len+1));
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:46,代码来源:mSMSREAD.CPP

示例15: Load

EXPORT_C TInt TMetaVarLenBase::Load(TPtrC8& aBuffer)
/**
 * Loads content of descriptor data member
 */
	{
	// Check if the descriptor is long enough
	TInt errlen = CheckBuf( aBuffer );
	if (errlen < 0)
		{
		return errlen;
		}

	//and copy whatever we can into the client descriptor
	CopyBuf(aBuffer,errlen);

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


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