calendarui/organizerplugin/aiagendapluginengine/inc/AIAgendaPluginEngineIf.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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:  
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAIAGENDAPLUGINENGINEIFIF_H
       
    20 #define CAIAGENDAPLUGINENGINEIFIF_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <ecom/ecom.h>
       
    24 #include "aiagendapluginengineuids.hrh"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MPluginDataChangeObserver;
       
    28 
       
    29 // CONSTANTS
       
    30 // Available observer types:
       
    31 enum TObserverType
       
    32 {
       
    33     EToDoObserver,
       
    34     ECalendarObserver,
       
    35     ECalendarAndTodoObserver
       
    36 };
       
    37 
       
    38 /**
       
    39  *  ECom interface for CAIAgendaPluginEngine.
       
    40  *  @since S60 3.1
       
    41  */
       
    42 class CAIAgendaPluginEngineIf : public CBase
       
    43 {
       
    44 public:
       
    45     /**
       
    46      * Two-phased constructor.
       
    47      * @since S60 3.1
       
    48      **/
       
    49     inline static CAIAgendaPluginEngineIf* NewL( MPluginDataChangeObserver& aDataChangeObserver,
       
    50                                                  TObserverType aObserverType );
       
    51     /**
       
    52      * Destructor.
       
    53      **/
       
    54     inline ~CAIAgendaPluginEngineIf();
       
    55 
       
    56 public: // New methods
       
    57     /**
       
    58      * Start the state machine inside the CAIAgendaPluginEngineImpl.
       
    59      * @since S60 3.1
       
    60      **/
       
    61     virtual void Refresh() = 0;
       
    62     
       
    63 protected:
       
    64     struct TCtorParams
       
    65     {
       
    66         MPluginDataChangeObserver* iDataChangeObserver;
       
    67         TObserverType iObserverType;
       
    68     };
       
    69 
       
    70 private:
       
    71     // An identifier used during destruction
       
    72     TUid iDestructKey;
       
    73 
       
    74 };
       
    75 
       
    76 // Two-phased constructor.
       
    77 inline CAIAgendaPluginEngineIf* CAIAgendaPluginEngineIf::NewL( MPluginDataChangeObserver& aDataChangeObserver,
       
    78                                                                TObserverType aObserverType )
       
    79     {
       
    80     TCtorParams ctorParams;
       
    81     ctorParams.iDataChangeObserver = &aDataChangeObserver;
       
    82     ctorParams.iObserverType = aObserverType;
       
    83     
       
    84     TAny* ptr = REComSession::CreateImplementationL(
       
    85                             TUid::Uid( KAIAgendaPluginEngineImplUid ),
       
    86                             _FOFF( CAIAgendaPluginEngineIf, iDestructKey ),
       
    87                             &ctorParams );
       
    88 
       
    89     return reinterpret_cast<CAIAgendaPluginEngineIf*>( ptr );
       
    90     }
       
    91 
       
    92 // destructor
       
    93 inline CAIAgendaPluginEngineIf::~CAIAgendaPluginEngineIf()
       
    94     {
       
    95     REComSession::DestroyedImplementation( iDestructKey );
       
    96     }
       
    97 
       
    98 #endif  // CAIAGENDAPLUGINENGINEIF_H
       
    99 
       
   100 
       
   101 // End of File