Example #1
0
EXPORT_C TPtrC TEFparser::Trim(const TDesC& aBuf)
	{
	TInt startPos = 0;
	TInt endPos = 0;
	TInt i = 0, j = 0;
		
	for(i = 0; i < aBuf.Length() ; i ++)
		{
		TPtrC tmpChar = aBuf.Mid(i,1);
		if(tmpChar != KSpace && tmpChar != KTab && tmpChar != KReturn && tmpChar != KNewline )
			{
			startPos = i;
			break;
			}
		}
	for(j = aBuf.Length()-1; j >= 0 ; j --)
		{
		TPtrC tmpChar1 = aBuf.Mid(j,1);
		if(tmpChar1 != KSpace && tmpChar1 != KTab && tmpChar1 != KReturn && tmpChar1 != KNewline )
			{
			endPos = j;
			break;
			}
		}
	if(endPos < startPos)
		{
		endPos = aBuf.Length();
		}
	
//	TInt len = aBuf.Length() - (startPos + endPos);
	return aBuf.Mid(startPos, endPos - startPos + 1);
	
	}
//From MOperationObserver
void CHandleLoginOrExit::OperationEvent(TInt aEventType,const TDesC& aEventData,TInt aType)
{
	UtilityTools::WriteLogsL(_L("CHandleLoginOrExit::OperationEvent aEventType = %d,aType = %d"),aEventType,aType);
	if(aEventType==EHttpNoError)
	{
		if(aType==EHttpLogin)
		{
			if(aEventData.Mid(8,8).Compare(_L("10000099"))==0)
			{
				this->CheckGateWay(aEventData.Mid(101,1));
				this->CheckAppUpdate(aEventData.Mid(98,1));
				this->CheckContentUpdate(aEventData.Mid(99,1));
				this->CheckRegisterPhone(aEventData.Mid(97,1));
				this->CheckSystemInfo(aEventData);
			}
			else
			{
				iObserver.HandleResponseEvent(EHttpContentError,aType);
				return;
			}
		}
	}
	else
	{
		iBuf=HBufC::NewL(aEventData.Length());
		iBuf->Des().Copy(aEventData);
	}
	iObserver.HandleResponseEvent(aEventType,aType);
	UtilityTools::WriteLogsL(_L("CHandleLoginOrExit::OperationEvent"));
}
void CContentInfoDialog::AddTextItem(const TDesC& aText)
{
	TInt textPos = 0;
 	while(textPos < aText.Length())
	{	
		TInt charNum = iMainEngine.ScreenLayout().Font()->TextCount(aText.Mid(textPos),iLineWidth);
 		const TDesC& tmpDes = aText.Mid(textPos,charNum);

		iDesArray->AppendL(tmpDes);
		textPos += charNum;
	}
	InitScrollBar();
}
// -----------------------------------------------------------------------------
// For Devanagari AS
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//  
inline void UpdateNextCharsL( HBufC*& aNextChars, const TDesC& aItemString )
	{
	TChar searchChar = aItemString[0];
    //Check if this is an Indic special ligature
    if ( IsIndicConsonant(searchChar) && aItemString.Length() > 2
            && IsSpecialIndicLigature(aItemString) 
            && KErrNotFound == (*aNextChars).Find(aItemString.Mid(0,3)) )
        {
        //Check if we have enough space for 3 more characters
        if( aNextChars->Des().Length() >= aNextChars->Des().MaxLength()-3 )
            {
            aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 );
            }       
        aNextChars->Des().Append( aItemString.Mid(0,3) );        
        }
    else
        {
        //check if this is an Indic combined Char
        if ( IsIndicCombinedChar(searchChar) )
            {
            searchChar = RemoveIndicNukta( searchChar );
            }
        //Now update the nextChars string
        TInt strLength = aNextChars->Length();
        for ( TInt i(0); i < strLength ; ++i )
            {
            if ( IsSpecialIndicLigature( (*aNextChars).Mid( i ) ) )
                {
                //As aItemString is not a special ligature (checked above)
                //we can move directly to the 3rd character from here
                i+=2;
                }
            else if ( searchChar.GetUpperCase() == (*aNextChars)[i] ||
                        searchChar.GetLowerCase() == (*aNextChars)[i] )
                {
                //already exists - do nothing
                return;
                }
            //else continue the loop
            }
        //So this character is not yet in the list of nextChars.
        if ( aNextChars->Des().Length() == aNextChars->Des().MaxLength() )
            {
            aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 );
            }       
        aNextChars->Des().Append( searchChar );   
        }
   	}
