Ejemplo n.º 1
0
/*
 * Generates a hash value by reversing the matchLength least significant digits,
 * ignoring non-digits and zeroes at the end of the number.  Returns error if no phone
 * digits are supplied.

 * \param phoneNumberString A descriptor containing a phone number.
 * \param matchLength The number of digits from the right of the phone number to use.
 * \param numPhoneDigits The number of digits found in the phone number string.
 * \param error Qt error code.*
 * \return An integer representation of the phone number string in reverse.
 */
TInt32 CntFilterDetail::TMatch::createHash(
                                    const TDesC& phoneNumberString, 
                                    TInt matchLength, 
                                    TInt& numPhoneDigits)
{
    TInt phoneNumberLength = phoneNumberString.Length();
    TInt startIndex = 0;
    if (phoneNumberLength > matchLength) {
        startIndex = phoneNumberLength - matchLength;
    }
    
    numPhoneDigits = 0;
    TUint reversedDigits = 0;
    TInt mult = 1;
    
    for (TInt chrIndex = startIndex; (numPhoneDigits < matchLength) && (chrIndex < phoneNumberLength); chrIndex++) {
        TChar chr = phoneNumberString[chrIndex];
        if (chr.IsDigit()) {
            reversedDigits += (chr.GetNumericValue()) * mult;
            mult = mult * 10;
            ++numPhoneDigits;
        }
    }
    return reversedDigits ;
}
/**
Generates a hash value by reversing the aMatchLength least significant digits,
ignoring non-digits and zeroes at the end of the number.  Asserts if no phone
digits are supplied.

@param aPhoneNumberString A descriptor containing a phone number.
@param aMatchLength The number of digits from the right of the phone number to use.
@param aNumPhoneDigits The number of digits found in the phone number string.

@return An integer representation of the phone number string in reverse.
*/
TInt32 CPplCommAddrTable::TMatch::CreateHashL(const TDesC& aPhoneNumberString, TInt aMatchLength, TInt& aNumPhoneDigits)
	{
	TInt phoneNumberLength = aPhoneNumberString.Length();
	__ASSERT_DEBUG(phoneNumberLength > 0, User::Leave(KErrNotSupported) );

	TInt startIndex = 0;

	if (phoneNumberLength > aMatchLength)
		{
		startIndex = phoneNumberLength - aMatchLength;
		}

	aNumPhoneDigits = 0;
	TUint reversedDigits = 0;
	TInt mult = 1;

	for (TInt chrIndex = startIndex; (aNumPhoneDigits < aMatchLength) && (chrIndex < phoneNumberLength); chrIndex++)
		{
		TChar chr = aPhoneNumberString[chrIndex];
		if (chr.IsDigit() )
			{
			reversedDigits += (chr.GetNumericValue() ) * mult;
			mult = mult * 10;
			++aNumPhoneDigits;
			}
		}

	return reversedDigits ;
	}
