localconnectivityservice/generichid/src/hidsearch.cpp
branchRCL_3
changeset 19 0aa8cc770c8a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidsearch.cpp	Tue Aug 31 16:03:15 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  HID field search
+*
+*/
+
+#include <e32std.h>
+#include <e32svr.h>
+
+#include "hidreportroot.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// SearchL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void THidFieldSearch::SearchL(const CReportRoot* aReportRoot,
+    MHidFieldFinder* aFinder)
+    {
+    iFinder = aFinder;
+
+    if (aReportRoot)
+        {
+        TBool done = EFalse;
+        for (TInt i=0; (i < aReportRoot->CollectionCount()) && !done; ++i)
+            {
+            done = !DoSearchL(aReportRoot->CollectionByIndex(i));
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// DoSearchL()
+// ---------------------------------------------------------------------------
+//
+TBool THidFieldSearch::DoSearchL(const CCollection* aCollection)
+    {
+    if (iFinder->BeginCollection(aCollection))
+        {
+        TInt i;
+
+        for (i=0; i < aCollection->FieldCount(); ++i)
+            {
+            iFinder->Field(aCollection->FieldByIndex(i));
+            }
+
+        for (i=0; i < aCollection->CollectionCount(); ++i)
+            {
+            if (!DoSearchL(aCollection->CollectionByIndex(i)))
+                {
+                return EFalse;
+                }
+            }
+        }
+
+    return iFinder->EndCollection(aCollection);
+    }