|
1 /* |
|
2 * Copyright (c) 2007 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: MSearchEvent API object implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CSEARCHEVENTIMP_H |
|
19 #define CSEARCHEVENTIMP_H |
|
20 |
|
21 #include <s32strm.h> |
|
22 #include "ximpapieventbase.h" |
|
23 #include <searchevent.h> |
|
24 #include "searchapiobjbase.h" |
|
25 #include "searchtypehelpers.h" |
|
26 |
|
27 class RReadStream; |
|
28 class CXIMPIdentityImp; |
|
29 class CSearchInfoImp; |
|
30 class MXIMPIdentity; |
|
31 /** |
|
32 * MSearchEvent API object implementation. |
|
33 * |
|
34 * @lib searchdatamodel.dll |
|
35 */ |
|
36 NONSHARABLE_CLASS( CSearchEventImp ): public CXIMPApiEventBase,public MSearchEvent |
|
37 { |
|
38 public: |
|
39 /** The class ID. */ |
|
40 enum { KClassId = IMP_CLSID_CSEARCHEVENTIMP }; |
|
41 |
|
42 public: |
|
43 /** |
|
44 * Exported instantiation method for initializing |
|
45 * new event object. |
|
46 */ |
|
47 IMPORT_C static CSearchEventImp* NewLC( CXIMPIdentityImp& aSearchId, |
|
48 RSearchInfoImpArray* aSearchResults ); |
|
49 |
|
50 /** |
|
51 * Instantiation method for event automation. |
|
52 * Method signature must be exactly this to work |
|
53 * with event delivery automation system. |
|
54 * |
|
55 * Event implementation must be registered to |
|
56 * SearchEventCodec KApiEventConstructorTable. |
|
57 */ |
|
58 static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream ); |
|
59 |
|
60 /** |
|
61 * Destructor |
|
62 */ |
|
63 virtual ~CSearchEventImp(); |
|
64 |
|
65 private: |
|
66 /** |
|
67 * constructor |
|
68 */ |
|
69 CSearchEventImp(); |
|
70 |
|
71 /** |
|
72 * 2nd phase constructor |
|
73 */ |
|
74 void ConstructL( CXIMPIdentityImp& aSearchId, |
|
75 RSearchInfoImpArray* aSearchResults ); |
|
76 |
|
77 /** |
|
78 * 2nd phase constructor |
|
79 */ |
|
80 void ConstructL( RReadStream& aStream ); |
|
81 |
|
82 |
|
83 |
|
84 /** |
|
85 * Helper for internalize |
|
86 */ |
|
87 void InternalizeL( RReadStream& aStream ) ; |
|
88 /** |
|
89 * Helper for externalize |
|
90 */ |
|
91 void WriteArrayToStreamL(RSearchInfoImpArray& aArray, RWriteStream& aStream ) const; |
|
92 |
|
93 /** |
|
94 * Helper for internalize |
|
95 */ |
|
96 void FillArrayFromStreamL( RSearchInfoImpArray& aArray, |
|
97 RReadStream& aStream ); |
|
98 |
|
99 |
|
100 public: // From API base interfaces |
|
101 |
|
102 /** |
|
103 * Implementation of MXIMPBase interface methods |
|
104 * @see MXIMPBase |
|
105 */ |
|
106 XIMPIMP_DECLARE_IF_BASE_METHODS |
|
107 |
|
108 /** |
|
109 * Implementation of MSearchEventBase interface and |
|
110 * CSearchApiEventBase methods |
|
111 * |
|
112 */ |
|
113 XIMPIMP_DECLARE_EVENT_BASE_METHODS |
|
114 |
|
115 |
|
116 public: // From MSearchEvent |
|
117 /** |
|
118 * |
|
119 * @see MSearchEvent |
|
120 */ |
|
121 virtual TInt SearchResultCount() const ; |
|
122 |
|
123 |
|
124 /** |
|
125 * Gets the searched result by index. |
|
126 * |
|
127 * @param [in] aIndex |
|
128 * The index of the search. |
|
129 * |
|
130 * @return The searched result from given index. |
|
131 */ |
|
132 virtual const MSearchInfo& SearchResult( TInt aIndex ) const ; |
|
133 /** |
|
134 * |
|
135 * @see MSearchEvent |
|
136 */ |
|
137 virtual const MXIMPIdentity& SearchId() const; |
|
138 |
|
139 private: // data |
|
140 |
|
141 /** |
|
142 * Search Info array |
|
143 * Own. |
|
144 */ |
|
145 RSearchInfoImpArray* iSearchResults; |
|
146 |
|
147 /** |
|
148 * CXIMPIdentityImp : owned |
|
149 */ |
|
150 CXIMPIdentityImp* iSearchId ; |
|
151 |
|
152 TBool iConstructedFromStream; |
|
153 }; |
|
154 |
|
155 |
|
156 #endif // CSEARCHEVENTIMP_H |