Ejemplo n.º 3
0
void CATBase::ParseBufferLC()
//
//  Parses buffer
//
/**
 * This function is currently not used by the Etel regression test harness.
 */	{
	LOGTEXT(_S8("CATBase Parse the Buffer List"));
	iBuffer.Set(iIo->GetRxBufferLC(iBufferMarker));
	TInt pos=iBuffer.FindF(KOKString);
	if(pos==KErrNotFound)
		{
		LOGTEXT(_S8("CATBase Error - Cannot find OK'"));
		User::Leave(pos);
		}
	//	Place everything before the OK into buffer
	iBuffer.Set(iBuffer.Left(pos));

	TLex8 yyLex(iBuffer);
	TChar peek;
	//	Look for '=' sign and move seeker cursor to the right of it if it exists
	pos=iBuffer.Find(_L8("="));
	if (pos!=KErrNotFound)
		{
		yyLex.Inc(pos+1);
		}
	//	Move cursor past any spaces or open brackets
	yyLex.SkipSpace();
	peek=yyLex.Peek();
	if ((TUint)peek=='(' || (TUint)peek=='[' || (TUint)peek=='{')
		yyLex.Inc();

	yyLex.SkipSpace();
	peek = yyLex.Peek();
	do
		{
		// Search for the next character that is not a comma, and mark it. Keep looking at 
		// subsequent characters until it is a space,comma,closing bracket or end of string.
		// Store the string (between marked character and current character) as an item in
		// an array of CATParamListEntry object pointers.
		if (peek!=',')
			{
			yyLex.Mark();
			do
				{
				yyLex.Inc();
				peek=yyLex.Peek();
				}
			while (peek!=',' && !peek.IsSpace() && peek!=')'&& peek!=']'&& peek!='}' && !yyLex.Eos());
			CATParamListEntry* aParamListEntry = new (ELeave) CATParamListEntry(yyLex.MarkedToken());
			iRxResults.AddLast(*aParamListEntry);
			}
		// Move cursor to the next non-space character, and end the loop if it is a closing
		// bracket or the end of the buffer.
		yyLex.Inc();
		yyLex.SkipSpace();
		peek = yyLex.Peek();
		}
	while (!yyLex.Eos() && peek!=')'&& peek!=']'&& peek!='}');
	}
Ejemplo n.º 4
0
TBool TfrLex::Eat( TLex& aLex, const TChar aChar )
{
TLexMark unget;
if ( aChar.IsSpace() )
	{
	// A space character requires its own logic = go over
	// the other space characters - x gets the next char.
	TChar x;
	aLex.Mark(unget);
	while ( x = aLex.Get(), x.IsSpace() && x != aChar )
		{};
	if ( x == aChar ) 
		return ETrue;
	}
else
	{
	// For other, non-space, characters: skip spaces and
	// get the next character x.
	aLex.SkipSpace();
	aLex.Mark(unget);
	if ( aLex.Get() == aChar ) 
	return ETrue;
	}

// The character wasn't there, unget to the start point.
aLex.UnGetToMark(unget);
return EFalse;
}
Ejemplo n.º 5
0
TBool CTestConfig::IsAtStartOfNewLine(const TDesC8& aSource, const TLex8& aLex, TBool aIgnoreSpaces) const
	{
	TInt offset(aLex.MarkedOffset());
	__ASSERT_ALWAYS(offset != 0, User::Invariant());

	TChar ch = NULL;

	if (aIgnoreSpaces)
		{
		while (offset--)
			{
			ch = aSource[offset];
			if (ch == KScriptLFChar || ch == KScriptCRChar || !ch.IsSpace())
				break;
			}
		}
	else
		ch = aSource[offset-1];

	TBool ret(EFalse);

	if (offset <= 0)
		ret = ETrue;
	else
		ret = (ch == KScriptLFChar || ch == KScriptCRChar);

	return ret;
	}
// ---------------------------------------------------------------------------------
// CUpnpTmFilteredAppList::RemoveWhiteSpace
// Method is used to remove leading and trailing whitespaces from the descriptor's data
// @param aData Descriptor's data from which whitespaces have to be removed
// @return Returns the descriptor having no white spaces
// ---------------------------------------------------------------------------------
//
const TDesC8& CUpnpTmFilteredAppList::RemoveWhiteSpace( TPtrC8& aData )
    {
    OstTraceFunctionEntry0( CUPNPTMFILTEREDAPPLIST_REMOVEWHITESPACE_ENTRY );
    // Removes the leading white spaces
    TInt length = aData.Length();
    TInt i = 0;
    TBool done = EFalse;
    while( !done && i < length )
        {
        TChar current = aData[i];
        done  = !current.IsSpace();
        if( !done )
        ++i;
        }
    aData.Set(aData.Mid(i)); /* aData now does not have any white space character 
                                ahead of its actual data */
    
    // Removes the trailing white spaces
    length = aData.Length();
    i = 0;
    done = EFalse;
    while( !done && i < length )
        {
        TChar current = aData[(length-1) - i];
        done  = !current.IsSpace();
        if( !done )
        ++i;
        }
    aData.Set(aData.Left(aData.Length() - i)); /* aData now does not have any white space character
                                                following the actual data */
    OstTraceFunctionExit0( CUPNPTMFILTEREDAPPLIST_REMOVEWHITESPACE_EXIT );
    return aData;
    }
