landmarks/locationlandmarks/localsearchprov/inc/EPos_TPosLmProgressHelper.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 01:06:48 +0200
changeset 0 667063e416a2
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2005 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: 
*     See class description below
*
*/


#ifndef TPOSLMPROGRESSHELPER_H
#define TPOSLMPROGRESSHELPER_H

//  INCLUDES
#include <e32std.h>

// CLASS DECLARATION

/**
*  This is a helper class for calculating progress during a search operation.
*
*  @version $Revision: 1.4 $, $Date: 2005/02/15 13:36:46 $
*/
class TPosLmProgressHelper
    {
    public:  // Constructors and destructor

        /**
        * C++ default constructor.
        */
        TPosLmProgressHelper();

    public: // New functions

        /**
        * Prepares for calculation of search progress.
        *
        * @param aNoOfRowsToEvaluate The number rows in the table(s) to search.
        * @param aSqlQueryIncludesSearchCondition @p ETrue if the db query
        *   will include a condition of which rows in a table that matches,
        *   @p EFalse if the db query will get all rows in a table.
        */
        void PrepareCalculateProgress(
        /* IN  */       TInt aNoOfRowsToEvaluate,
        /* IN  */       TBool aSqlQueryIncludesSearchCondition = ETrue
        );

        void HandleViewPrepared();
        void HandleViewEvaluatedL(TInt aNumOfRowsInView);
        void HandleViewGetRow();

        /**
        * Calculates the progress of a search.
        *
        * @return The progress of the search.
        */
        TReal32 CalculateProgressL();

    private: // New functions

        TReal32 CalculateEvaluationProgressL();

    private:     // Data

        TInt iEvalCounter;

        TReal32 iGuessNumOfEvalsDivByTwo;

        TReal32 iPreviousEvaluationProgress;
        TReal32 iEvaluationProgress;

        TInt iNumOfRowsInPreviousEvaluations;
        TInt iNumOfRowsInEvaluation;

        TInt iRowCounter;
    };

#endif  // TPOSLMPROGRESSHELPER_H

// End of File