void CSelectGroup::AddTextItem(const TDesC& aText)
{
    TInt textPos = 0;
    while(textPos < aText.Length())
    {
        TInt charNum = iMainEngine.ScreenLayout().Font()->TextCount(aText.Mid(textPos),iLineWidth);
        const TDesC& tmpDes = aText.Mid(textPos,charNum);

        CSelectBox* selectBox=CSelectBox::NewL(iMainEngine,ESelectText);
        selectBox->SetText(tmpDes);
        iSelectArray.Append(selectBox);

        textPos += charNum;
    }
    LayoutScrollBar();
}
TInt CFileEngine::CheckDiskSpace(const TDesC& aSourceFile,const TDesC& aDestFile)
{
	RFile file;
	TInt rv =0;
	TInt nFileLen=0;

	rv = file.Open(iFs, aSourceFile, EFileWrite|EFileShareAny);
	if (KErrNone != rv)
	{
		return 2;
	}

	file.Size(nFileLen);

	nFileLen=nFileLen/1024;

	TInt64 nDriverSize=GetFreeSpace(aDestFile.Mid(0,1));

	if((TInt64)nFileLen>nDriverSize)
	{
		//存储空间不足
		file.Close();
		return	1;
	}
	file.Close();

	return 0;
}
TInt CVtConsoleOutputController::Write(const TDesC& aDes)
	{
	TInt err = KErrNone;
	if (iMode == ConsoleMode::EBinary)
		{
		// staight collapse to 8 bit, no cleverness
		TBuf8<256> buf;
		TInt offset = 0;
		while ((offset < aDes.Length()) && (err == KErrNone))
			{
			buf.Copy(aDes.Mid(offset, Min(aDes.Length() - offset, buf.MaxLength())));
			offset += buf.Length();
			err = iOutput.Output(buf);
			}
		}
	else
		{
		// In text mode we do a UTF-16 -> UTF-8 conversion
		TRAP(err, iOutputBuf.CopyAsUtf8L(aDes));
		if (err == KErrNone)
			{
			err = iOutput.Output(iOutputBuf);
			if (err == KErrNone)
				{
				iCursorTracker->Write(aDes);
				}
			}
		}
	return err;
	}
EXPORT_C void CTestUtils::PrintHex(const TDesC& aDes)
	{
	TBuf<256> temp;
	TInt pos = 0;
	const TInt len = aDes.Length();

	while (pos < len)
		{
		temp.Zero();
		TPtrC ptr = aDes.Mid(pos, Min(KNumberOfHex, len - pos));
		const TInt ptrLen = ptr.Length();

		for (TInt i = 0; i < ptrLen; i++)
			{
			temp.AppendFormat(_L("%2.2x "), ptr[i]);
			}

		if (ptrLen < KNumberOfHex)
			{
			temp.AppendFill(' ', (KNumberOfHex - ptrLen) * 3);
			}

		temp.Append(ptr);
		Printf(temp);

		pos += KNumberOfHex;
		}
	}
Example #9
0
EXPORT_C void TConsoleLine::Replace(TInt aFrom, const TDesC& aDes)
	{
	// a) Hide the cursor.
	// b) Move the cursor to aFrom.
	// c) Overwrite chars up to iBufPos.
	// d) Insert remaining chars (if any).
	// e) Make the cursor visible again.
	aFrom += iPromptLength;
	ASSERT(iBufPos >= aFrom);
	iConsole.SetCursorVisible(EFalse);
	iConsole.SetCursorPosAbs(iConsole.PosFrom(iStartPos, aFrom));
	const TInt desLength = aDes.Length();
	const TInt numOverwriteChars = iBufPos - aFrom;
	TInt lengthAdjust = 0;
	if (numOverwriteChars > 0)
		{
		iBuf.Replace(aFrom, numOverwriteChars, aDes.Left(numOverwriteChars));
		if (desLength < numOverwriteChars)
			{
			lengthAdjust = numOverwriteChars - desLength;
			iBuf.AppendFill(' ', lengthAdjust);
			iBufPos -= lengthAdjust;
			}
		}
	const TInt numInsertChars = desLength - numOverwriteChars;
	if (numInsertChars > 0)
		{
		iBuf.Insert(iBufPos, aDes.Mid(numOverwriteChars));
		iBufPos += numInsertChars;
		}
	iConsole.Write(iBuf.Mid(aFrom));
	iBuf.SetLength(iBuf.Length() - lengthAdjust);
	iConsole.SetCursorPosAbs(iConsole.PosFrom(iStartPos, aFrom + aDes.Length()));
	iConsole.SetCursorVisible(ETrue);
	}