Ejemplo n.º 7
0
void CDTSYLogger::WriteFormat(TRefByValue<const TDesC8> aFmt,...)
	{
	TBuf8<KGenericBufferSize> buf;
    VA_LIST list;
    VA_START(list,aFmt);
    buf.FormatList(aFmt,list);
	TChar tmpchar;
	for(TInt i=0;i<buf.Length();i++)
		{
		tmpchar=buf[i];
		if(!((tmpchar.IsPrint()) || (tmpchar=='\n') || (tmpchar=='\r') || (tmpchar=='\t')))
			buf[i]='.';
		}
#ifdef __EXE__
	CDTSYLogger* context=aScriptLoggerContext;
#else
	CDTSYLogger* context=(CDTSYLogger*) Dll::Tls();
#endif
	if(context==NULL)
		{
		TRAPD(ret,context=CDTSYLogger::NewL());
		if (ret==KErrNone)
			{	
#ifdef __EXE__
			aScriptLoggerContext=context;
#else
			Dll::SetTls(context);
#endif
			}
		else return;
		}
	if(context->iValid)
		context->WriteRecord(buf);
	}
Ejemplo n.º 8
0
void CntFilterDetail::TMatch::stripOutNonDigitChars(TDes& text)
{
    for (TInt chrPos = 0; chrPos < text.Length(); ++chrPos) {
        TChar chr = text[chrPos];
        if (!chr.IsDigit()) {
            text.Delete(chrPos, 1);
            --chrPos;
        }
    }
}
/**
Strip out any non-digit characters before we convert the phone number to an
integer.

@param aText Phone number which on return will have any non-digit characters
removed.
*/
void CPplCommAddrTable::TMatch::StripOutNonDigitChars(TDes& aText)
	{
	for(TInt chrPos = 0; chrPos < aText.Length(); ++chrPos)
		{
		TChar chr = aText[chrPos];
		if (!chr.IsDigit() )
			{
			aText.Delete(chrPos, 1);
			--chrPos;
			}
		}
	}
Ejemplo n.º 10
0
/**
Initialize the counter with the numeric equivalent of the descriptor contents
This function is here to demonstrate reading from the client address space.
Note that in this example, the client and the server are part of the same process,
*/
void CCountServSession::SetFromStringL(const RMessage2& aMessage)
	{
	
	  // length of passed descriptor (1st parameter passed from client)
	TInt deslen = aMessage.GetDesLength(0);
	
	  // Passed data will be saved in this descriptor.
    RBuf buffer;
      
      // Max length set to the value of "deslen", but current length is zero
    buffer.CreateL(deslen);
      
      // Do the right cleanup if anything subsequently goes wrong
    buffer.CleanupClosePushL();
    
      // Copy the client's descriptor data into our buffer.
    aMessage.ReadL(0,buffer,0);
    
      // Now do a validation to make sure that the string only has digits
    if (buffer.Length() == 0)
        {
    	User::Leave(ENonNumericString);
        }
    
    TLex16 lexer;
    
    lexer.Assign(buffer);
    while (!lexer.Eos())
        {
        TChar thechar;
        
        thechar = lexer.Peek();
        if (!thechar.IsDigit())
            {
        	User::Leave(ENonNumericString);
            }
        lexer.Inc();
        }
       
      // Convert to a simple TInt value. 
    lexer.Assign(buffer);           
    if (lexer.Val(iCount))
        {
    	User::Leave(ENonNumericString);
        }
    	
	  // Clean up the memory acquired by the RBuf variable "buffer"
	CleanupStack::PopAndDestroy();
	}
