Example #1
0
void CATDtmfVts::ParseResponseL(const TDesC8& aResponseBuf)
	{
	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDtmfVts::ParseResponseL()"));
	
	if (aResponseBuf.Match(KLtsyOkString) == 0)
		{
		iATResult = KErrNone;
		iOKFounded = ETrue;
		}
	else if(aResponseBuf.Match(KLtsyErrorString) == 0)
		{
		iATResult = KErrArgument;
		}
	}
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;
	}