Example #10
0
void GetExtNameFromFileName(const TDesC& aFileName, TDes& aExtName)
{
	TInt order = aFileName.LocateReverse('.');
	TInt sourceLength = aFileName.Length() - order -1;
	aExtName = aFileName.Mid(order +1, sourceLength);
	aExtName.LowerCase();
}
TBool CT_DataRGavdp::ConvertSEIDs(TDesC &aSEIDsStr, RArray<TUint>& aSEIDs)
{

    TBool ret = ETrue;

    TLex lex(aSEIDsStr);
    TInt tempSEID;
    if (lex.Val(tempSEID) == KErrNone)
    {
        aSEIDs.Append(tempSEID);
    }
    else
    {
        TInt location = aSEIDsStr.Match(_L("*,*"));
        if( location != KErrNotFound )
        {
            //Converting Left part of the data
            TPtrC	tempStr = aSEIDsStr.Left(location);
            ret = ConvertSEIDs(tempStr, aSEIDs);
            if(ret)
            {
                //Converting right data can be with another ","
                tempStr.Set(aSEIDsStr.Mid(location + 1));
                ret = ConvertSEIDs(tempStr, aSEIDs);
            }
        }
        else
        {
            ret = EFalse;
        }
    }

    return ret;
}
EXPORT_C TBool AknPhoneNumberTextUtils::WrapPhoneNumberToArrayL( 
    const TDesC& aPhoneNumberToWrap,
    TInt aLineWidthInPixels,
    TInt aMaxLines,
    const CFont& aFont,
    CArrayFix<TPtrC>& aWrappedArray )
    {
    TBool retVal( EFalse ); // Not truncated
 
    HBufC* reversedText = aPhoneNumberToWrap.AllocLC();
    TPtr revPtr = reversedText->Des();

    ReverseDescriptor( revPtr );

    CArrayFix<TInt>* lineWidthArray = new (ELeave) CArrayFixFlat<TInt>(KLineArrayGranularity);
    CleanupStack::PushL( lineWidthArray );

    lineWidthArray->AppendL( aLineWidthInPixels, aMaxLines );

    // Perform the wrap on the reversed text
    AknTextUtils::WrapToArrayL( revPtr, *lineWidthArray, aFont, aWrappedArray );

    // Now rearrange the TPtrCs to point to the original array
    TInt totalLen = reversedText->Length();
    TInt count = aWrappedArray.Count();
    TInt usedLen = 0; // Accumulates the length actually used
    for ( TInt index = 0; index < count; index++)
        {
        TPtrC& currentPtr = aWrappedArray.At(index);
        // The TPtrCs have to be moved. The reversing is taken into effect, but not purely reversed
        // because their otherwise they would have negative lengths.  That is, {a,b} does not go to
        // { final - a, final - b }, but rather to {final - b, final - a}; they are flipped, to get
        // their start points before the end points
        //
        // Now, representing the start position by pos, and the end by pos+len-1 we have the TPtrC at
        // {pos, pos+len-1} inclusive, in reversed array. 
        // The TPtrC must be modified to point to {total_len-1 - (pos+len-1), total_len-1 - pos} 
        // in the unreversed array:
        TInt len = currentPtr.Length();
        usedLen += len;
        TInt pos = currentPtr.Ptr() - reversedText->Ptr(); // pointer arithmetic
        TInt newPos = totalLen - pos - len;
        // If the TPtr is zero length then it must get special treatment, as the normal
        // calculations give an end point before the start point! i.e. {pos, pos-1}
        // We handle this by NOT flipping in this case.
        // { pos, pos-1 } -> {totalLen-1-pos, totalLen-1 - (pos-1)}
        // Note that a zero length wrapped line is completely possible amoung a bunch of other 
        // lines with characters on them, as the line lengths may be of wildly different lengths.
        if ( len == 0 ) 
            newPos--;
        currentPtr.Set( aPhoneNumberToWrap.Mid(newPos, len) );
        }

    // If the accumulated length is less than that in the entire input descriptor, then text does not fit
    if ( usedLen < totalLen )
        retVal = ETrue;

    CleanupStack::PopAndDestroy(2); // lineWidthArray first, and then reversedText
    return retVal;
    }