Ejemplo n.º 11
0
// -----------------------------------------------------------------------------
// 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 );   
        }
   	}
// -----------------------------------------------------------------------------
// TSTSCharacterSetConverter::IsPrintable
// checks if the given character is allowed in PrintableString
// -----------------------------------------------------------------------------
//
TBool TSTSCharacterSetConverter::IsPrintable(
    const TChar& aValue) const
{
    if (aValue > 128)  // non-ascii characters are not allowed
    {
        return EFalse;
    }
    if (aValue.IsAlphaDigit())  // A-Z,a-z,0-9 are allowed
    {
        return ETrue;
    }
    switch (aValue)  // some other characters are also allowed
    {
    case(' '):
    case('\''):
    case('('):
    case(')'):
    case('+'):
    case(','):
    case('-'):
    case('.'):
    case('/'):
    case(':'):
    case('='):
    case('?'):
    {
        return ETrue;
    }
    default:
    {
        return EFalse;
    }
    }
}
Ejemplo n.º 13
0
TBool CATDtmfVts::CharIsDtmf(const TChar& aDtmfChar)
	{
	LOGTEXT(_L8("[Ltsy CallControl]  Starting CATDtmfVts::IsDtmf()"));
	
	TUint uC = aDtmfChar.GetUpperCase();
	
	switch(uC)
		{
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
		case 'A':
		case 'B':
		case 'C':
		case 'D':
		case '*':
		case '#':
			return ETrue;
		}
	return EFalse;
	}
// -----------------------------------------------------------------------------
// CSTSCredentialManager::CheckOIDL
// Checks if given OID is formatted correctly
// -----------------------------------------------------------------------------
void CSTSCredentialManager::CheckOIDL(const TDesC& aOID)
{
    TInt oidLength = aOID.Length();
    if (oidLength == 0)
    {
        // empty oid is illegal
        User::Leave(KErrArgument);
    }
    for (TInt i = 0; i < oidLength; i++)
    {
        TChar oidChar = aOID[ i ];
        if (!oidChar.IsAlphaDigit())
        {
            if ((oidChar != KSTSDot) && (oidChar != KSTSLine))
            {
                User::Leave(KErrArgument);
            }
        }
    }
}
Ejemplo n.º 15
0
void CActiveConsole::ProcessKeyPressL(TChar aChar)
	{
	if (aChar == EKeyEscape)
		{
		PRINT(_L("CActiveConsole: ESC key pressed -> stopping active scheduler...\n"));
		gAbort = ETrue;
		CActiveScheduler::Stop();
		return;
		}
	aChar.UpperCase();
	GetCharacter();
	}
Ejemplo n.º 16
0
// -----------------------------------------------------------------------------
// TMSAudioDtmfTonePlayer::Normalize
// Lowers case for chars and if its '*','+', or 'w' sets it to asterisk
// char ('*').
// -----------------------------------------------------------------------------
//
void TMSAudioDtmfTonePlayer::Normalize(TChar& tone)
    {
    TRACE_PRN_FN_ENT;
    tone.LowerCase();
    TPtrC ast(KPhoneTone_Asterisk);

    if (ast.Locate(tone) != KErrNotFound)
        {
        tone = ast[0];
        }
    TRACE_PRN_FN_EXT;
    }
Ejemplo n.º 17
0
// -----------------------------------------------------------------------------
// SdpUtil::IsTokenChar
// Checks if the character is a valid token character
// -----------------------------------------------------------------------------
//
TBool SdpUtil::IsTokenChar( 
    TChar aChar )
	{
    return ( ( aChar == '!')||
	         ( aChar >= '#' && aChar <= '\'' ) ||
	         ( aChar == '*' || aChar == '+' ) ||
	         ( aChar == '-' || aChar == '.' ) ||
	         ( aChar.IsDigit() ) ||
	         ( aChar >= 'a' && aChar <= 'z' ) ||
	         ( aChar >= 'A' && aChar <= 'Z' ) ||
	         ( aChar >= '^' && aChar <= '~' ) );	
	}
