phoneengine/callhandling/src/tpematcher.cpp
changeset 1 838b0a10d15b
equal deleted inserted replaced
0:5f000ab63145 1:838b0a10d15b
       
     1 /*
       
     2 * Copyright (c) 2010 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 
       
    18 #include "tpematcher.h"
       
    19 
       
    20 
       
    21 // ======== MEMBER FUNCTIONS ========
       
    22 
       
    23 // ---------------------------------------------------------------------------
       
    24 // Constructor
       
    25 // ---------------------------------------------------------------------------
       
    26 //
       
    27 TPEMatcher::TPEMatcher()
       
    28     {
       
    29     }
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 // Destructor
       
    33 // ---------------------------------------------------------------------------
       
    34 //    
       
    35 TPEMatcher::~TPEMatcher()
       
    36     {
       
    37     
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // Finds if the two numbers match.
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 TBool TPEMatcher::numbersMatch( const TDesC& aNumber1, const TDesC& aNumber2, TInt aCount )
       
    45     {
       
    46     TBool returnVal( EFalse );    
       
    47     TInt matchDigits(aCount); 
       
    48     
       
    49     matchDigits = Min( matchDigits, aNumber1.Length() );
       
    50     matchDigits = Min( matchDigits, aNumber2.Length() );
       
    51     
       
    52     TPtrC16 number1Ptr = aNumber1.Right(matchDigits);
       
    53     TPtrC16 number2Ptr = aNumber2.Right(matchDigits);
       
    54     
       
    55     if ( number1Ptr.Match( number2Ptr ) != KErrNotFound )
       
    56         {
       
    57         returnVal = ETrue;
       
    58         }
       
    59     
       
    60     return returnVal;
       
    61     }