summaryrefslogtreecommitdiffstats
path: root/plugins/contacts/symbian/contactsmodel/cntmodel/inc/ccntpackager.h
blob: 0fd038e63559d630c30d7ab7f6a6db97f56c2f4a (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
/*
* Copyright (c) 2005-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
 @released
*/


#ifndef __CCNTPACKAGER_H__
#define __CCNTPACKAGER_H__

#include <cntdb.h>
#include <badesca.h>

class CContactItem;
class CCntFilter;
class CContactItemViewDef;
class CContactViewDef;
class CContactTextDef;
class CContentType;
class CContactIdArray;
class CViewContact;


/**
The CCntPackager class provides methods for packing and unpacking objects used
in IPC (inter-process communications) messages.

The class contains a dynamically allocated buffer for accommodating different 
kinds of object that will be sent over the process boundaries.
*/
NONSHARABLE_CLASS(CCntPackager) : public CBase
	{
public:
	IMPORT_C static CCntPackager* NewL();
	IMPORT_C ~CCntPackager();
	IMPORT_C TPtr8 PackL(const CContactItem& aItem);
	IMPORT_C TPtr8 PackL(const CContactItem& aItem, TInt& aSize);
	IMPORT_C TPtr8 PackL(const CContentType& aItem);
	IMPORT_C TPtr8 PackL(const CContactTextDef& aItem);	
	IMPORT_C TPtr8 PackL(const CContactItemViewDef& aItem);
	IMPORT_C TPtr8 PackL(const CContactViewDef& aItem);
	IMPORT_C TPtr8 PackL(const CContactIdArray& aItem);
	IMPORT_C TPtr8 PackL(const CCntFilter& aItem);	
	IMPORT_C TPtr8 PackL(const CViewContact& aItem);
	IMPORT_C TPtr8 PackL(const CDesCArray& aItem);
	IMPORT_C TPtr8 PackL(const CArrayFix<CContactDatabase::TSortPref>& aItem);
	IMPORT_C TPtr8 PackL(const CArrayFixFlat<TUid>& aItem);
	
	IMPORT_C CContactItem* UnpackCntItemLC() const;
	IMPORT_C CContentType* UnpackCntContentTypeLC() const;
	IMPORT_C CContactTextDef* UnpackCntTextDefLC() const;
	IMPORT_C CContactItemViewDef* UnpackCntItemViewDefLC() const;
	IMPORT_C CContactViewDef* UnpackCntViewDefLC() const;
	IMPORT_C CContactIdArray* UnpackCntIdArrayLC() const;
	IMPORT_C CCntFilter* UnpackCntFilterLC() const;
	IMPORT_C CViewContact* UnpackViewContactLC() const;
	IMPORT_C CDesCArray* UnpackDesCArrayLC() const;
	IMPORT_C CArrayFix<CContactDatabase::TSortPref>* UnpackCArrayFixLC() const;
	IMPORT_C CArrayFixFlat<TUid>* UnpackTUidArrayLC() const;
	
	IMPORT_C void Clear();
	IMPORT_C void SetBufferFromMessageL(const RMessage2& aMessage, TUint aMessageSlot=0);

	IMPORT_C const TDesC8& GetTransmittingBuffer() const;
	IMPORT_C TDes8& GetReceivingBufferL(TInt aSize=0);

private:
	CCntPackager();
	void ConstructL();
	void ResetPointer();	
	
private:
	CBufFlat* iBuffer;
	TInt iMaxBufferSize;

	mutable TPtr8 transPtr;
	TPtr8 recPtr;
	};

	
#endif // __CCNTPACKAGER_H__