Ejemplo n.º 18
0
/**
 * Update next characters if find pane state was changed.
 *
 * @since 5.0
 * @param aNextChars reference to the next characters for the adaptive search grid
 * @param aCh Criteria from the search field.    
 */
inline void UpdateNextCharsL( HBufC*& aNextChars, TChar aCh )
    {
        TChar ch_temp = aCh;          
    
    TLanguage lang = User::Language();  
    if ( lang == ELangVietnamese )
	   {
	   aCh = ReplaceVietnameseChar ( ch_temp );
	   }
    
    if( ( aNextChars->Locate(aCh.GetLowerCase() ) == KErrNotFound ) &&
        ( aNextChars->Locate(aCh.GetUpperCase() ) == KErrNotFound ) )
        {               
        if( aNextChars->Des().Length() == aNextChars->Des().MaxLength() )
            {
            aNextChars = aNextChars->ReAllocL( aNextChars->Des().MaxLength()+10 );
            TInt length1 = aNextChars->Des().Length();
            TInt maxlength1 = aNextChars->Des().MaxLength();
            }       
        aNextChars->Des().Append( aCh );            
        }
    }
Ejemplo n.º 19
0
// ==========================================================================
// METHOD:  WriteLineL
//
// DESIGN:  Prepend date/time, truncate, and convert unprintable characters to '.'.
// ==========================================================================
void CLogFileHandler::WriteLineL( const TDesC8& aSrc )
	{	
    TInt i = iOutputBuffer.Length();
    
	iOutputBuffer.Append( aSrc );
	                  
	TChar ch;
	while( i < iOutputBuffer.Length() )
		{
		ch=iOutputBuffer[i];
		if(!((ch.IsPrint()) || (ch==KTabChar8)))
		    {		    
			iOutputBuffer[i]=KFullStopChar8;
		    } // end if
        i++;		    
		} // end for
		
	iOutputBuffer.Append( KEndOfLineCharacters8 );
	
	iFile.Write( KMaxTInt, iOutputBuffer );
	
	} // END WriteLineL
/**
This routine is used to convert between European digits and 
Arabic-Indic, Eastern Arabic-Indic, Devanagari or Thai digits 
based on existing digit type setting. 

@param aDes  Parameter to change
*/
void CResourceLoader::LanguageSpecificNumberConverter::Convert( TDes &aDes )
    {   
    TLocale locale;
    locale.Refresh();
    const TDigitType digitType = locale.DigitType();
    TChar toArea = 0x030;
    switch( digitType )
        {
        case EDigitTypeWestern:
        case EDigitTypeArabicIndic:
        case EDigitTypeEasternArabicIndic:
        case EDigitTypeDevanagari:
        case EDigitTypeThai:
            toArea = digitType;
            break;
        case EDigitTypeUnknown:
        case EDigitTypeAllTypes:
            return;
        }
    
    const TInt length = aDes.Length();
    for( TInt i = 0; i < length; i++ )
        {
        TChar character = aDes[i];
        TChar fromArea = NumberToBase( character );
        TChar::TBdCategory cat = character.GetBdCategory();
        switch( cat )
            {
            case TChar::EArabicNumber:
            case TChar::EEuropeanNumber:
                character += toArea;
                character -= fromArea;
                aDes[i] = TUint16( character );
                break;
            default: 
                break;
            }
        }
    }
