landmarksui/engine/inc/clmkdbsearchutils.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 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 "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:    LandmarksUi Content File -    This file contains search utilities to query the landmarks Db.
       
    15 *				 For example getting all landmarks under a category, Name of a
       
    16 *				 particular category etc.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 #ifndef CLMKDBSEARCHUTILS_H
       
    27 #define CLMKDBSEARCHUTILS_H
       
    28 
       
    29 //Include files
       
    30 #include "MLmkAOOperationObserver.h"
       
    31 
       
    32 // Forward declaration
       
    33 class CPosLandmark;
       
    34 class CPosLandmarkDatabase;
       
    35 class CPosLandmarkSearch;
       
    36 class CPosLmCategoryCriteria;
       
    37 class MLmkDbSearchUtilsObserver;
       
    38 class CLmkAOOperation;
       
    39 
       
    40 class CLmkDbSearchUtils : public CActive, public MLmkAOOperationObserver
       
    41 	{
       
    42 	public: // Constructors and destructor
       
    43 		/**
       
    44 		* Create CLmkDbSearchUtils object
       
    45 		*
       
    46 		*/
       
    47 		IMPORT_C static CLmkDbSearchUtils* NewL();
       
    48 
       
    49 		/**
       
    50 		* Destructor.
       
    51 		*/
       
    52 		IMPORT_C ~CLmkDbSearchUtils();
       
    53 
       
    54 	private:
       
    55 	    /**
       
    56 		* Default C++ constructor
       
    57 		*/
       
    58 		CLmkDbSearchUtils();
       
    59 
       
    60 		/*
       
    61 		* Symbian two phase constructor
       
    62 		*/
       
    63 		void ConstructL();
       
    64 
       
    65 	public:
       
    66 		/**
       
    67 		* Searches the db and gets the landmark under a mentioned
       
    68 		* category Id. This is a asynchronous request. The observers
       
    69 		* HandleSearchNotifyL is called when the search is complete
       
    70 		*
       
    71 		* @param aObserver observer to get the asynchronous callabck
       
    72 		* @param aCategoryId required category id
       
    73 		*/
       
    74 		IMPORT_C void GetLandmarksUnderCategoryL(MLmkDbSearchUtilsObserver* aObserver,
       
    75 									   			 TPosLmItemId aCategoryId );
       
    76         /**
       
    77         * Get the name of the required category.
       
    78         *
       
    79         * @param aCategoryId the category id whose name is required
       
    80         */
       
    81 	    IMPORT_C HBufC* GetCategoryNameL(TPosLmItemId aCategoryId);
       
    82 
       
    83 	    /**
       
    84 	    * Returns the CPosLandmark object for a particular landmark Id.
       
    85 	    *
       
    86 	    * @param aLandmarkId is the db id of the required landmark
       
    87 	    */
       
    88 	    IMPORT_C CPosLandmark* GetLandmarkForIdL(TPosLmItemId aLandmarkId);
       
    89 
       
    90 	    /**
       
    91 	    * Gets the landmarks whose item id's are specified in a asynchronus
       
    92 	    * way. The observer gets a callback once all the landmark objects
       
    93 	    * have been retreived.
       
    94 	    *
       
    95 	    * @param aObserver is the pointer to the observer which makes the request
       
    96 	    * @param aLmItemId is the Landmarks Item array which as the item id's
       
    97 	    * @param aArray is the out parameter which holds all the landmark objects
       
    98 	    */
       
    99 	    IMPORT_C void GetLandmarksL(MLmkDbSearchUtilsObserver* aObserver,
       
   100 	    							RArray<TPosLmItemId> aLmItemId,
       
   101 	    							RPointerArray<CPosLandmark>* aArray);
       
   102 
       
   103 	private: // From MLmkAOOperationObserver
       
   104 		/**
       
   105 		* Callback from
       
   106 		*/
       
   107 		void HandleOperationL(TOperationTypes aType,
       
   108 							  TReal32 aProgress,
       
   109 							  TInt aStatus );
       
   110 
       
   111 	private:// From CActive
       
   112 		void RunL();
       
   113 		void DoCancel();
       
   114 
       
   115 
       
   116 	private: // Data
       
   117 		/// Observer of the search
       
   118 		MLmkDbSearchUtilsObserver* iObserver;
       
   119 
       
   120 		//Owns:reference to the landmark database
       
   121 		CPosLandmarkDatabase* iDb;
       
   122 
       
   123 		//Owns:landmark search variable
       
   124 		CPosLandmarkSearch* iSearch;
       
   125 
       
   126 		// Owns:criteria for search
       
   127 		CPosLmCategoryCriteria* iCriteria;
       
   128 
       
   129 		// Owns:pointer to the search AO object
       
   130 		CLmkAOOperation* iSearchAO;
       
   131 
       
   132 		// Owns:Pointer to the array in which the landmark objects need to be pushed
       
   133 		RPointerArray<CPosLandmark>* iLmkArray;
       
   134 
       
   135 		// Array of landmark item id's which need to be obtained
       
   136 		RArray<TPosLmItemId> iLmItemId;
       
   137 
       
   138 		// Index to iLmItemId for the landmarks search
       
   139 		TInt iSearchIndex;
       
   140 	};
       
   141 
       
   142 #endif // CLMKDBSEARCHUTILS_H
       
   143 
       
   144