localconnectivityservice/generichid/src/hidsearch.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:20:40 +0100
branchRCL_3
changeset 22 52a167391590
parent 0 c3e98f10fcf4
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* 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);
    }