/**
This routine is used to convert Arabic-Indic, Eastern Arabic-Indic
or Devanagari digits to European digits. 

@param aDes Parameter to change
*/
void CResourceLoader::LanguageSpecificNumberConverter::ConvertToWesternNumbers( TDes &aDes )
    {   
    const TChar toArea = 0x030;
    const TInt KLastDevanagariDigit = 0x96F;
    const TInt KFirstDevanagariDigit = 0x966;
    const TInt length = aDes.Length();

    for( TInt i=0; i<length; i++ )
        {
        TChar character = aDes[i];
        TChar fromArea = NumberToBase( character );
        TChar::TBdCategory cat = character.GetBdCategory();

        if ( cat == TChar::EArabicNumber || cat == TChar::EEuropeanNumber ||
           ( KFirstDevanagariDigit <= character && character <= KLastDevanagariDigit ) )
            {
            character += toArea;
            character -= fromArea;
            aDes[i] = TUint16( character );    
            }        
        }
    }
Ejemplo n.º 22
0
// -----------------------------------------------------------------------------
// For Vietnamese AS
// 
// -----------------------------------------------------------------------------
//
inline TChar ReplaceVietnameseChar( const TChar aCh )   
    {
    TChar Char = aCh.GetUpperCase();
    if ( (Char >= 0x00C0 && Char <= 0x00C3) || Char == 0x102  ||
         ((Char >= 0x1EA0 && Char <= 0x1EB6) && Char%2 == 0) )  
        {
        Char = 0x0041; // A
        return Char; 
        }        
    if ( (Char >= 0x00C8 && Char <= 0x00CA) || 
        ((Char >= 0x1EB8 && Char <= 0x1EC6) && Char%2 == 0) )
        {
        Char = 0x0045; // E
        return Char; 
        }               
    if ( Char == 0x00CC || Char == 0x00CD || Char == 0x0128 || 
         Char == 0x1EC8 || Char == 0x1ECA  )
        {
        Char = 0x0049; // I
        return Char; 
        }    
    if ( (Char >= 0x00D2 && Char <= 0x00D5 ) || Char == 0x1ECE || Char == 0x1ECC ||
        ((Char >= 0x1ED0 && Char <= 0x1ED8) && Char%2 == 0)) 
        {
        Char = 0x004F; // O
        return Char; 
        }            
    if ( Char == 0x1EDA || Char == 0x1EDC || Char == 0x1EDE || 
         Char == 0x1EE0 || Char == 0x1EE2  )
        {
        Char = 0x01A0; // O-horn
        return Char; 
        }          
    if ( Char == 0x00DA || Char == 0x00D9 || Char == 0x0168 || 
         Char == 0x1EE4 || Char == 0x1EE6  )
        {
        Char = 0x0055; // U
        return Char; 
        }         
     if ( (Char >= 0x1EE8 && Char <= 0x1EF0) && Char%2 == 0 )
        {
        Char = 0x01AF; // U-horn        
        return Char; 
        }         
     if ( ((Char >= 0x1EF2 && Char <= 0x1EF8) && Char%2 == 0) || Char == 0x00DD ) 
        {
        Char = 0x0059; // Y
        return Char; 
        }              
    return Char;
    } 
Ejemplo n.º 23
0
// ==========================================================================
// METHOD:  WriteLineL
//
// DESIGN:  
// ==========================================================================
void CLogFileHandler::WriteLineL( const TDesC16& aSrc )
	{
    // Converting from Unicode to Utf8 is overkill for debug logging.  Instead, just use the
    // check-and-dirty Append function, which converts multi-byte characters to char 1.
	// CnvUtfConverter::ConvertFromUnicodeToUtf8( iOutputBuffer, aSrc );
	
	iOutputBuffer.Append( aSrc );
	
	TChar ch;
	for( TInt i=0; i < iOutputBuffer.Length(); i++ )
		{
		ch=iOutputBuffer[i];
		if(!((ch.IsPrint()) || (ch==KTabChar8)))
		    {		    
			iOutputBuffer[i]=KFullStopChar8;
		    } // end if
		} // end for
		
	iOutputBuffer.Append( KEndOfLineCharacters8 );
	
	iFile.Write( KMaxTInt, iOutputBuffer );
	
	} // END WriteLineL
