|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPCS_PLUGIN_INTERFACE_H |
|
19 #define CPCS_PLUGIN_INTERFACE_H |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <s32mem.h> |
|
23 #include <coemain.h> |
|
24 |
|
25 #include <CPcsDefs.h> |
|
26 #include "CPsClientData.h" |
|
27 #include "CPsQuery.h" |
|
28 #include "CPsSettings.h" |
|
29 #include "CPsPattern.h" |
|
30 |
|
31 // FORWARD DECLARATION |
|
32 class CPcsPlugin; |
|
33 |
|
34 /** |
|
35 * Class is used to instantiate the required plugins when the search has been |
|
36 * asked. Acts as interface to all Plugins. |
|
37 */ |
|
38 |
|
39 class CPcsPluginInterface: public CBase |
|
40 { |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Symbian OS 2 phased constructor. |
|
45 * @return A pointer to the created instance of CPcsPluginInterface. |
|
46 */ |
|
47 static CPcsPluginInterface* NewL(); |
|
48 |
|
49 /** |
|
50 * Symbian OS 2 phased constructor. |
|
51 * @return A pointer to the created instance of CPcsPluginInterface. |
|
52 */ |
|
53 static CPcsPluginInterface* NewLC(); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 virtual ~CPcsPluginInterface(); |
|
59 |
|
60 /** |
|
61 * Instantiates the required search plug-ins known by the ecom framework. |
|
62 * basically this function first calls ListAllImplementationsL() |
|
63 * and then checks them one by one to match the algorithm name |
|
64 */ |
|
65 void InstantiateAlgorithmL(TDes& aAlgorithm); |
|
66 |
|
67 /** |
|
68 * Unloads all plugins |
|
69 * This should internally call REComSession::DestroyedImplementation( iDtor_ID_Key ) |
|
70 * and then REComSession::FinalClose() |
|
71 */ |
|
72 void UnloadPlugIns(); |
|
73 |
|
74 /** |
|
75 * Lists all implementations which satisfy this ecom interface |
|
76 * |
|
77 * @param aImplInfoArray On return, contains the list of available implementations |
|
78 * |
|
79 */ |
|
80 inline void ListAllImplementationsL( RImplInfoPtrArray& aImplInfoArray ) |
|
81 { |
|
82 REComSession::ListImplementationsL( KPcsPluginInterfaceUid, aImplInfoArray ); |
|
83 } |
|
84 |
|
85 /** |
|
86 * Forwards the search request to the algorithm instance |
|
87 */ |
|
88 void PerformSearchL(CPsSettings& aSettings, |
|
89 CPsQuery& aCondition, |
|
90 RPointerArray<CPsClientData>& aPsData, |
|
91 RPointerArray<CPsPattern>& aPattern); |
|
92 /** |
|
93 * Forwards the search request to the algorithm instance |
|
94 */ |
|
95 void SearchInputL(CPsQuery& aSearchQuery, |
|
96 TDesC& aSearchData, |
|
97 RPointerArray<TDesC>& aMatchSet, |
|
98 RArray<TPsMatchLocation>& aMatchLocation); |
|
99 |
|
100 /** |
|
101 * Forwards the search request to the algorithm instance |
|
102 */ |
|
103 void SearchMatchStringL(CPsQuery& aSearchQuery, |
|
104 TDesC& aSearchData, |
|
105 TDes& aMatch ); |
|
106 |
|
107 /** |
|
108 * Forwards the request to check if language is supported |
|
109 * to the algorithm instance |
|
110 */ |
|
111 TBool IsLanguageSupportedL(const TUint32 aLanguage); |
|
112 |
|
113 /** |
|
114 * Forwards the request to recover data fields order for a URI |
|
115 * to the algorithm instance |
|
116 */ |
|
117 void GetDataOrderL(TDesC& aURI, RArray<TInt>& aDataOrder); |
|
118 |
|
119 /** |
|
120 * Forwards the request to recover sort order for a URI |
|
121 * to the algorithm instance |
|
122 */ |
|
123 void GetSortOrderL(TDesC& aURI, RArray<TInt>& aSortOrder); |
|
124 |
|
125 /** |
|
126 * Forwards the request to set sort order for a URI |
|
127 * to the algorithm instance |
|
128 */ |
|
129 void ChangeSortOrderL(TDesC& aURI, RArray<TInt>& aSortOrder); |
|
130 |
|
131 /** |
|
132 * Returns the UID of the algorithm in use |
|
133 */ |
|
134 TUid AlgorithmInUse() |
|
135 { |
|
136 return iAlgorithmInUse; |
|
137 } |
|
138 |
|
139 private: |
|
140 |
|
141 /** |
|
142 * Performs the first phase of two phase construction. |
|
143 */ |
|
144 CPcsPluginInterface(); |
|
145 |
|
146 /** |
|
147 * Symbian OS 2 phased constructor. |
|
148 */ |
|
149 void ConstructL(); |
|
150 |
|
151 /** |
|
152 * Instantiates a PCS plug-in, knowing the implementation uid. |
|
153 * @param aImpUid imp uID |
|
154 */ |
|
155 CPcsPlugin* InstantiatePlugInFromImpUidL( const TUid& aImpUid ); |
|
156 |
|
157 |
|
158 private: |
|
159 |
|
160 TUid iDtor_ID_Key; |
|
161 |
|
162 // List of plugins that this interface will interact with |
|
163 RPointerArray<CPcsPlugin> iPcsPluginInstances; |
|
164 |
|
165 // Uid of the algorithm in use |
|
166 TUid iAlgorithmInUse; |
|
167 }; |
|
168 |
|
169 #endif // CPCS_PLUGIN_INTERFACE_H |
|
170 |
|
171 //End of File |