phonebookengines/contactsmodel/cntsrv/inc/CCntMsgHandler.h
changeset 0 e686773b3f54
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookengines/contactsmodel/cntsrv/inc/CCntMsgHandler.h	Tue Feb 02 10:12:17 2010 +0200
@@ -0,0 +1,77 @@
+/**
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef CNTMSGHANDLER_H
+#define CNTMSGHANDLER_H
+
+#include <e32base.h>
+#include "CCntDbManager.h" // For TCntFileMode
+#include "CCntMsgHandlerFptr.h"
+
+class CCntSession;
+class CCntServer;
+class CCntDbManager;
+class CCntPackager;
+class CContactViewDef;
+class CEventQueue;
+
+/**
+The base class for message handler classes. CCntSession class creates
+and owns message handler instances.
+
+@internalComponent
+*/
+class CCntMsgHandler : public CBase
+	{
+public:
+	virtual ~CCntMsgHandler();
+	
+	/** 
+	Overriden by all derived classes. Delegates the incoming op code
+	to a message handling method. 
+	*/
+	virtual TInt HandleMessageL(const RMessage2& aMessage) = 0;	
+	
+protected:
+	CCntMsgHandler(CCntSession& aSession);
+	
+	// Helper methods.
+	void CheckForManagerL();
+	CCntServer& Server();
+	void ReadL(const RMessage2& aMessage, TInt aParam, TDes& aDes);
+	void WriteL(const RMessage2& aMessage, TInt aParam, const TDesC& aDes, TInt aOffset = 0);
+	void UnRegisterDatabaseEventObserver();
+	MsgHandlerFptr LookupHandlerMethodL(TInt aOpCode, const TInt* aOpCodes, const TInt aOpCodesLength);
+	
+protected:
+	CCntDbManager*&	 iManager;
+	CCntPackager& 	 iPackager;
+	CContactViewDef*& iView;
+	TInt& 			 iTimeOut;
+	TUint&	     iSessionId;
+	CCntSession& iSession;	
+	};
+	
+
+#endif