// ---------------------------------------------------------------------------
// CMceIceErrorTrigger::ParseErrorCode
// ---------------------------------------------------------------------------
//
TInt CMceIceErrorTrigger::ParseErrorCode() const
	{
	TInt errorCode( 0 );
	TLex8 lex( Value() );

	TChar ch = lex.Peek();
	while ( !ch.IsDigit() && ch != '-' && !ch.Eos() )
		{
		lex.Get();
		ch = lex.Peek();
		}

	if ( ch.Eos() )
		{
		errorCode = KErrNotFound;
		}
	else
		{
		lex.Val( errorCode );
		}
	RDebug::Print( _L("ICEPlugin Dummy: ParseErrorCode=%d" ), errorCode );
	return errorCode;
	}
Ejemplo n.º 25
0
TUint TInputManager::GetCipher(TChar aChar)
	{
	TUint value;
	switch(aChar)
		{
		case 'a': value = 10; break;
		case 'b': value = 11; break;
		case 'c': value = 12; break;
		case 'd': value = 13; break;
		case 'e': value = 14; break;
		case 'f': value = 15; break;
		default: value = aChar.GetNumericValue(); 
		}
	return value;
	}
Vector<String> PluginDatabase::defaultPluginDirectories()
{
    Vector<String> directories;
    //find the installation drive
    TDriveList drivelist;
    TChar driveLetter;
    RFs fsSession;
    
    if (fsSession.Connect() == KErrNone && fsSession.DriveList(drivelist) == KErrNone) {
        for (TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++) {
            if (drivelist[driveNumber] && fsSession.DriveToChar(driveNumber, driveLetter) == KErrNone) {
                QString driveStringValue(QChar((uint)driveLetter.GetUpperCase()));
                QString stubDirPath;
                stubDirPath.append(driveStringValue);
                stubDirPath.append(QT_PLUGIN_FOLDER);
                if (QFileInfo(stubDirPath).exists())
                    directories.append(stubDirPath);
            }
        }
    }

    fsSession.Close();
    return directories;
}
Ejemplo n.º 27
0
TBool ScrShotsGenUtils::DriveExists(TChar aDriveChar)
{
    SLOGF(_L("ScrShotsGenUtils::DriveExists <<"));
    RFs fs;
    TDriveList dList;
    TBool drvExists = EFalse;
    if(fs.Connect() == KErrNone){
        fs.DriveList(dList);
        aDriveChar.UpperCase();
        unsigned int intval = aDriveChar.operator unsigned int(); 
        if(dList[intval - 65]){
            SLOGF(_L("Drive found"));
            drvExists = ETrue;
        }
        fs.Close();
    }
    SLOGF(_L("ScrShotsGenUtils::DriveExists >>"));
    return drvExists;
}
Ejemplo n.º 28
0
void CTestDtmfObserver::HandleDTMFEvent( const MCCEDtmfObserver::TCCEDtmfEvent aEvent, 
        	                             const TInt aError,
                                         const TChar aTone )
	{
	TEvent newEvent;
	
	newEvent.iCallID = 0; // not a call specific event
	newEvent.iEventType = CEventStorage::EDtmfEvent;
	newEvent.iEventID = aEvent;
	newEvent.iParam1 = aError;
	newEvent.iParam2 = aTone.GetNumericValue();
	
	// If TChar is empty, set param2 to zero
	if ( newEvent.iParam2 == KErrNotFound )
		{
		newEvent.iParam2 = 0;
		}
			
	iEventStorage->StoreEvent( newEvent );
	}
