serviceproviders/sapi_landmarks/landmarksservice/inc/clandmarkmanagehandlers.h
changeset 5 989d2f495d90
child 26 5d0ec8b709be
equal deleted inserted replaced
1:a36b1e19a461 5:989d2f495d90
       
     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:  CLandmarkManageHandlers class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CLANDMARKMANAGEHANDLERS_H__
       
    20 #define __CLANDMARKMANAGEHANDLERS_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <e32cmn.h>
       
    25 
       
    26 //FORWARD DECLARARTION
       
    27 class CPosLandmarkDatabase;
       
    28 class CPosLmCategoryManager;
       
    29 class CPosLandmarkSearch;
       
    30 class CLandmarkHandler;
       
    31 
       
    32 /**
       
    33  * CLandmarkManageHandlers
       
    34  * This class maintains a list of handles to different databases.
       
    35  */
       
    36 // CLASS DECLARATION
       
    37 NONSHARABLE_CLASS(CLandmarkManageHandlers): public CBase
       
    38 	{
       
    39 public: // New methods
       
    40 
       
    41 	/**
       
    42 	 * NewL.
       
    43 	 * Two-phased constructor.
       
    44 	 * Create a CPosLmManageHandle object.	
       
    45 	 * @return A pointer to the newly created instance of CLandmarkManageHandlers.	
       
    46 	 */
       
    47 	static CLandmarkManageHandlers* NewL();
       
    48 
       
    49 	/**
       
    50 	 * ~CPosLmManageHandle
       
    51 	 * Destructor.
       
    52 	 */
       
    53 	~CLandmarkManageHandlers();
       
    54 
       
    55 public: // Functions to create, return and destroy handle
       
    56 
       
    57 	/**
       
    58 	 * CreateHandlerL
       
    59 	 * This creates and returns CLandmarkHandler instance.
       
    60 	 * @param aDatabaseUri The URI of the database to be opened.
       
    61 	 * @return A pointer to the newly created instance of CLandmarkHandler.
       
    62 	 */
       
    63 	CLandmarkHandler* CreateHandlerL( const TDesC& aDatabaseUri );
       
    64 
       
    65 	/**
       
    66 	 * GetHandlerL
       
    67 	 * This returns CLandmarkHandler instance.
       
    68 	 * @param aDatabaseUri The URI of the database to be opened.
       
    69 	 * @return A pointer to an existing instance of CLandmarkHandler.
       
    70 	 */
       
    71 	CLandmarkHandler* GetHandlerL( const TDesC& aDatabaseUri );
       
    72 
       
    73 	/**
       
    74 	 * CloseHandler
       
    75 	 * This destroys CLandmarkHandler instance.
       
    76 	 * @param aHandler The CLandmarkHandler instance to be destroyed.
       
    77 	 */
       
    78 	void CloseHandler( CLandmarkHandler* aHandler );
       
    79 
       
    80 	/**
       
    81 	 * SetDefaultHandler
       
    82 	 * This changes the default handle managed by this class.
       
    83 	 * @param aHandler The CLandmarkHandler instance to be set as default.
       
    84 	 */
       
    85 	void SetDefaultHandler( CLandmarkHandler* aHandler );
       
    86 
       
    87 private: // Constructors
       
    88 
       
    89 	/**
       
    90 	 * CLandmarkManageHandlers.
       
    91 	 * C++ default constructor.
       
    92 	 */
       
    93 	CLandmarkManageHandlers();
       
    94 
       
    95 private: // Data members
       
    96 
       
    97 	/**
       
    98 	 * iHandlers
       
    99 	 * Array of CLandmarkHandler instances to all open databases.
       
   100 	 */
       
   101 	RPointerArray <CLandmarkHandler> iHandlers;
       
   102 
       
   103 	/**
       
   104 	 * iDefaultHandler
       
   105 	 * CLandmarkHandler instance to the default database.
       
   106 	 */
       
   107 	CLandmarkHandler* iDefaultHandler;
       
   108 	};
       
   109 
       
   110 /**
       
   111  * CLandmarkHandler
       
   112  * This class maintains a handle to an open database as well as the CPosLmCategoryManager
       
   113  * handle and CPosLandmarkSearch handle associated with the CPosLandmarkDatabase
       
   114  * database.
       
   115  */
       
   116 // CLASS DECLARATION
       
   117 NONSHARABLE_CLASS(CLandmarkHandler): public CBase
       
   118 	{
       
   119 public: // New methods
       
   120 
       
   121 	/**
       
   122 	 * CreateL.
       
   123 	 * Two-phased constructor.
       
   124 	 * Create a CLandmarkHandler object.
       
   125 	 * @param aDatabaseUri The URI of the database to be opened.
       
   126 	 * @return A pointer to the created instance of CLandmarkHandler.
       
   127 	 */
       
   128 	static CLandmarkHandler* CreateL( const TDesC& aDatabaseUri );
       
   129 
       
   130 	/**
       
   131 	 * ~CLandmarkHandler
       
   132 	 * Destructor.
       
   133 	 */
       
   134 	~CLandmarkHandler();
       
   135 
       
   136 public: // Functions to retrieve data members
       
   137 
       
   138 	/**
       
   139 	 * LandmarkDatabaseHandle.
       
   140 	 * @return The handle to CPosLandmarkDatabase instance.
       
   141 	 */
       
   142 	inline CPosLandmarkDatabase* LandmarkDatabaseHandle ();
       
   143 
       
   144 	/**
       
   145 	 * CategoryManagerHandle.
       
   146 	 * @return The handle to CPosLmCategoryManager instance.
       
   147 	 */
       
   148 	inline CPosLmCategoryManager* CategoryManagerHandle ();
       
   149 
       
   150 	/**
       
   151 	 * LandmarkSearchHandle.
       
   152 	 * @return The handle to CPosLandmarkSearch instance.
       
   153 	 */
       
   154 	inline CPosLandmarkSearch* LandmarkSearchHandle ();
       
   155 
       
   156 	/**
       
   157 	 * GetDatabaseUri.
       
   158 	 * @param aDatabaseUri The URI of the open CPosLandmarkDatabase.
       
   159 	 */
       
   160 	inline void GetDatabaseUri( TPtrC& aDatabaseUri ) const;
       
   161 
       
   162 	/**
       
   163 	 * InitL.
       
   164 	 * This initializes the CPosLandmarkDatabase if required.
       
   165 	 */
       
   166 	void InitL();
       
   167 
       
   168 private: // Constructors
       
   169 
       
   170 	/**
       
   171 	 * ConstructL
       
   172 	 * 2nd phase constructor.
       
   173 	 * Perform the second phase construction of a
       
   174 	 * CLandmarkHandler object.
       
   175 	 * @param aDatabaseUri The URI of the CPosLandmarkDatabase to be opened.
       
   176 	 */
       
   177 	void ConstructL(const TDesC& aDatabaseUri);
       
   178 
       
   179 	/**
       
   180 	 * CLandmarkHandler.
       
   181 	 * C++ default constructor.
       
   182 	 */
       
   183 	CLandmarkHandler();
       
   184 
       
   185 private: // Data members
       
   186 
       
   187 	/**
       
   188 	 * iDatabaseUri
       
   189 	 * The URI of the open CPosLandmarkDatabase.
       
   190 	 */
       
   191 	HBufC* iDatabaseUri;
       
   192 
       
   193 	/**
       
   194 	 * iLandmarkDatabaseHandle
       
   195 	 * The handle to the open CPosLandmarkDatabase.
       
   196 	 */
       
   197 	CPosLandmarkDatabase* iLandmarkDatabaseHandle;
       
   198 
       
   199 	/**
       
   200 	 * iLmCategoryManagerHandle
       
   201 	 * The handle to the CPosLmCategoryManager of the database.
       
   202 	 */
       
   203 	CPosLmCategoryManager* iLmCategoryManagerHandle;
       
   204 
       
   205 	/**
       
   206 	 * iLandmarkSearchHandle
       
   207 	 * The handle to the CPosLandmarkSearch of the database.
       
   208 	 */
       
   209 	CPosLandmarkSearch* iLandmarkSearchHandle;
       
   210 	};
       
   211 
       
   212 #include "clandmarkhandler.inl"
       
   213 
       
   214 #endif // __CLANDMARKMANAGEHANDLERS_H__
       
   215 
       
   216 // End of File