|
1 /* |
|
2 * Copyright (c) 2004-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: HID field search |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32std.h> |
|
19 #include <e32svr.h> |
|
20 |
|
21 #include "hidreportroot.h" |
|
22 |
|
23 // ======== MEMBER FUNCTIONS ======== |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // SearchL() |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 EXPORT_C void THidFieldSearch::SearchL(const CReportRoot* aReportRoot, |
|
30 MHidFieldFinder* aFinder) |
|
31 { |
|
32 iFinder = aFinder; |
|
33 |
|
34 if (aReportRoot) |
|
35 { |
|
36 TBool done = EFalse; |
|
37 for (TInt i=0; (i < aReportRoot->CollectionCount()) && !done; ++i) |
|
38 { |
|
39 done = !DoSearchL(aReportRoot->CollectionByIndex(i)); |
|
40 } |
|
41 } |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // DoSearchL() |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 TBool THidFieldSearch::DoSearchL(const CCollection* aCollection) |
|
49 { |
|
50 if (iFinder->BeginCollection(aCollection)) |
|
51 { |
|
52 TInt i; |
|
53 |
|
54 for (i=0; i < aCollection->FieldCount(); ++i) |
|
55 { |
|
56 iFinder->Field(aCollection->FieldByIndex(i)); |
|
57 } |
|
58 |
|
59 for (i=0; i < aCollection->CollectionCount(); ++i) |
|
60 { |
|
61 if (!DoSearchL(aCollection->CollectionByIndex(i))) |
|
62 { |
|
63 return EFalse; |
|
64 } |
|
65 } |
|
66 } |
|
67 |
|
68 return iFinder->EndCollection(aCollection); |
|
69 } |