Ejemplo n.º 29
0
TPtrC TfrLex::GetL( TLex& aLex, const TChar  aChar )
{
// Skip spaces and mark the token's start point.
aLex.SkipSpace();
TLexMark mark;

aLex.Mark(mark);    

if (aLex.Peek() == '"' )
	{
	// Skip the " and do find next " followed by eos, space or aChar.
	aLex.Inc();
	TChar x;
	while ( x = aLex.Get(), !x.Eos() )
		{
		if ( x == '"' )
			{
			// Found a " character - but is it the end of the token?
			x = aLex.Peek(); // peek the next character
			if ( x.Eos() || x.IsSpace() || x == aChar )
				// End of token: return token.
				return aLex.MarkedToken(mark);
			}
		}
	// Unget and L E A V E because did not find the end " of token.
	aLex.UnGetToMark(mark);
	User::Leave(KErrArgument);
	return aLex.MarkedToken(mark); // never reached (l e a v e).
	}
else
	{
	// Is not a "*" token: find eos or the next space or the aChar
	// and return the token.
	TChar x;
	while ( x = aLex.Peek(), !x.Eos() && !x.IsSpace() && x != aChar )
		aLex.Inc();

	return aLex.MarkedToken(mark);
	}
}
Ejemplo n.º 30
0
void CMessageKeyProcessor::ProcessKeyPress(TChar aChar)
	{

	TInt error = KErrNone;

    aChar.UpperCase();
	switch(aChar)
		{
		case 'Q':
		case EKeyEscape:
			{
			TInt err = KErrNone;
			for(TInt j=0; j<KMaxDrives; j++)
				{
				err = RestoreMount(j);

				if (err)
					{
					// Mount is busy/locked and can not be restored.
					break;
					}

				}

			if (err == KErrNone)
				{
				CActiveScheduler::Stop();
				return;
				}

			}
			break;

#if defined(_DEBUG)
		case 'T':
			iTraceEnable = !iTraceEnable;
			if (iTraceEnable)	// 0x44008401
				User::SetDebugMask(KHARDWARE|KDLL|KSCRATCH|KPOWER|KMEMTRACE);
			else
				User::SetDebugMask(0);
			break;
#endif

		case 'D':
			if(++selectedDriveIndex >= PropertyHandlers::allDrivesStatus.Length()/2)
				{
				selectedDriveIndex = 0;
				}
			ShowDriveSelection();
			break;

		case 'M':
			if(PropertyHandlers::allDrivesStatus.Length())
				{
				MountMsFs(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2]);
				}
			break;

		case 'U':
			if(PropertyHandlers::allDrivesStatus.Length())
				{
				RestoreMount(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2]);
				}
			break;

		case 'L':
			{
			// lock unprotected drive
			TMediaPassword password;
			MakePassword(password);

			_LIT(KEmpty, "");
			TMediaPassword nul;
			nul.Copy(KEmpty);
			error = fs.LockDrive(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2],
                                 nul, password, ETrue);
			console->SetPos(0,9);
			LogPrint(_L("LockDrive %S (%d)"), (error?&KError:&KOk), error);
			break;
			}

		case 'I':
            {
            // lock password protected drive
            TMediaPassword password;
            MakePassword(password);
            error = fs.LockDrive(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2],
                                 password, password, ETrue);
            console->SetPos(0,9);
            LogPrint(_L("LockDrive %S (%d)"), (error?&KError:&KOk), error);
            break;
            }

        case 'N':
            {
            TMediaPassword password;
            MakePassword(password);
            error = fs.UnlockDrive(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2],
                                   password, ETrue);
            Clear(9);
            LogPrint(_L("UnlockDrive %S (%d)"), (error?&KError:&KOk), error);
            }
			break;

        case 'C':
            {
            TMediaPassword password;
            MakePassword(password);
            error = fs.ClearPassword(PropertyHandlers::allDrivesStatus[selectedDriveIndex*2],
                                     password);
            Clear(9);
            LogPrint(_L("ClearPassword %S (%d)"), (error?&KError:&KOk), error);
            }
			break;
		default:
			break;
		}
	RequestCharacter();
	}