1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
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 |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // Place holder for common constants, type definitions and enums. |
14 // Place holder for common constants, type definitions and enums. |
15 // |
15 // |
16 |
16 // |
17 |
|
18 |
17 |
19 /** |
18 /** |
20 @file |
19 @file |
21 @publishedAll |
20 @publishedAll |
22 @released |
21 @released |
139 static const TInt KErrNotOpen = KErrorBase - 7; |
152 static const TInt KErrNotOpen = KErrorBase - 7; |
140 /** |
153 /** |
141 Invalid stream handle |
154 Invalid stream handle |
142 */ |
155 */ |
143 static const TInt KErrInvalidStreamHandle = KErrorBase - 8; |
156 static const TInt KErrInvalidStreamHandle = KErrorBase - 8; |
144 |
157 /** |
|
158 Tld URI is missing. |
|
159 */ |
|
160 static const TInt KErrTldUriNotPresent = KErrorBase - 9; |
|
161 /** |
|
162 Query Type of URI is missing. |
|
163 */ |
|
164 static const TInt KErrTldQueryTypeNotPresent = KErrorBase - 10; |
|
165 /** |
|
166 Policy Data is not present. |
|
167 */ |
|
168 static const TInt KErrPolicyDataNotPresent = KErrorBase - 11; |
|
169 /** |
|
170 TLD list type is not present. |
|
171 */ |
|
172 static const TInt KErrPolicyListTypeNotPresent = KErrorBase - 12; |
|
173 /** |
|
174 Requested TLD type is not supported. |
|
175 */ |
|
176 static const TInt KErrInvalidTLD = KErrorBase - 13; |
145 /** |
177 /** |
146 Panic text if handle is not open. |
178 Panic text if handle is not open. |
147 */ |
179 */ |
148 _LIT(KInetUriListErrHandleNotOpen, "Handle not open"); |
180 _LIT(KInetUriListErrHandleNotOpen, "Handle not open"); |
|
181 /** |
|
182 Panic text if handle is not open. |
|
183 */ |
|
184 _LIT(KTldInvalidRequest, "Invalid Request"); |
149 |
185 |
150 } |
186 } |
151 |
187 |
152 /** |
188 /** |
153 This class defines the argument parameters for the query operation. It is possible to |
189 This class defines the argument parameters for the query operation. It is possible to |
244 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
270 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
245 (Type(a2)<<(Type(a2)*KBitsPerType)) | |
271 (Type(a2)<<(Type(a2)*KBitsPerType)) | |
246 (Type(a3)<<(Type(a3)*KBitsPerType)); |
272 (Type(a3)<<(Type(a3)*KBitsPerType)); |
247 } |
273 } |
248 |
274 |
249 |
275 /** |
|
276 Returns the argument if set, otherwise returns KErrNotFound. |
|
277 */ |
|
278 TInt Get ( TArgType aType ) const |
|
279 { |
|
280 if ( IsSet ( aType ) ) |
|
281 return iArgs[aType - 1]; |
|
282 return KErrNotFound; |
|
283 } |
|
284 |
|
285 private: |
|
286 /** |
|
287 Bit width of the type. |
|
288 */ |
|
289 enum |
|
290 { |
|
291 KBitsPerType = 3 |
|
292 }; |
|
293 /** |
|
294 Maximum number of arguments. Currently set as 4. |
|
295 */ |
|
296 enum |
|
297 { |
|
298 KMaxArguments = 4 |
|
299 }; |
|
300 /** |
|
301 Checks whether the flag is set for the given argument type. |
|
302 */ |
|
303 TBool IsSet ( TArgType aType ) const |
|
304 { |
|
305 TInt val = iFlags & ( aType << ( aType * KBitsPerType ) ); |
|
306 return iFlags & ( aType << ( aType * KBitsPerType ) ); |
|
307 } |
|
308 |
|
309 TArgType Type ( const TDesC8* ) |
|
310 { |
|
311 return EUri; |
|
312 } |
|
313 |
|
314 TArgType Type ( InetUriList::TServiceType ) |
|
315 { |
|
316 return EServiceType; |
|
317 } |
|
318 |
|
319 TArgType Type ( InetUriList::TListType ) |
|
320 { |
|
321 return EListType; |
|
322 } |
|
323 |
|
324 TArgType Type ( InetUriList::TURIMatch ) |
|
325 { |
|
326 return EURIMatch; |
|
327 } |
|
328 |
|
329 void Assign ( const TDesC8* aValue ) |
|
330 { |
|
331 iArgs[Type(aValue)-1] = (TInt)aValue; |
|
332 } |
|
333 |
|
334 void Assign ( InetUriList::TServiceType aValue ) |
|
335 { |
|
336 iArgs[Type(aValue)-1] = aValue; |
|
337 } |
|
338 |
|
339 void Assign ( InetUriList::TListType aValue ) |
|
340 { |
|
341 iArgs[Type(aValue)-1] = aValue; |
|
342 } |
|
343 |
|
344 void Assign ( InetUriList::TURIMatch aValue ) |
|
345 { |
|
346 iArgs[Type(aValue)-1] = aValue; |
|
347 } |
|
348 |
|
349 private: |
|
350 TInt iArgs [KMaxArguments]; |
|
351 TInt iFlags; |
|
352 }; |
|
353 |
|
354 #else |
|
355 |
|
356 class TQueryArgs |
|
357 { |
|
358 public: |
|
359 /** |
|
360 The argument types. |
|
361 |
|
362 @internalComponent |
|
363 */ |
|
364 enum TArgType |
|
365 { |
|
366 EUri = 1, |
|
367 EServiceType, |
|
368 EListType, |
|
369 EURIMatch |
|
370 }; |
|
371 /** |
|
372 Bit width of the type. |
|
373 |
|
374 @internalComponent |
|
375 */ |
|
376 enum |
|
377 { |
|
378 KBitsPerType = 3 |
|
379 }; |
|
380 |
|
381 /** |
|
382 Default constructor |
|
383 */ |
|
384 inline TQueryArgs () |
|
385 :iFlags ( 0 ) |
|
386 {} |
|
387 |
|
388 |
|
389 /** |
|
390 A templated constructor that constructs the query argument. |
|
391 It takes one argument. |
|
392 */ |
|
393 template < class T0 > |
|
394 explicit inline TQueryArgs ( T0 a0 ) |
|
395 { |
|
396 Assign ( a0 ); |
|
397 iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType)); |
|
398 } |
|
399 |
|
400 /** |
|
401 A templated constructor that constructs the query argument. |
|
402 It takes two arguments. |
|
403 */ |
|
404 template < class T0, class T1 > |
|
405 inline TQueryArgs ( T0 a0, T1 a1 ) |
|
406 { |
|
407 Assign ( a0 ); |
|
408 Assign ( a1 ); |
|
409 iFlags=(Type(a0)<<(( Type(a0))*KBitsPerType)) | |
|
410 (Type(a1)<<(( Type(a1))*KBitsPerType)); |
|
411 } |
|
412 |
|
413 /** |
|
414 A templated constructor that constructs the query argument. |
|
415 It takes three arguments. |
|
416 */ |
|
417 template < class T0, class T1, class T2 > |
|
418 inline TQueryArgs ( T0 a0, T1 a1, T2 a2 ) |
|
419 { |
|
420 Assign ( a0 ); |
|
421 Assign ( a1 ); |
|
422 Assign ( a2 ); |
|
423 iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) | |
|
424 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
|
425 (Type(a2)<<(Type(a2)*KBitsPerType)); |
|
426 } |
|
427 |
|
428 /** |
|
429 A templated constructor that constructs the query argument. |
|
430 It takes four arguments. |
|
431 */ |
|
432 template < class T0, class T1, class T2, class T3 > |
|
433 inline TQueryArgs ( T0 a0, T1 a1, T2 a2, T3 a3 ) |
|
434 { |
|
435 Assign ( a0 ); |
|
436 Assign ( a1 ); |
|
437 Assign ( a2 ); |
|
438 Assign ( a3 ); |
|
439 iFlags=(Type(a0)<<(Type(a0)*KBitsPerType)) | |
|
440 (Type(a1)<<(Type(a1)*KBitsPerType)) | |
|
441 (Type(a2)<<(Type(a2)*KBitsPerType)) | |
|
442 (Type(a3)<<(Type(a3)*KBitsPerType)); |
|
443 } |
|
444 |
|
445 |
250 /** |
446 /** |
251 Checks whether the flag is set for the given argument type. |
447 Checks whether the flag is set for the given argument type. |
252 |
448 |
253 @internalComponent |
449 @internalComponent |
254 */ |
450 */ |