textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmicfnomatchesinline.cpp
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #include "peninputlayoutmicfnomatchesinline.h"
       
    18 
       
    19 _LIT(KTextForUnknownPredictiveTextWestern, "?");
       
    20 _LIT(KTextForUnknownPredictiveTextArabic, "\x061f");   // Arabic Question Mark
       
    21 #define ARABIC_CODE_PAGE_BASE   0x0600
       
    22 
       
    23 TPtrC TFepLayoutMIcfNoMatchesInline::TextForUnknownPredictiveTextIndication(
       
    24                                                     const TDesC& aTextSample)
       
    25     {
       
    26     TUint codebase = CodeBaseOfText(aTextSample);
       
    27 
       
    28     if (codebase == ARABIC_CODE_PAGE_BASE)
       
    29         return KTextForUnknownPredictiveTextArabic(); //unknownTextBuffer;
       
    30     else
       
    31         return KTextForUnknownPredictiveTextWestern(); //unknownTextBuffer;
       
    32     }
       
    33 
       
    34 TUint TFepLayoutMIcfNoMatchesInline::CodeBaseOfText(const TDesC& aTextSample)
       
    35     {
       
    36     TUint base = 0;
       
    37 
       
    38     // examine buffer; take first printable character
       
    39     // if none found, then 0 is returned
       
    40     TChar character;
       
    41     for (TInt index = 0;index < aTextSample.Length(); index++)
       
    42 	    {
       
    43         character = aTextSample[index];
       
    44         if ( character.IsPrint())
       
    45             {
       
    46             TUint ch(character); 
       
    47             ch &= 0xffffff00; // only interested in upper bits
       
    48             base = (TUint)ch;
       
    49             break;
       
    50             }
       
    51 	    }
       
    52 
       
    53     return base;
       
    54     }
       
    55     
       
    56 // End Of File