phoneengine/PhoneCntFinder/src/CPhoneCntNumberParser.cpp
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2004 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:  This class loads contact model phone number parser DLL.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INCLUDES
       
    20 #include "CPhoneCntNumberParser.h"
       
    21 #include <cntdb.h>
       
    22 #include <ecom.h>
       
    23 
       
    24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    25 #include <cntphonenumparser.h>
       
    26 #endif
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CCntNumberParser::NewL
       
    32 // Two-phased constructor.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CCntNumberParser* CCntNumberParser::NewL()
       
    36     {
       
    37     CCntNumberParser* self = new (ELeave) CCntNumberParser();
       
    38     CleanupStack::PushL( self );
       
    39     self->ConstructL();
       
    40     CleanupStack::Pop();
       
    41     return self;
       
    42     }
       
    43 
       
    44 // Destructor
       
    45 CCntNumberParser::~CCntNumberParser()
       
    46     {
       
    47     delete iParser;
       
    48     REComSession::FinalClose();
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CCntNumberParser::CCntNumberParser
       
    53 // C++ constructor can NOT contain any code, that
       
    54 // might leave.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 CContactPhoneNumberParser* 
       
    58     CCntNumberParser::CntPhoneNumberParser() const
       
    59     {
       
    60     return iParser;
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CCntNumberParser::ConstructL
       
    65 // Symbian 2nd phase constructor can leave.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void CCntNumberParser::ConstructL()
       
    69     {
       
    70     RImplInfoPtrArray   implInfoArray;
       
    71     CleanupResetAndDestroyPushL( implInfoArray );
       
    72     REComSession::ListImplementationsL( KUidEcomCntPhoneNumberParserInterface, 
       
    73                                         implInfoArray );
       
    74     // Load the first implementation found for KUidEcomCntPhoneNumberParserInterface 
       
    75     const TInt count = implInfoArray.Count();
       
    76     __ASSERT_ALWAYS( count > 0, User::Leave( KErrNotFound ) );
       
    77     const TUid firstImplementationFound = implInfoArray[0]->ImplementationUid();
       
    78     iParser = reinterpret_cast<CContactPhoneNumberParser*> 
       
    79         ( CContactEcomPhoneNumberParser::NewL( firstImplementationFound ) );
       
    80     CleanupStack::PopAndDestroy( &implInfoArray );
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CCntNumberParser::CCntNumberParser
       
    85 // C++ constructor can NOT contain any code, that
       
    86 // might leave.
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 CCntNumberParser::CCntNumberParser() 
       
    90     {
       
    91     }
       
    92 
       
    93 // End of file