summaryrefslogtreecommitdiffstats
path: root/plugins/contacts/symbian/contactsmodel/tsrc/packagerclientserver/server/inc/t_packagertestserver.h
blob: 1067fff0c252d98d51ac6662c25ebf12e222ccc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
* Contact: http://www.qt-project.org/legal
* 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: 
* CPackagerTestServer - server classes
*
*/


#ifndef __PACKAGER_TEST_SERVER_H__
#define __PACKAGER_TEST_SERVER_H__

#include <e32base.h>
#include <f32file.h>
#include "ccntpackager.h"
#include <cntfilt.h>
#include "t_packagertesthelper.h"
#include "t_serveractiveobject.h"

// TestServer Class
class CPackagerTestServer : public CServer2
	{

public:
	static CServer2* NewLC();
	~CPackagerTestServer();
	
	CPackagerCntFactory& FactoryL() const;
	CPackagerCntComparator& ComparatorL()const;
	CCntPackager& PackagerL(); 
	
private:
	CPackagerTestServer();
	void ConstructL ();
    CSession2* NewSessionL (const TVersion& aVersion, const RMessage2& aMessage) const;

private:
	TInt iSessionCount;
	
	// Server keeps only one instance of these objects, shared between sessions.
	CCntPackager* iPackager;
	mutable CPackagerCntFactory* iFactory;
	mutable CPackagerCntComparator* iComparator;
	};

class CServerActiveObject;
// TestSession Class
class CPackagerTestSession : public CSession2
	{

public:
	CPackagerTestSession(); // Move to private
	void CreateL();
	void ServiceL(const RMessage2& aMessage);
	void ServiceError(const RMessage2 &aMessage, TInt aError);	
	
	void NextStepL() const;

private:
	~CPackagerTestSession();
	inline CPackagerTestServer& Server() const;

	void UnPackL(const RMessage2& aMessage);
	void SendBackToClientL(const RMessage2& aMessage);
	TInt DoCompareL() const;
	void CompleteWriteBackL(const RMessage2 &aMessage, const TPtr8& aPtr);
	CContactItem& CntItemL();
	CContentType& CntContentTypeL();
	CContactTextDef& CntTextDefL();
	CContactItemViewDef& CntItemViewDefL();
	CContactViewDef& CntViewDefL();
	CContactIdArray& CntIdArrayL();
	CCntFilter& CntFilterL();
	CViewContact& ViewCntL();
	CDesCArray& DesCArrayL();	
	
private:
	mutable CContactItem* iContactItem;
	mutable CContentType* iContentType;
	mutable CContactTextDef* iContactTextDef;
	mutable CContactItemViewDef* iContactItemViewDef;
	mutable CContactViewDef* iContactViewDef;
	mutable CContactIdArray* iContactIdArray;
	mutable CCntFilter* iContactFilter;
	mutable CViewContact* iViewContact;
	mutable CDesCArray* iDesCArray;
	
	TInt iCurrentOpCode;
	CServerActiveObject* iSessionAO;
	const RMessage2* iMessage;
	};


// CPackagerTestServer inline methods	
inline CPackagerTestServer::CPackagerTestServer():CServer2(0, ESharableSessions)
	{
	}


// CPackagerTestSession inline methods		
inline CPackagerTestSession::CPackagerTestSession()
	{}
	
inline CPackagerTestServer& CPackagerTestSession::Server() const
	{
	return *static_cast<CPackagerTestServer*>(const_cast<CServer2*>(CSession2::Server()));
	}
	
#endif // __PACKAGER_TEST_SERVER_H__