Example #13
0
int
TcpipComm::Open(CConsoleBase *cons, TDes &name, TDesC &destination,
			TRequestStatus &st)
{
  int r;
  TInetAddr addr;
  TPtrC servername;
  int port = 0;

  if((r = iServ.Connect()) != KErrNone)
    return r;
  if((r = iSock.Open(iServ,KAfInet,KSockStream,KProtocolInetTcp)) != KErrNone)
    return r;


  //////////////
  // Parse the destination, which is of the form ip.adress:port
  for(r = 0; r < destination.Length(); r++)
    if(destination[r] == ':')
      break;
  servername.Set(destination.Left(r)); // Wont include ':'
  TLex parser(destination.Mid(r+1));
  parser.Val(port);

  addr.SetPort(port);
  if(addr.Input(servername) != KErrNone) // Its a real hostname, wont resolv
    return 1;

  iSock.Connect(addr, st);

  TPckgBuf<int> one(1);
  iSock.SetOpt(KSoTcpNoDelay, KSolInetTcp, one);

  return 0;
}
Example #14
0
EXPORT_C TInt TEFparser::GetIniFileInfo(TDesC& aBuf, 
											  TPtrC& aIniFileName, 
											  TPtrC& aIniSectionName)
	{
	TInt pos =0;
	TInt startPos = 0, endPos = 0;
	
	
	TPtrC temp = aBuf.Mid(pos);
	
	endPos = temp.Find(KIniExtension);
	endPos += 4;
	
	if (endPos != KErrNotFound)
		{
		TInt len = endPos - startPos;
		TPtrC iniFileName = temp.Mid(startPos, len);
		aIniFileName.Set(iniFileName);
		
		TPtrC iniSectionName = temp.Mid(iniFileName.Length());
		aIniSectionName.Set(Trim(iniSectionName));
		
		return KErrNone;
		}
	else
		{
		return KErrNotFound;
		}
	
	}
Example #15
0
EXPORT_C TPtrC TEFparser::ParseNthElement(const TDesC& aBuf, TInt aWordPos)

 {
 
	 TInt startPos = KErrNotFound, endPos = KErrNotFound;
	 TInt wordCounter =0 ;
	 TBool inWord = EFalse;
	 TInt i =0;
	 
	 for(i = 0; i < aBuf.Length() ; i ++)
	  {
	  	TPtrC tmpChar = aBuf.Mid(i,1);
	  	if(tmpChar == KSpace || tmpChar == KTab || tmpChar == KReturn || tmpChar == KNewline )
	  	{
	  	if(inWord)
	  		{
	  		  if(wordCounter == aWordPos)
	  		  {
	    	   endPos =i-1;
	    	   break;
	    	   }
	  		 inWord = EFalse;
	    	}   
	   }
	  else
	   {
	   	if(inWord == EFalse)
	   		{
	   		wordCounter ++;
	   		inWord = ETrue;
	   		if(wordCounter == aWordPos)
	   			{
	   			startPos =i;
	   			}
	   		 }
	   	 }
	  } 
	 if(startPos < 0 || endPos < 0)
	 {
	  endPos = aBuf.Length();
	  return aBuf.Mid(startPos,(endPos-startPos));
	 }
	 else
	 {
	  return aBuf.Mid(startPos,(endPos-startPos+1));
	 }
}
void CFepLayoutMIcfCustomDraw::DrawText( const TParam& aParam, const TLineInfo& aLineInfo,
                                         const TCharFormat& aFormat, const TDesC& aText,
                                         const TInt aStart, const TInt aEnd, 
                                         const TPoint& aTextOrigin,TInt aExtraPixels) const
    {
    TPtrC text = aText.Mid( aStart, aEnd - aStart );
    DrawText( aParam, aLineInfo, aFormat, text, aTextOrigin, aExtraPixels );
    }
