applayerpluginsandutils/bookmarksupport/test/cenrepsrv/obsrvr.h
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef OBSRVR_H
       
    17 #define OBSRVR_H
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 class MObserver
       
    22 	{
       
    23 public:
       
    24 	virtual void Notify(TUint32 aId) = 0;
       
    25 	};
       
    26 
       
    27 class CObservable : public CBase
       
    28 	{
       
    29 public:
       
    30 	CObservable();
       
    31 	~CObservable();
       
    32 
       
    33 	TInt AddObserverL(MObserver& aObserver);
       
    34 	TInt RemoveObserver(MObserver& aObserver);
       
    35 	void Notify(TUint32 aVal) const;
       
    36 	
       
    37 protected:
       
    38 	TBool iNotificationState;//Notification can be made if iNotificationState is non-zero, 
       
    39 	                         //otherwise the notification is disabled
       
    40 
       
    41 private:
       
    42 	RPointerArray<MObserver> iObservers;
       
    43 	TInt iRefCount;
       
    44 	};
       
    45 
       
    46 #endif // OBSRVR_H