phoneengine/PhoneCntFinder/inc/CPhoneCntNumberParser.h
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2004-2006 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 #ifndef CCntNumberParser_H
       
    20 #define CCntNumberParser_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CContactPhoneNumberParser;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32  * Template classes to call ResetAndDestroy on array classes
       
    33  * automatically, when ::PopAndDestroy'ing from the cleanup stack.
       
    34  */
       
    35 template <class T>
       
    36 class CleanupResetAndDestroy
       
    37     {
       
    38 public:
       
    39     inline static void PushL(T& aRef);
       
    40 private:
       
    41     static void ResetAndDestroy(TAny *aPtr);
       
    42     };
       
    43 template <class T>
       
    44 inline void CleanupResetAndDestroyL(T& aRef);
       
    45 
       
    46 // Template class CleanupClose
       
    47 template <class T>
       
    48 inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
       
    49     {CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &aRef));}
       
    50 template <class T>
       
    51 void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
       
    52     {static_cast<T*>(aPtr)->ResetAndDestroy();}
       
    53 template <class T>
       
    54 inline void CleanupResetAndDestroyPushL(T& aRef)
       
    55     {CleanupResetAndDestroy<T>::PushL(aRef);}
       
    56 
       
    57 
       
    58 /**
       
    59 *  CCntNumberParser
       
    60 *
       
    61 *  This class loads contact model phone number parser DLL.
       
    62 *
       
    63 *  @lib PhoneCntFinder
       
    64 *  @since 2.8
       
    65 */
       
    66 NONSHARABLE_CLASS( CCntNumberParser ) : public CBase
       
    67     {
       
    68     public: // Constructor
       
    69 
       
    70         /**
       
    71         * Two-phased constructor.
       
    72         * @return New instance
       
    73         */
       
    74         static CCntNumberParser* NewL();
       
    75 
       
    76         /**
       
    77         * Destructor.
       
    78         */
       
    79         ~CCntNumberParser();
       
    80 
       
    81         /**
       
    82         * Gets a pointer of CContactPhoneNumberParser instance.
       
    83         *
       
    84         * @return the pointer of the instance.
       
    85         */
       
    86         CContactPhoneNumberParser* CntPhoneNumberParser() const;
       
    87 
       
    88     private:
       
    89 
       
    90         /**
       
    91         * C++ constructor.
       
    92         */
       
    93         CCntNumberParser();
       
    94 
       
    95         /**
       
    96         * Symbian OS constructor.
       
    97         */
       
    98         void ConstructL();
       
    99 
       
   100     private: // Data
       
   101 
       
   102         // Parser itself
       
   103         CContactPhoneNumberParser* iParser;
       
   104     };
       
   105 
       
   106 
       
   107 #endif //CCntNumberParser_H
       
   108 
       
   109 // End of File