|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Place holder for common constants, type definitions and enums. |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @publishedAll |
|
22 @released |
|
23 */ |
|
24 |
|
25 #ifndef __INETURILISTDEF_H__ |
|
26 #define __INETURILISTDEF_H__ |
|
27 |
|
28 #include <e32base.h> |
|
29 |
|
30 /** |
|
31 @publishedAll |
|
32 @released |
|
33 */ |
|
34 namespace InetUriList |
|
35 { |
|
36 /** |
|
37 Types of supported service type. |
|
38 |
|
39 @publishedAll |
|
40 @released |
|
41 */ |
|
42 enum TServiceType |
|
43 { |
|
44 /** Browser */ |
|
45 EBrowser =0x01, |
|
46 /** WapPush */ |
|
47 EWapPush =0x02, |
|
48 /** PushEMail */ |
|
49 EPushEMail =0x03, |
|
50 /** DevProv */ |
|
51 EDevProv =0x04, |
|
52 /** VOIP */ |
|
53 EVoip =0x05 |
|
54 }; |
|
55 |
|
56 /** |
|
57 Types of supported list type. |
|
58 |
|
59 @publishedAll |
|
60 @released |
|
61 */ |
|
62 enum TListType |
|
63 { |
|
64 /** BlackList **/ |
|
65 EBlackList =0x01, |
|
66 /** WhiteList **/ |
|
67 EWhiteList =0x02 |
|
68 }; |
|
69 |
|
70 /** |
|
71 Types of permission. |
|
72 |
|
73 @publishedAll |
|
74 @released |
|
75 */ |
|
76 enum TPermission |
|
77 { |
|
78 /** ReadOnly **/ |
|
79 EReadOnly =0x01, |
|
80 /** ReadWrite **/ |
|
81 EReadWrite =0x02 |
|
82 }; |
|
83 |
|
84 /** |
|
85 Types of matches. |
|
86 |
|
87 @publishedAll |
|
88 @released |
|
89 */ |
|
90 enum TURIMatch |
|
91 { |
|
92 /** Exact match **/ |
|
93 EExact =0x01, |
|
94 /** Domain match **/ |
|
95 EDomain =0x02, |
|
96 /** Exact path match **/ |
|
97 EExactPath =0x03, |
|
98 /** partial prefix path match **/ |
|
99 EPartialPrefixPath =0x04, |
|
100 /** Partial suffix path match **/ |
|
101 EPartialSuffixPath =0x05 |
|
102 }; |
|
103 |
|
104 /** |
|
105 Error codes error numbers -7650 to -7699 have been reserved for InetUriList. |
|
106 */ |
|
107 static const TInt KErrorBase = -7650; |
|
108 /** |
|
109 URI already exists in database. |
|
110 */ |
|
111 static const TInt KErrUriAlreadyExists = KErrorBase; |
|
112 /** |
|
113 URI not found in database. |
|
114 */ |
|
115 static const TInt KErrUriNotFound = KErrorBase - 1; |
|
116 /** |
|
117 Addition of URI failed. |
|
118 */ |
|
119 static const TInt KErrUriAddFailed = KErrorBase - 2; |
|
120 /** |
|
121 Removal of URI failed. |
|
122 */ |
|
123 static const TInt KErrUriRemoveFailed = KErrorBase - 3; |
|
124 /** |
|
125 Updation of URI properties failed. |
|
126 */ |
|
127 static const TInt KErrUriUpdateFailed = KErrorBase - 4; |
|
128 /** |
|
129 URI is read only. |
|
130 */ |
|
131 static const TInt KErrUriReadOnly = KErrorBase - 5; |
|
132 /** |
|
133 Service type of URI is missing. |
|
134 */ |
|
135 static const TInt KErrServiceTypeNotPresent = KErrorBase - 6; |
|
136 /** |
|
137 Handle is not open. |
|
138 */ |
|
139 static const TInt KErrNotOpen = KErrorBase - 7; |
|
140 /** |
|
141 Invalid stream handle |
|
142 */ |
|
143 static const TInt KErrInvalidStreamHandle = KErrorBase - 8; |
|
144 |
|
145 /** |
|
146 Panic text if handle is not open. |
|
147 */ |
|
148 _LIT(KInetUriListErrHandleNotOpen, "Handle not open"); |
|
149 |
|
150 } |
|
151 |
|
152 /** |
|
153 This class defines the argument parameters for the query operation. It is possible to |
|
154 set the arguments in various combinations. The argument types can be ServiceType, |
|
155 ListType, URI in TDesC8 form, and URIMatch. |
|
156 |
|
157 @publishedAll |
|
158 @released |
|
159 */ |
|
160 class TQueryArgs |
|
161 { |
|
162 public: |
|
163 /** |
|
164 The argument types. |
|
165 |
|
166 @internalComponent |
|
167 */ |
|
168 enum TArgType |
|
169 { |
|
170 EUri = 1, |
|
171 EServiceType, |
|
172 EListType, |
|
173 EURIMatch |
|
174 }; |
|
175 /** |
|
176 Bit width of the type. |
|
177 |
|
178 @internalComponent |
|
179 */ |
|
180 enum |
|
181 { |
|
182 KBitsPerType = 3 |
|
183 }; |
|
184 |
|
185 /** |
|
186 Default constructor |
|
187 */ |
|
188 inline TQueryArgs () |
|
189 :iFlags ( 0 ) |
|
190 {} |
|
191 |
|
192 |
|
193 /** |
|
194 A templated constructor that constructs the query argument. |
|
195 It takes one argument. |
|
196 */ |
|
197 template < class T0 > |
|
198 explicit inline TQueryArgs ( T0 a0 ) |
|
199 { |
|
200 Assign ( a0 ); |
|
201 iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType)); |
|
202 } |
|
203 |
|
204 /** |
|
205 A templated constructor that constructs the query argument. |
|
206 It takes two arguments. |
|
207 */ |
|
208 template < class T0, class T1 > |
|
209 inline TQueryArgs ( T0 a0, T1 a1 ) |
|
210 { |
|
211 Assign ( a0 ); |
|
212 Assign ( a1 ); |
|
213 iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType)) | |
|
214 (Type(a1)<<(( Type(a1))*KBitsPerType)); |
|
215 } |
|
216 |
|
217 /** |
|
218 A templated constructor that constructs the query argument. |
|
219 It takes three arguments. |
|
220 */ |
|
221 template < class T0, class T1, class T2 > |
|
222 inline TQueryArgs ( T0 a0, T1 a1, T2 a2 ) |
|
223 { |
|
224 Assign ( a0 ); |
|
225 Assign ( a1 ); |
|
226 Assign ( a2 ); |
|
227 iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) | |
|
228 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
|
229 (Type(a2)<<(Type(a2)*KBitsPerType)); |
|
230 } |
|
231 |
|
232 /** |
|
233 A templated constructor that constructs the query argument. |
|
234 It takes four arguments. |
|
235 */ |
|
236 template < class T0, class T1, class T2, class T3 > |
|
237 inline TQueryArgs ( T0 a0, T1 a1, T2 a2, T3 a3 ) |
|
238 { |
|
239 Assign ( a0 ); |
|
240 Assign ( a1 ); |
|
241 Assign ( a2 ); |
|
242 Assign ( a3 ); |
|
243 iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) | |
|
244 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
|
245 (Type(a2)<<(Type(a2)*KBitsPerType)) | |
|
246 (Type(a3)<<(Type(a3)*KBitsPerType)); |
|
247 } |
|
248 |
|
249 |
|
250 /** |
|
251 Checks whether the flag is set for the given argument type. |
|
252 |
|
253 @internalComponent |
|
254 */ |
|
255 TBool IsSet ( TArgType aType ) const |
|
256 { |
|
257 TInt val = iFlags & ( aType << ( aType * KBitsPerType ) ); |
|
258 return iFlags & ( aType << ( aType * KBitsPerType ) ); |
|
259 } |
|
260 |
|
261 /** |
|
262 Returns the argument if set, otherwise returns KErrNotFound. |
|
263 |
|
264 @internalComponent |
|
265 */ |
|
266 TInt Get ( TArgType aType ) const |
|
267 { |
|
268 if ( IsSet ( aType ) ) |
|
269 return iArgs[aType - 1]; |
|
270 return KErrNotFound; |
|
271 } |
|
272 |
|
273 /** |
|
274 Maximum number of arguments. Currently set as 4. |
|
275 |
|
276 @internalComponent |
|
277 */ |
|
278 enum |
|
279 { |
|
280 KMaxArguments = 4 |
|
281 }; |
|
282 |
|
283 private: |
|
284 |
|
285 /** |
|
286 @internalComponent |
|
287 */ |
|
288 TArgType Type ( const TDesC8* ) |
|
289 { |
|
290 return EUri; |
|
291 } |
|
292 |
|
293 TArgType Type ( InetUriList::TServiceType ) |
|
294 { |
|
295 return EServiceType; |
|
296 } |
|
297 |
|
298 TArgType Type ( InetUriList::TListType ) |
|
299 { |
|
300 return EListType; |
|
301 } |
|
302 |
|
303 TArgType Type ( InetUriList::TURIMatch ) |
|
304 { |
|
305 return EURIMatch; |
|
306 } |
|
307 |
|
308 void Assign ( const TDesC8* aValue ) |
|
309 { |
|
310 iArgs[Type(aValue)-1] = (TInt)aValue; |
|
311 } |
|
312 |
|
313 void Assign ( InetUriList::TServiceType aValue ) |
|
314 { |
|
315 iArgs[Type(aValue)-1] = aValue; |
|
316 } |
|
317 |
|
318 void Assign ( InetUriList::TListType aValue ) |
|
319 { |
|
320 iArgs[Type(aValue)-1] = aValue; |
|
321 } |
|
322 |
|
323 void Assign ( InetUriList::TURIMatch aValue ) |
|
324 { |
|
325 iArgs[Type(aValue)-1] = aValue; |
|
326 } |
|
327 |
|
328 private: |
|
329 TInt iArgs [KMaxArguments]; |
|
330 TInt iFlags; |
|
331 }; |
|
332 |
|
333 #endif // __INETURILISTDEF_H__ |