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


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

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


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

示例1: ret

TInt CSatNotifySendSs::CheckSsStringValidity
		(
    	TPtrC8 aSsString 
    	)
    {
    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKSSSTRINGVALIDITY_1, "CSAT:: CSatNotifySendSs::CheckSsStringValidity");
    TInt ret( KErrNone );
    
    if ( !aSsString.Length() )
        {
        OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKSSSTRINGVALIDITY_2, "CSAT:: CSatNotifySendSs::CheckSsStringValidity, String length is NULL");
        // If length is zero
        ret = KErrCorrupt;
        }
    
    _LIT8( KDtmf,            "p");
    _LIT8( KWild,            "w");
    _LIT8( KExpansionDigit,  ".");

    // SS string can contain only digits, star '*' and dash '#' characters.
    if ( ( KErrNotFound != aSsString.Find( KDtmf ) )
        || ( KErrNotFound != aSsString.Find( KWild ) )
        || ( KErrNotFound != aSsString.Find( KExpansionDigit ) ) )
        {
        OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKSSSTRINGVALIDITY_3, "CSAT:: CSatNotifySendSs::CheckSsStringValidity, Incompatible character found");
        ret = KErrCorrupt;
        }
    return ret;
    }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:29,代码来源:CSatNotifySendSs.cpp

示例2: ReadAssignment