// ---------------------------------------------------------------------------
// CSmileyIcon::SetSmileyString
// ---------------------------------------------------------------------------
//
void CSmileyIcon::SetSmileyString( const TDesC& aString )
    { 
    TInt strLength( aString.Length() );
    if ( strLength > CSmileyManager::KMaxLength )
        {
        strLength = CSmileyManager::KMaxLength;
        }
    iStr.Copy( aString.Mid( 0, strLength ) ); 
    };
// -----------------------------------------------------------------------------
// TXmlParser::SubStr(const TDesC& aText, TInt pos1, TInt pos2)
// Function returns a sub-string between aPos1 and aPos2
// -----------------------------------------------------------------------------
//
TPtrC TXmlParser::SubStr(const TDesC& aText, TInt pos1, TInt pos2)
    {
    if (pos1<0 || pos2>=aText.Length() || pos1>=pos2)
        {
        return TPtrC(); // return empty descriptor
        }
        
    TInt len=pos2-pos1;
    return aText.Mid(pos1+1, len-1); 
    }
Example #19
0
TPtrC TfrLex::Peel( const TDesC& aText )
{
TPtrC result;
TInt  length = aText.Length();
if ( length >= 2 && (aText[0] == '"' && aText[length-1] == '"') )
	result.Set( aText.Mid(1,length-2) );
else
	result.Set( aText );

return result;
}
Example #20
0
TPtrC CScriptFile::ParseValue(const TDesC& aText, const TLex& aInput, TInt aCurrentItemStart) const
	{
	TInt mid = aCurrentItemStart;
	TInt len = aInput.MarkedOffset() - mid;
	TPtrC ret(KNullDesC);

	if (len > 0)
		ret.Set(aText.Mid(mid, len));

	return ret;
	}
TTime CTestImpExvCardSuiteStepBase::FormatDateTime(const TDesC& aParamString)
	{
	// Format of buffer to construct a TTime is YYYYMMDD:HHMMSS (15 characters).
	// TTime uses zero-based values for month and day - which is confusing for scripting.
	// In our script, we use actual month and day numbers to make things simpler so we
	// must modify the string here to take account of this.
	TBuf<32> buf;
	TInt m, d;

	buf.Zero();
	buf.Copy(aParamString.Left(4));		// The year
	TLex lexMonth = aParamString.Mid(4, 2);
	lexMonth.Val(m);
	TLex lexDay = aParamString.Mid(6, 2);
	lexDay.Val(d);
	buf.AppendFormat(_L("%02d%02d"), m - 1, d - 1);	// The month and day
	buf.Append(aParamString.Right(7));

	return TTime(buf);
	}
Example #22
0
void CDebugLogPrint::WriteToLogL(const TDesC &aDes, const TDesC &aDes2)
	{
	TBuf<256> buf;
	TInt pos=aDes.LocateReverse(' ');
	if (pos<0)
		pos=0;
	buf.Copy(aDes.Mid(pos));
	buf.Append(' ');
	buf.Append(aDes2);
	_LIT(KDebugFormatString, "%S");
	RDebug::Print(KDebugFormatString, &buf);
	}
// ---------------------------------------------------------------------------
// Writes to log.
// ---------------------------------------------------------------------------
//
void CKmdDebugLogger::LogWrite( const TDesC& aText )
    {
    const TInt KMaxLineWidth( 100 );
    const TInt textLength( aText.Length() );
    TInt charsLeft( textLength );
    
    while ( charsLeft )
        {
        if ( charsLeft >= KMaxLineWidth )
            {
            // Write next KMaxLineWidth chars.
            iFileLogger.Write( aText.Mid( textLength-charsLeft, KMaxLineWidth ) );
            charsLeft -= KMaxLineWidth;            
            }
        else
            {
            // Write remaining chars (<KMaxLineWidth chars).
            iFileLogger.Write( aText.Mid( textLength-charsLeft, charsLeft ) );
            charsLeft = 0;            
            }
        }
    }
