javaextensions/location/landmarks/inc/clapilmdatabaseeventnotifier.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Handles native landmark database events
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CLAPILMDATABASEEVENTNOTIFIER_H
       
    20 #define CLAPILMDATABASEEVENTNOTIFIER_H
       
    21 
       
    22 // INTERNAL INCLUDES
       
    23 #include    "mlapilmdatabaseeventnotifier.h"
       
    24 
       
    25 // EXTERNAL INCLUDES
       
    26 #include    <e32std.h>
       
    27 #include    <e32base.h>
       
    28 #include    <EPos_Landmarks.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CPosLandmarkDatabase;
       
    32 class MLAPILmDatabaseObserver;
       
    33 
       
    34 /**
       
    35  * Handles native landmark database events
       
    36  *
       
    37  * The class monitors for the specified landmark database and notifies its
       
    38  * observers when a certain database event occurs. Currently, the notifier notifies
       
    39  * only when an event which is related to landmarks or categories occurs
       
    40  *
       
    41  * @lib N/A
       
    42  * @since S60 3.2
       
    43  */
       
    44 NONSHARABLE_CLASS(CLAPILmDatabaseEventNotifier) : public CActive,
       
    45         public MLAPILmDatabaseEventNotifier
       
    46 {
       
    47 public: // Constructors and destructor
       
    48 
       
    49     /**
       
    50      * Two-phased constructor. Creates an instance from this class
       
    51      * The caller takes the ownership of the returned instance which
       
    52      * is left to the cleanup stack
       
    53      *
       
    54      * @param aDatabase The database which events this active object listens
       
    55      * @return New instance from this class
       
    56      */
       
    57     static CLAPILmDatabaseEventNotifier* NewLC(CPosLandmarkDatabase& aDatabase);
       
    58 
       
    59     /**
       
    60      * Destructor.
       
    61      */
       
    62     virtual ~CLAPILmDatabaseEventNotifier();
       
    63 
       
    64 public: // From MLAPILmDatabaseEventNotifier
       
    65 
       
    66     /**
       
    67      * Adds an event observer to this notifier
       
    68      *
       
    69      * @param aObserver An event observer. This class does NOT take
       
    70      *        the ownership of the value
       
    71      */
       
    72     void AddObserverL(MLAPILmDatabaseObserver* aObserver);
       
    73 
       
    74     /**
       
    75      * Removes an event observer from this notifier. Nothing happens if
       
    76      * there is no such observer in the observer array
       
    77      *
       
    78      * @param aObserver An event observer. This class does NOT take
       
    79      *        the ownership of the value
       
    80      */
       
    81     void RemoveObserver(MLAPILmDatabaseObserver* aObserver);
       
    82 
       
    83     /**
       
    84      * Returns ETrue if event listening is supported. EFalse if the
       
    85      * Landmarks API does not support event listening
       
    86      */
       
    87     TBool IsEventListeningSupported();
       
    88 
       
    89 protected: // From CActive
       
    90 
       
    91     /**
       
    92      * Called when a request has completed. Note that RunError is not
       
    93      * implemented because RunL is currently leave-safe
       
    94      */
       
    95     void RunL();
       
    96 
       
    97     /**
       
    98      * Called by the base class when this active object is canceled
       
    99      */
       
   100     void DoCancel();
       
   101 
       
   102 protected: // Constructors
       
   103 
       
   104     /**
       
   105      * C++ constructor
       
   106      */
       
   107     CLAPILmDatabaseEventNotifier(CPosLandmarkDatabase& aDatabase);
       
   108 
       
   109 private: // Data
       
   110 
       
   111     // The database which events this object listens. Used
       
   112     CPosLandmarkDatabase& iDatabase;
       
   113     // Array of database event observers. Used
       
   114     RPointerArray< MLAPILmDatabaseObserver> iEventObservers;
       
   115     // Event objects which holds the event and item id when
       
   116     // a request has completed.
       
   117     TPosLmEvent iEvent;
       
   118 
       
   119 };
       
   120 
       
   121 #endif // CLAPILMDATABASEEVENTNOTIFIER_H
       
   122 // End of file