landmarks/locationlandmarks/localaccess/inc/EPos_CPosLmLocalGetSortedIdsOp.h
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 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: Operation for reading partial landmarks.
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef EPOS_CPOSLMLOCALGETSORTEDIDSOP_H_
       
    20 #define EPOS_CPOSLMLOCALGETSORTEDIDSOP_H_
       
    21 
       
    22 #include "EPos_CPosLmLocalOperation.h"
       
    23 #include <EPos_Landmarks.h>
       
    24 
       
    25 class CPosLandmark;
       
    26 class CPosLmLocalDatabase;
       
    27 class CPosLmPartialReadParameters;
       
    28 
       
    29 /**
       
    30 * Operation for reading partial landmarks. This operation can be
       
    31 * either synchronous or asynchronous.
       
    32 */
       
    33 NONSHARABLE_CLASS(CPosLmLocalGetSortedIdsOp) : public CPosLmLocalOperation
       
    34     {
       
    35 
       
    36     public:  // Constructors and destructor
       
    37 
       
    38         /**
       
    39         * Two-phased constructor.
       
    40         * @param aDb A landmark database.
       
    41         * @param aSortPref Sorting preference
       
    42         */
       
    43         static CPosLmLocalGetSortedIdsOp* NewL(
       
    44             CPosLmLocalDatabase& aDb,
       
    45             TPosLmSortPref aSortPref );
       
    46 
       
    47         virtual ~CPosLmLocalGetSortedIdsOp();
       
    48 
       
    49     public: // From CPosLmLocalOperation
       
    50 
       
    51         /** Synchronous incremental execution of the operation. Performs a single
       
    52         * step of the operation synchronously.
       
    53         *
       
    54         * Leaves with an error code if something goes wrong.
       
    55         *
       
    56         * @param[out] aProgress Will be set to the progress of the operation when
       
    57         * the step has finished.
       
    58         * @return @p KPosLmOperationNotComplete if the step has completed but
       
    59         *   more steps are needed before the operation has finished,
       
    60         *   @p KErrNone if the operation has finished successfully.
       
    61         */
       
    62         TInt NextStepL( TReal32& aProgress );
       
    63 
       
    64         /** Handles any error generated by NextStepL. Will be called when
       
    65         * NextStepL leaves. The error code is allowed to be changed, if
       
    66         * necessary.
       
    67         *
       
    68         * @param[in,out] aError An error code generated by NextStepL.
       
    69         */
       
    70         void HandleError( TInt& aError );
       
    71 
       
    72     public:     // New functions
       
    73 
       
    74         /** Fills given array with landmark IDs. */
       
    75         void GetResultL( RArray<TPosLmItemId>& aIdArray );
       
    76 
       
    77     private:
       
    78 
       
    79         /**
       
    80         * C++ default constructor.
       
    81         * @param aDb A landmark db.
       
    82         */
       
    83         CPosLmLocalGetSortedIdsOp( CPosLmLocalDatabase& aDb, TPosLmSortPref aSortPref );
       
    84 
       
    85         void ConstructL();
       
    86 
       
    87         void ReadInfoFromResourceFileL();
       
    88 
       
    89         // Prohibit copy constructor if not deriving from CBase.
       
    90         CPosLmLocalGetSortedIdsOp(
       
    91             const CPosLmLocalGetSortedIdsOp&);
       
    92         // Prohibit assigment operator if not deriving from CBase.
       
    93         CPosLmLocalGetSortedIdsOp& operator=(
       
    94             const CPosLmLocalGetSortedIdsOp&);
       
    95 
       
    96 
       
    97     private:    // Data
       
    98 
       
    99         TPosLmSortPref iSortPref;
       
   100         CArrayFixSeg<TPosLmItemId>* iIdArray;
       
   101 
       
   102         TInt iStatusFlag;
       
   103         TInt iCurrent;
       
   104         TInt iIdBatchSize;
       
   105     };
       
   106 
       
   107 #endif /*EPOS_CPOSLMLOCALGETSORTEDIDSOP_H_*/