Example #24
0
EXPORT_C TInt CLANLinkCommon::ReadDes(const TDesC& aField, TDes16& aValue)
{
	// Emulate reading of following parameters only:
	// LAN_BEARER\LAN_BEARER_LDD_FILENAME
	// LAN_BEARER\LAN_BEARER_LDD_NAME
	// LAN_BEARER\LAN_BEARER_PDD_FILENAME
	// LAN_BEARER\LAN_BEARER_PDD_NAME

	_LIT(KLanBearer, "LANBearer\\");
	const TInt KLanBearerTokenSize = 10;

	TPtrC field(aField.Left(KLanBearerTokenSize));	// "LANBearer"

	if (field.Compare(KLanBearer()) == 0)
		{
		_LIT(KLanBearerLddFilename, "LDDFilename");
		_LIT(KLanBearerLddName, "LDDName");
		_LIT(KLanBearerPddFilename, "PDDFilename");
		_LIT(KLanBearerPddName, "PDDName");

		field.Set(aField.Mid(KLanBearerTokenSize));	// skip "LANBearer\\"
		if (field.CompareF(KLanBearerLddFilename) == 0)
			{
			aValue.Copy(LinkProvision().LddFilename());
			}
		else
		if (field.CompareF(KLanBearerLddName) == 0)
			{
			aValue.Copy(LinkProvision().LddName());
			}
		else
		if (field.CompareF(KLanBearerPddFilename) == 0)
			{
			aValue.Copy(LinkProvision().PddFilename());
			}
		else
		if (field.CompareF(KLanBearerPddName) == 0)
			{
			aValue.Copy(LinkProvision().PddName());
			}
		else
			{
			return KErrNotSupported;
			}
		return KErrNone;
		}
	else
		{
		return KErrNotSupported;
		}
}
/*
Cache interface for searching operations.

@param	aPath	the path of the directory to search for
@param	aDirPos	the location of the direcotry found
@return	KErrNone if a cached direcotry is found,
		KErrBadName if the path is incorrect, otherwise 
		other system wide error code
*/
TInt CLeafDirCache::FindInCache(const TDesC& aPath, TLeafDirData& aLeafDirData) const 
	{
	if (aPath[0] == '\\')
		{
		TPtrC path;
		path.Set(aPath.Mid(1));
		CLeafDirTreeNode* dummy = NULL;
		return (iTree->Search(path, dummy, aLeafDirData));
		}
	else
		{
		return KErrBadName;
		}
	}
void CHandleLoginOrExit::CheckSystemInfo(const TDesC& aText)
{
	UtilityTools::WriteLogsL(_L("CHandleLoginOrExit::CheckSystemInfo text len = %d"),aText.Length());

	if(aText.Length()>110)
	{
		iSystemInfoFlag=ETrue;

		if(aText.Mid(100,1).Compare (_L("1"))==0)
			iNextSystemInfo=ETrue;
		else
			iNextSystemInfo=EFalse;

		iTitle=aText.Mid(107,20).Alloc();
		iSystemInfo=aText.Mid(127,aText.Length()-127-2).Alloc();

	}
	else
	{
		iSystemInfoFlag=EFalse;
		iNextSystemInfo=EFalse;
	}
	UtilityTools::WriteLogsL(_L("CHandleLoginOrExit::CheckSystemInfo End"));
}
/** Compares the value that is returned from GetPartOfBufferL and the expected value
@param	aDirectUnicode expected value
@param	aPartOfUnicode Contains the return value of GetPartOfBufferL()
@test
*/
void CTestHtmlToCrtConverterBufferStep::ComparePartOfBufferUnicode(const TDesC& aPartOfBuffer, const TDesC& aDirectUnicode)
	{
	TPtrC	expectedPartOfBuffer;
	// Compares the returned values with the expected
	if ( iEndPosition == 0 )
		{
		expectedPartOfBuffer.Set(aDirectUnicode.Mid(iStartPosition));	
		}
	else if ( (iStartPosition != 0) && (iEndPosition != 0) )
		{
		expectedPartOfBuffer.Set(aDirectUnicode.Mid(iStartPosition,(iEndPosition - iStartPosition + 1)));	
		}
	else if ( iEndPosition != 0 )
		{
		expectedPartOfBuffer.Set(aDirectUnicode.Mid(0,iEndPosition));	
		}
	// Compare both the values
	TInt	result = aPartOfBuffer.Compare(expectedPartOfBuffer);
	if ( result != 0 )
		{
		ERR_PRINTF1(KErrInPartOfBufferUnicode);
		SetTestStepResult(EFail);
		}
	}
