serviceproviders/sapi_landmarks/landmarksservice/inc/clandmarkoperation.h
changeset 26 5d0ec8b709be
equal deleted inserted replaced
23:50974a8b132e 26:5d0ec8b709be
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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 the License "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:  CLandmarkCmdGetLandmarks class
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef CLANDMARKCMDLINKCATEGORIES_H_
       
    19 #define CLANDMARKCMDLINKCATEGORIES_H_
       
    20 
       
    21 // INCLUDES
       
    22 #include "clandmarkcmdbase.h"
       
    23 #include <EPos_Landmarks.h>
       
    24 
       
    25 class CPosLmCategoryManager;
       
    26 class MLandmarkObserver;
       
    27 class CLandmarkManageObjects;
       
    28 class CLandmarkHandler;
       
    29 class CPosLandmarkParser;
       
    30 class CPosLandmarkEncoder;
       
    31 class CPosLandmarkDatabase;
       
    32 /**
       
    33  * CLandmarkOperation
       
    34  * This class processes the async request for retrieval of landmark categories from the landmark
       
    35  * database. It implements the StartL ( CLandmarkHandler* aHandle, TInt32 aTransactionId, CLandmarkFilter* aFilter )
       
    36  * of CLandmarkCmdBase. After completion of the aynchronous request the MLandmarkObserver instance is notified
       
    37  * and the garbage collector is set active.
       
    38  */
       
    39 // CLASS DECLARATION
       
    40 NONSHARABLE_CLASS(CLandmarkOperation) : public CActive
       
    41 	{
       
    42 public:
       
    43 	enum TOperation
       
    44 		{
       
    45 		EOrganise,
       
    46 		EImport,
       
    47 		EExport,
       
    48 		};
       
    49 public:
       
    50 	// New methods
       
    51 
       
    52 	/**
       
    53 	 * NewL.
       
    54 	 * Two-phased constructor.
       
    55 	 * Create a CLandmarkOperation object.
       
    56 	 * @param aObserver The pointer to the observer for this object.
       
    57 	 * @param aManageObjects The pointer to the garbage collector.
       
    58 	 * @return A pointer to the created instance of CLandmarkOperation.
       
    59 	 */
       
    60 	static CLandmarkOperation* NewL(MLandmarkObserver* aObserver,
       
    61 			CLandmarkManageObjects* aManageObjects);
       
    62 
       
    63 	/**
       
    64 	 * NewLC.
       
    65 	 * Two-phased constructor.
       
    66 	 * Create a CLandmarkOperation object.
       
    67 	 * @param aObserver The pointer to the observer for this object.
       
    68 	 * @param aManageObjects The pointer to the garbage collector.
       
    69 	 * @return A pointer to the created instance of CLandmarkOperation.
       
    70 	 */
       
    71 	static CLandmarkOperation* NewLC(MLandmarkObserver* aObserver,
       
    72 			CLandmarkManageObjects* aManageObjects);
       
    73 
       
    74 	/**
       
    75 	 * ~CLandmarkOperation
       
    76 	 * Destructor.
       
    77 	 */
       
    78 	~CLandmarkOperation();
       
    79 
       
    80 public:
       
    81 	// From CLandmarkCmdBase
       
    82 
       
    83 	// This functions proceeds with the incremental search.
       
    84 	void LinkL(TInt32 aTransactionId, TPosLmItemId aCategoryId, RArray<
       
    85 			TPosLmItemId>& aLandmarkIdArray,
       
    86 			CPosLmCategoryManager* aCategoryManager);
       
    87 
       
    88 	void UnLinkL(TInt32 aTransactionId, TPosLmItemId aCategoryId, RArray<
       
    89 			TPosLmItemId>& aLandmarkIdArray,
       
    90 			CPosLmCategoryManager* aCategoryManager);
       
    91 	
       
    92 	void ImportL(TInt32 aTransactionId, CLandmarkHandler* aHandle, 
       
    93 			CPosLandmarkParser& aLandmarkParser);
       
    94 	
       
    95 	void ExportL(TInt32 aTransactionId, CPosLandmarkDatabase* aDatabase, 
       
    96 			CPosLandmarkEncoder& aLandmarkEncoder,
       
    97 			const RArray<TPosLmItemId>& aLandmarkIdArray,
       
    98 			const TDesC& aDestinationFile);
       
    99 
       
   100 	TInt32 TransactionId()
       
   101 		{
       
   102 		return iTransactionId;
       
   103 		}
       
   104 
       
   105 private:
       
   106 
       
   107 	/**
       
   108 	 * NextStep
       
   109 	 * This functions proceeds with the incremental search.
       
   110 	 */
       
   111 	void NextStep();
       
   112 
       
   113 private:
       
   114 	// From CActive
       
   115 
       
   116 	// RunL.
       
   117 	// This functions gets called after completion of async request.
       
   118 	void RunL();
       
   119 
       
   120 	// DoCancel.
       
   121 	// This function will cancel ongoing async call.
       
   122 	void DoCancel();
       
   123 	
       
   124 	TInt RunError(TInt aError);
       
   125 
       
   126 private:
       
   127 	// Constructors
       
   128 
       
   129 	/**
       
   130 	 * CLandmarkOperation.
       
   131 	 * C++ default constructor.
       
   132 	 * @param aObserver The pointer to the observer for this object.
       
   133 	 * @param aManageObjects The pointer to the garbage collector.
       
   134 	 */
       
   135 	CLandmarkOperation(MLandmarkObserver* aObserver,
       
   136 			CLandmarkManageObjects* aManageObjects);
       
   137 
       
   138 private:
       
   139 	/**
       
   140 	 * iTransactionId
       
   141 	 * The tranaction id assigned to aync request.
       
   142 	 */
       
   143 	TInt32 iTransactionId;
       
   144 
       
   145 	/**
       
   146 	 * iObserver
       
   147 	 * The handle to the MLandmarkObserver.
       
   148 	 */
       
   149 	MLandmarkObserver* iObserver;
       
   150 
       
   151 	/**
       
   152 	 * iOperation
       
   153 	 * The handle to the CPosLmOperation.
       
   154 	 */
       
   155 	CPosLmOperation* iOperation; //owned
       
   156 
       
   157 	/**
       
   158 	 * iManageObjects
       
   159 	 * The handle to the garbage collector.
       
   160 	 */
       
   161 	CLandmarkManageObjects* iManageObjects;
       
   162 
       
   163 	/**
       
   164 	 * iProgress
       
   165 	 * To keep track of search progress.
       
   166 	 */
       
   167 	TReal32 iProgress;
       
   168 	CLandmarkHandler* iHandle;
       
   169 	CPosLandmarkEncoder* iEncoder; //owned
       
   170 	CPosLandmarkParser* iParser;//owned
       
   171 	HBufC* iDestinationFile;
       
   172 	CBufBase* iExportBuffer; //owned
       
   173 	
       
   174 	TOperation iOperationType;
       
   175 
       
   176 	};
       
   177 
       
   178 #endif /* CLANDMARKCMDLINKCATEGORIES_H_ */