landmarks/locationlandmarks/localaccess/inc/EPos_CPosLmLocalAddCatToLmOp.h
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2005 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 adding a category to a set of landmarks.
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CPOSLMLOCALADDCATTOLMOP_H
       
    22 #define CPOSLMLOCALADDCATTOLMOP_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <EPos_Landmarks.h>
       
    26 #include "EPos_CPosLmLocalModifyOp.h"
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * Operation for adding a category to a set of landmarks. This operation can be
       
    36 * either synchronous or asynchronous.
       
    37 *
       
    38 *  @lib eposlmlocalaccess.lib
       
    39 */
       
    40 NONSHARABLE_CLASS(CPosLmLocalAddCatToLmOp) : public CPosLmLocalModifyOp
       
    41     {
       
    42 
       
    43     public:  // Constructors and destructor
       
    44 
       
    45         /**
       
    46         * Two-phased constructor.
       
    47         * @param aDb A landmark database.
       
    48         * @param aCategoryId The category to add to the set of landmarks.
       
    49         * @param aLandmarkIdArray The landmarks to add the category to.
       
    50         */
       
    51         static CPosLmLocalAddCatToLmOp* NewL(
       
    52         /* IN */        CPosLmLocalDatabase& aDb,
       
    53         /* IN */        TPosLmItemId aCategoryId,
       
    54         /* IN */        RArray<TPosLmItemId>& aLandmarkIdArray
       
    55         );
       
    56 
       
    57         /**
       
    58         * Destructor.
       
    59         */
       
    60         virtual ~CPosLmLocalAddCatToLmOp();
       
    61 
       
    62     public: // Functions from base classes
       
    63 
       
    64         /**
       
    65         * From CPosLmLocalModifyOp.
       
    66         *
       
    67         * @param aProgress The current progress.
       
    68         */
       
    69         void DoNextStepPreL(
       
    70         /* OUT */       TReal32& aProgress
       
    71         );
       
    72 
       
    73         /**
       
    74         * From CPosLmLocalModifyOp.
       
    75         *
       
    76         * @param aProgress The current progress.
       
    77         * @return ETrue if a begin transaction should be made. EFalse otherwise.
       
    78         */
       
    79         TBool DoNextStepPostL(
       
    80         /* OUT */       TReal32& aProgress
       
    81         );
       
    82 
       
    83         /**
       
    84         * From CPosLmLocalModifyOp.
       
    85         *
       
    86         * @return Current step size.
       
    87         */
       
    88         TReal32 Step();
       
    89 
       
    90         /**
       
    91         * From CPosLmLocalModifyOp.
       
    92         *
       
    93         * @param aResourceId A resource id.
       
    94         * @param aNoOfSubOperations A number of sub operations.
       
    95         */
       
    96         void CheckResourceValue(
       
    97         /* IN */    TInt aResourceId,
       
    98         /* IN */    TInt aNoOfSubOperations
       
    99         );
       
   100 
       
   101         /**
       
   102         * From CPosLmLocalOperation;
       
   103         *
       
   104         * @param aError An error code generated by NextStepL.
       
   105         */
       
   106         void HandleError(
       
   107         /* IN/OUT */    TInt& aError
       
   108         );
       
   109 
       
   110     private:
       
   111 
       
   112         /**
       
   113         * C++ default constructor.
       
   114         * @param aDb A landmark db.
       
   115         */
       
   116         CPosLmLocalAddCatToLmOp(
       
   117         /* IN */        CPosLmLocalDatabase& aDb
       
   118 
       
   119         );
       
   120 
       
   121         /**
       
   122         * By default Symbian 2nd phase constructor is private.
       
   123         * @param aLandmarkIdArray The landmarks to add the category to.
       
   124         * @param aCategoryId The category to add to the set of landmarks.
       
   125         */
       
   126         void ConstructL(
       
   127         /* IN */        RArray<TPosLmItemId>& aLandmarkIdArray,
       
   128         /* IN */        TPosLmItemId aCategoryId
       
   129         );
       
   130 
       
   131         /**
       
   132         * Rollback if in transaction and generate an event.
       
   133         * @param aProgress Current progress.
       
   134         */
       
   135         void RollbackAndGenerateEventIfNeeded(
       
   136         /* IN */        TReal32 aProgress
       
   137         );
       
   138 
       
   139         /**
       
   140         * Generates an event.
       
   141         * @param aProgress Current progress.
       
   142         * @return KErrNone if successful. Otherwise any system-wide error code.
       
   143         */
       
   144         TInt GenerateEventIfNeeded(
       
   145         /* IN */        TReal32 aProgress
       
   146         );
       
   147 
       
   148         // Prohibit copy constructor if not deriving from CBase.
       
   149         CPosLmLocalAddCatToLmOp(const CPosLmLocalAddCatToLmOp&);
       
   150         // Prohibit assigment operator if not deriving from CBase.
       
   151         CPosLmLocalAddCatToLmOp& operator=(const CPosLmLocalAddCatToLmOp&);
       
   152 
       
   153     private:    // Data
       
   154 
       
   155         // The category to add to the set of landmarks.
       
   156         RArray<TPosLmItemId> iCategory;
       
   157 
       
   158         // The landmarks to add the category to.
       
   159         RArray<TPosLmItemId> iLandmarkIdArray;
       
   160 
       
   161         // The current landmark handled in the id array.
       
   162         TInt iCurrent;
       
   163 
       
   164     };
       
   165 
       
   166 #endif      // CPOSLMLOCALADDCATTOLMOP_H
       
   167 
       
   168 // End of File