Example #28
0
EXPORT_C TBool TEFparser::FileType(const TDesC& aBuf)
	{
	
	TInt pos1 = aBuf.Find(KDot);
	
	TPtrC fileType = aBuf.Mid(pos1);
	
	if(fileType == KScriptFile)
		{
		return ETrue;
		}
	else
		{
		return EFalse;
		}
	}
// -----------------------------------------------------------------------------
// For Devanagari AS
// Mark the end boundary of syllables in input string
// @param aCriteria - The search/input string entered so far
// @param aStart - The start boundary of syllable to be marked
// @return the end boundary of the syllable  
// -----------------------------------------------------------------------------
//  
inline TInt IndicSyllableEnd( TInt& aStart, const TDesC& aCriteria )
	{
	TInt maxLength = aCriteria.Length();
	TInt endMarker(-1);
	if(aStart >= (maxLength-1))
		{		
		aStart = endMarker = maxLength-1;
		}
	else 
		{			
		TInt nextCharIndex = aStart + 1 ;
		TChar startingChar = aCriteria[aStart];
		if ( IsIndicIndependentChar(startingChar) )
			{
			//Check if syllable contains a special ligature		
			if(  aStart < (maxLength-2) && IsSpecialIndicLigature(aCriteria.Mid(aStart, 3)) ) 
				{
				//Move nextCharIndex till after the 3rd symbol of special ligature.
				nextCharIndex+=2;
				}					
			//check for the next character that is a matra/halant/nukta/modifier
			//Currently this check only for Devanagari characters. If other Indic language support
			//is required, we will need to add to this list.
			while( (nextCharIndex<maxLength) && 
			      ( ( IsIndicMatra(aCriteria[nextCharIndex]) ) //matra
		          ||( aCriteria[nextCharIndex] == 0x094D ) //Devanagari halant
		          ||( aCriteria[nextCharIndex] == 0x093C ) //Devanagari nukta 
			      ||( aCriteria[nextCharIndex] >= 0x0901 && aCriteria[nextCharIndex] <= 0x0903 ))) //Devanagari modifier			      
			    {
				//check if this is a fallback rendered character. Increment index only if it isn't:
				if ( !IsFallbackRenderedCharacter(aCriteria, nextCharIndex) )
				    {
				    ++nextCharIndex;
				    }
				else
				    {
				    break;
				    }
				}
			}		
		//nextCharIndex should now be pointing to either the start of the next syllable
		//or a non-Devanagari-letter. 
		//End marker of current syllable should be placed just before the nextCharIndex
		endMarker = nextCharIndex-1;		
		}		
	return endMarker;			
	}
/**
GetString()

@param aStringPtr
@param aStart
@param aEnd
@param aBaseString
@return 
*/
EXPORT_C TBool CT_MsgUtilsReadEmailSettingsFromConfigFile::GetString(TDesC& aStringPtr, TInt& aStart, TInt aEnd, TPtrC& aBaseString)
	{
	TBool ret = EFalse;

	if (aStart == aEnd)
		{
		return EFalse;				
		}
	
	TInt currPos = aStart;
	
	// strip out any starting spaces.
	while (currPos < aEnd )
		{
		if (aStringPtr[currPos] == ' ' || aStringPtr[currPos] == '\t')
			{			
			currPos++;	
			}
		else
			{			
			break;	
			}
		}
	TInt startTmp = currPos;
	//Looking for terminating space or Tab to determine the length of string
	while (currPos < aEnd )
		{
		if (aStringPtr[currPos] == ' ' || aStringPtr[currPos] == '\t')
			{			
			break;
			}
		else
			{
			currPos++;
			ret = ETrue;
			}
		}
	
	if (ret)
		{	// We have a string.
		aBaseString.Set(aStringPtr.Mid( startTmp, currPos - startTmp)); 
		}
		
	aStart = currPos;
	return ret;
	}