TInt CVBookmarkConverter::ReadAssignment( const TDesC8& aBuffer,
    TInt& aPosition, TPtrC8& aTag, TPtrC8& aValue )
    {
    LOGGER_ENTERFN( "CVBookmarkConverter::ReadAssignment" );    
        
    TPtrC8 start = aBuffer.Mid( aPosition );
    TInt assignment = start.Find( KVBMKAssignment );
    TInt linefeed = start.Find( KVBMKLinefeed );
    
    // Did we find the delimeter and the linefeed
    if ( ( assignment == KErrNotFound) || ( linefeed == KErrNotFound ) )
        {
        return KErrNotFound;
        }
    // Linefeed must reside behind the delimeter
    if ( linefeed <= assignment )
        {
        return KErrNotFound;
        }
    // Extract tag
    aTag.Set( start.Left( assignment ) );
    IgnoreSpaces( aTag );

    // Extract value
    aValue.Set( start.Mid( assignment + 1, ( linefeed - 1 ) - assignment ) );
    IgnoreSpaces( aValue );
    
    // update position
    aPosition += ( linefeed + KVBMKLinefeed().Length() );

    LOGGER_LEAVEFN( "CVBookmarkConverter::ReadAssignment" );        
    return KErrNone;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:33,代码来源:vbookmarkconverter.cpp

示例3: ptr

void
CContentWindowContainer::DataReceived(class MBrCtlLinkContent* aLinkContent,
      const isab::DataGuiMess* aMess, const char *aUrl)
{
   HBufC8* data = NULL;
   HBufC* contentType = NULL;
   HBufC* url = WFTextUtil::AllocLC(aUrl);
   TPtr8 ptr(const_cast<unsigned char*>(aMess->getData()), aMess->getSize(), aMess->getSize());

   TInt neck = ptr.Find(KNeck());
   if (neck == KErrNotFound) {
      data = HBufC8::NewLC( ptr.Length());
      data->Des().Copy(ptr);
      contentType = WFTextUtil::AllocLC("text/html");

   } else {
      TPtrC8 header = ptr.Left(neck);
      TPtrC8 body = ptr.Mid(neck+4);

      data = HBufC8::NewLC( body.Length());
      data->Des().Copy(body);

      TInt pos = header.Find(KLineEnd);
      TPtrC8 rest = header;
      while (pos != KErrNotFound) {
         TPtrC8 tmp = rest.Left(pos);
         rest.Set(rest.Mid(pos+2));
         pos = rest.Find(KLineEnd);
         TInt ctpos = tmp.FindF(KContentTypeMarker);
         if (ctpos != KErrNotFound) {
            TPtrC8 tmp2 = tmp.Mid(ctpos+KContentTypeMarker().Length());
            TInt scpos = tmp2.Find(KSemiColon);
            if (scpos == KErrNotFound) {
               contentType = HBufC::NewLC(tmp2.Length());
               contentType->Des().Copy(tmp2);
            } else {
               contentType = HBufC::NewLC(tmp2.Left(scpos).Length());
               contentType->Des().Copy(tmp2.Left(scpos));
            }
            break;
         }
      }

      if (!contentType) {
         contentType = WFTextUtil::AllocLC("text/html");
      }
   }

/*    contentType = RecognizeLC(*url, ptr); */
/*    contentType = WFTextUtil::AllocLC("text/html"); */


   aLinkContent->HandleResolveComplete(*contentType, KCharSet, data);

   CleanupStack::PopAndDestroy(contentType);
   CleanupStack::PopAndDestroy(data);
   CleanupStack::PopAndDestroy(url);
}
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:58,代码来源:ContentWindowContainer.cpp

示例4: DescriptionUrlPort

// -----------------------------------------------------------------------------
// CUpnpDevice::DescriptionUrlPort
// Retrun description URL port.
// -----------------------------------------------------------------------------
//
EXPORT_C TInt CUpnpDevice::DescriptionUrlPort() const
    {
    if ( iAddress != TInetAddr( INET_ADDR( 0,0,0,0 ), 0) )
        {
        return iAddress.Port();
        }

    const TDesC8& url = DescriptionUrl();

    if ( url.Length()> KHttp().Length() )
        {
        TPtrC8 addrAndPath = url.Right( url.Length() - KHttp().Length() );

        TInt separIndex = addrAndPath.Find( KSepar() );

        if ( separIndex == KErrNotFound )
            {
            return KDefaultDescriptionUrlPort;
            }

        TInt slashIndex = addrAndPath.Find( KSlash8() );

        if ( slashIndex != KErrNotFound )
            {
            TPtrC8 port = addrAndPath.Mid(
                    separIndex + 1, slashIndex - separIndex
            );

            TLex8 lex( port );
            TInt prt;
            TInt err = lex.Val( prt );
            if( KErrNone != err )
                {
                return KErrNotFound;
                }

            return prt;
            }
        else
            {
            TPtrC8 port = addrAndPath.Right(
                    addrAndPath.Length() - ( separIndex + 1 )
            );

            TLex8 lex( port );
            TInt prt;
            TInt err = lex.Val( prt );
            if( KErrNone != err )
                {
                return KErrNotFound;
                }

            return prt;
            }
        }

    return KDefaultDescriptionUrlPort;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:63,代码来源:upnpdevice.cpp

示例5: DoSubmitL

void CTestFilter::DoSubmitL( RHTTPTransaction aTransaction )
{
	RHTTPHeaders hdr = aTransaction.Request().GetHeaderCollection();
	
	RStringF fieldname = aTransaction.Session().StringPool().StringF(HTTP::EUserAgent,RHTTPSession::GetTable());
	
	TBool found = EFalse;
	TPtrC8 rawFieldData;
	
	hdr.GetRawField(fieldname, rawFieldData);
	
	found = rawFieldData.Find(iUserAgent.DesC()) != KErrNotFound;
	
	if(!found)
	    hdr.SetFieldL(fieldname, iUserAgent);
	
    if( iHaveCredentials )
        {
        TBuf8<KB64KeySize> keyBase64(_L8("Aladdin")); 
        TBuf8<KB64KeySize> keyBase64Username(_L8("open sesame"));;
        RString username = iStringPool.OpenStringL( keyBase64 );
        CleanupClosePushL<RString>( username );
        RString password = iStringPool.OpenStringL( keyBase64Username );
        CleanupClosePushL<RString>( password );
		EncodeBasicAuthL(username, password, aTransaction);
        CleanupStack::PopAndDestroy(&password);
        CleanupStack::PopAndDestroy(&username);
        	
        }
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:30,代码来源:testhttpfilter.cpp

示例6: ptr

EXPORT_C HBufC8* CTestConfig::ReplaceLC(const TDesC8& aOld, const TDesC8& aNew, const TDesC8& aOldString)
	{
	HBufC8* rString = aOldString.AllocLC();
	TInt oldLen = aOld.Length();
	TInt newLen = aNew.Length();

	if (!oldLen)
		return rString;

	for (TInt pos = 0; pos < rString->Length(); pos += newLen)
		{
		TPtrC8 ptrC = rString->Mid(pos);
		TInt find = ptrC.Find(aOld);

		if (find == KErrNotFound)
			return rString;
	
		pos += find;

		if (newLen > oldLen)
			{
			rString = rString->ReAllocL(rString->Length() + newLen - oldLen);
			CleanupStack::Pop();
			CleanupStack::PushL(rString);
			}

		TPtr8 ptr(rString->Des());
		ptr.Replace(pos, oldLen, aNew);
		}

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

示例7: GetTokenValue

// -----------------------------------------------------------------------------
// Get value for given id.
// -----------------------------------------------------------------------------
//
HBufC8* CConfigurationHandler::GetTokenValue( const TDesC8& aData, 
											  const TDesC8& aKey )
	{
	if( aData.Find(aKey)==KErrNotFound )
		{
		return NULL;
		}

	// id is in the string
	TLex8 lex(aData);

	while( !lex.Eos() )
		{
		TPtrC8 token = lex.NextToken();

		TInt spos = token.Find(aKey);
		if( spos==KErrNotFound )
			{
			continue;
			}

		// key was found return value		
		
		TPtrC8 value = token.Right(token.Length()-aKey.Length()); 

		HBufC8* retval = HBufC8::NewL(value.Length());
		TPtr8 des = retval->Des();
		des.Append(value);
		return retval;
		}
		
	return NULL;
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:37,代码来源:configurationhandler.cpp

示例8: ValidateElementNsL

TBool CPolicyNormalizer::ValidateElementNsL(CSenElement* aAssertion)
{
  
  CSenElement& element = AsElement();
  RPointerArray<CSenNamespace>& namespaces = element.NamespacesL();
  
  if(aAssertion->NamespaceURI().Length() < 1 )
  {
  
   TPtrC8 elementName = aAssertion->LocalName();
   TInt location = elementName.Find(KColon);
   
   if (location)
       {
        TPtrC8 nsPrefix = elementName.Left(location);
          
        CSenNamespace* ns = NULL;
        TInt count = namespaces.Count();
        for (TInt i=0; i < count; i++)
            {
            ns = (namespaces)[i];
            if(ns->Prefix().Compare(nsPrefix) == 0)
                {
                aAssertion->SetNamespaceL(ns->Prefix(),ns->URI());
                return ETrue;
                }
            }
        }
    }
    return EFalse;
}
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:31,代码来源:PolicyNormalizer.cpp

示例9: Match

TBool CExampleResolver::Match(const TDesC8& aImplementationType, 
	const TDesC8& aMatchType, 
	TBool aUseWildcards) const
	{
	TInt matchPos = KErrNotFound;

	_LIT8(dataSeparator, "||");
	const TInt separatorLength = dataSeparator().Length();

	// Look for the section separator marker '||'
	TInt separatorPos = aImplementationType.Find(dataSeparator);
	if(separatorPos == KErrNotFound)
		{
		// Match against the whole string
		if(aUseWildcards)
			matchPos = aImplementationType.Match(aMatchType);
		else
			matchPos = aImplementationType.Compare(aMatchType);
		}
	else
		{
		// Find the first section, up to the separator
		TPtrC8 dataSection = aImplementationType.Left(separatorPos);
		TPtrC8 remainingData = aImplementationType.Mid(separatorPos + separatorLength);
		// Match against each section in turn
		while(separatorPos != KErrNotFound)
			{
			// Search this section
			if(aUseWildcards)
				matchPos = dataSection.Match(aMatchType);
			else
				matchPos = dataSection.Compare(aMatchType);

			// If we found it then no need to continue, so return
			if(matchPos != KErrNotFound)
				return ETrue;

			// Move on to the next section
			separatorPos = remainingData.Find(dataSeparator);
			if(separatorPos != KErrNotFound)
				{
				dataSection.Set(remainingData.Left(separatorPos));
				remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
				}
			else
				dataSection.Set(remainingData);
			}

		// Check the final part
		if(aUseWildcards)
			matchPos = dataSection.Match(aMatchType);
		else
			matchPos = dataSection.Compare(aMatchType);

		}
	return matchPos != KErrNotFound;
	}
开发者ID:fedor4ever,项目名称:testcreationandmgmt,代码行数:57,代码来源:ExampleResolver.cpp

示例10: DescriptionUrlAddressL

// -----------------------------------------------------------------------------
// CUpnpDevice::DescriptionUrlAddressL
// Return description URL address.
// -----------------------------------------------------------------------------
//
EXPORT_C TInetAddr CUpnpDevice::DescriptionUrlAddressL() const
    {
    if ( iAddress == TInetAddr( INET_ADDR( 0,0,0,0 ), 0) )
        {

        const TDesC8& url = DescriptionUrl();

        if ( url.Length()> KHttp().Length() )
            {
            TPtrC8 addrAndPath = url.Right( url.Length() - KHttp().Length() );

            TInt index = addrAndPath.Find( KSepar() );

            if ( index == KErrNotFound )
                {
                index = addrAndPath.Find( KSlash8() );
                }

            if ( index == KErrNotFound )
                {
                return TInetAddr( INET_ADDR( 0,0,0,0 ), 0 );
                }

            TPtrC8 addr = addrAndPath.Left( index );

            TInetAddr address;

            HBufC* addrBuf = HBufC::NewLC(addr.Length());
            addrBuf->Des().Copy(addr);
            address.Input(*addrBuf);
            CleanupStack::PopAndDestroy(addrBuf);

            return address;
            }

        return TInetAddr(INET_ADDR( 0,0,0,0 ), 0 );
        }

    return iAddress;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:45,代码来源:upnpdevice.cpp

示例11: IsNewSection

TBool CTestConfig::IsNewSection(const TDesC8& aSource, const TLex8& aInput) const
/**
 * Checks whether the current marked token in aInput starts with a '[' and ends with a ']',
 * and checks that this token is at the start of a line.
 *
 * @returns Whether this is a new section in the script file
 */
	{
	const TPtrC8 token(aInput.MarkedToken());
	const TInt offset(aInput.MarkedOffset());

	TBool ret = token.Length() > 2 && token.Find(KScriptSectionStart) == 0;
	ret = ret && token.Find(KScriptSectionEnd) != KErrNotFound;

	if (ret && offset > 0)
		{
		const TPtrC8 lastChar(aSource.Mid(offset-1, 1));
		ret = ret && (lastChar == KScriptLF || lastChar == KScriptCR);
		}

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

示例12: MatchServiceCmd

TBool CAiwResolver::MatchServiceCmd(const TDesC8& aOpaqueData, const TDesC8& aServiceCmd) const
    {
    _LIT8(dataSeparator, "||");
    const TInt separatorLength = dataSeparator().Length();

    // Look for the section separator marker '||'
    TInt separatorPos = aOpaqueData.Find(dataSeparator);

    if (separatorPos == KErrNotFound)
        {
         if (aServiceCmd.Compare(aOpaqueData) == 0)
            {
            return ETrue;   
            }
        }
    else
        {
         // Find the first section, up to the separator
        TPtrC8 dataSection = aOpaqueData.Left(separatorPos);
        TPtrC8 remainingData = aOpaqueData.Mid(separatorPos + separatorLength);

        // Match against each section in turn
        while (separatorPos != KErrNotFound)
            {
            if (dataSection.Compare(aServiceCmd) == 0)
                {
                return ETrue;
                }

            // Move on to the next section
            separatorPos = remainingData.Find(dataSeparator);

            if (separatorPos != KErrNotFound)
                {
                dataSection.Set(remainingData.Left(separatorPos));
                remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
                }
            else
                {
                dataSection.Set(remainingData);
                }   
            }

        if (dataSection.Compare(aServiceCmd) == 0)
            {
            return ETrue;   
            }       
        }

    return EFalse;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:51,代码来源:AiwResolver.cpp

示例13: ParseLicenseL

// ---------------------------------------------------------
// CDdEng::ParseLicenseL()
// ---------------------------------------------------------
//
void CDdEng::ParseLicenseL()
{
	HBufC8* descriptorBuf = CodUtil::ConvertLC( iCodBuf->Des());
	TPtrC8 license;
	TPtrC8 descriptor (descriptorBuf->Ptr());
	TInt startTag = descriptor.Find(KLicenseStartTag); // "<license"
	if (startTag != KErrNotFound)
	{
		descriptor.Set(descriptor.Right(descriptor.Length()- startTag -1));
		TInt endTag = descriptor.Locate(KElementEnd); //'>'
		if (endTag != KErrNotFound)
		{
			license.Set(descriptor.Right(descriptor.Length()-endTag-1));
			TInt licenseTagEnd = license.Find(KLicenseEndTag); // "</license"
			if (licenseTagEnd != KErrNotFound)
			{
				license.Set(license.Left(licenseTagEnd));
			}
		}
	}
	iSaver->AppendData( license );
	CleanupStack::PopAndDestroy( descriptorBuf );
}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:27,代码来源:DdEng.cpp

示例14: ValueTokensL

TInt CSenPropertiesElement::ValueTokensL(const TDesC8& aDelimiter,
                                         RPointerArray<TPtrC8>& aTokens)
    {
    TPtrC8 content = this->Content();
    TInt delim = content.Find(aDelimiter);
    while ( delim != KErrNotFound )
        {
        TPtrC8* piece = new (ELeave) TPtrC8();
        piece->Set(content.Mid(0,delim));
        aTokens.Append(piece);
        
        content.Set(content.Mid(delim+aDelimiter.Length(),
                                content.Length()-(delim+aDelimiter.Length())));

        delim = content.Find(aDelimiter);
        }

    if(!(this->Content()!=KNullDesC8 && content==KNullDesC8))
        {
        // If this property does NOT zero-length content
        // and the "last" (or first) token is KNullDesC8
        // it means that the string ends with delimiter;
        // Therefore, KNullDesC8 must NOT be added as a
        // result of "tailing delimiter".

        // Add all other tokens here; even KNullDesC8
        // gets added, if it is eiher first or 
        TPtrC8* token = new (ELeave) TPtrC8();
        token->Set(content);
        aTokens.Append(token);
        }    
    if (aTokens.Count() == 0)
        {
        return KErrNotFound;
        }
    return KErrNone;
    }
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:37,代码来源:senpropertieselement.cpp

示例15: pos

void CSatNotifySendSs::CheckCallForwarding
		( 
    	TPtrC8 aSource,               
    	RSat::TSsString& aSsString 
    	)
    {
    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKCALLFORWARDING_1, "CSAT:: CSatNotifySendSs::CheckCallForwarding");
    _LIT8(KCFU,"*21*");    // Call forwarding unconditional (CFU)
    _LIT8(KCFB,"*67*");    // Call forwarding on Mobile Subscriber Busy(CFB)
    _LIT8(KCFNRy, "*61*"); // Call forwarding on No Reply (CFNRy)
    _LIT8(KCFNRc, "*62*"); // Call forwarding on Mobile Subscriber Not 
                           // Reachable (CFNRc)    
    // Try to find call forwarding string
    TInt pos( aSource.Find( KCFU ) );
    if ( KErrNotFound == pos )
        {
        pos = aSource.Find( KCFB );
        }
    if ( KErrNotFound == pos )
        {
        pos = aSource.Find( KCFNRy );
        }
    if ( KErrNotFound == pos )
        {
        pos = aSource.Find( KCFNRc );
        }
    if ( KErrNotFound != pos )
        {
        OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKCALLFORWARDING_2, "CSAT:: CSatNotifySendSs::CheckCallForwarding, String is for call forwarding");
        aSsString.iSsString.Zero();
        aSsString.iSsString.Append( aSource.Left( pos + 4 ) );
        aSsString.iSsString.Append( KPlusMarkCharacterCode );
        aSsString.iSsString.Append( 
            aSource.Right( aSource.Length() - ( pos + 4) ) );
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:36,代码来源:CSatNotifySendSs.cpp


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