|
1 /* |
|
2 * Copyright (c) 2008 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: Handles native landmark databases |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CLAPILANDMARKSTOREMANAGER_H |
|
20 #define CLAPILANDMARKSTOREMANAGER_H |
|
21 |
|
22 // EXTERNAL INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CPosLmDatabaseManager; |
|
29 class CLAPILandmarkStore; |
|
30 |
|
31 /** |
|
32 * Handles native landmark stores |
|
33 * |
|
34 * Wrapper class for CPosLmDatabaseManager. This class handles native landmark |
|
35 * stores (i.e. opens, creates and deletes them and provides an access to list |
|
36 * the databases via the JSR-179 Location API) |
|
37 * |
|
38 * The manager keeps track of the opened stores and closes an opened store |
|
39 * if the client ties to delete it. It is also possible to list available |
|
40 * landmark stores via this class |
|
41 * |
|
42 * @lib N/A |
|
43 * @since S60 3.2 |
|
44 */ |
|
45 NONSHARABLE_CLASS(CLAPILandmarkStoreManager) : public CBase |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. Creates an instance from this class |
|
51 * The caller takes the ownership of the returned instance |
|
52 * @return New instance from this class |
|
53 */ |
|
54 static CLAPILandmarkStoreManager* NewL(); |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. Creates an instance from this class |
|
58 * The caller takes the ownership of the returned instance which |
|
59 * is left to the cleanup stack |
|
60 * @return New instance from this class |
|
61 */ |
|
62 static CLAPILandmarkStoreManager* NewLC(); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CLAPILandmarkStoreManager(); |
|
68 |
|
69 public: // New functions |
|
70 |
|
71 /** |
|
72 * Lists all landmark stores which are available in the file system |
|
73 * of the device. External landmark stores and the default store |
|
74 * are not included in the array |
|
75 * |
|
76 * @return Array of non-default landmark stores. The caller takes |
|
77 * the ownership of the returned value |
|
78 */ |
|
79 CDesCArray* LandmarkStoresL(); |
|
80 |
|
81 /** |
|
82 * Opens an existing landmark store. The store URI points the |
|
83 * path where the store is so it should be in the following form |
|
84 * - <schema>://<path> |
|
85 * - <drive letter>:<path> |
|
86 * This function will leave if there is no database in the specified URI |
|
87 * or if the URI of the database is not correct |
|
88 * |
|
89 * The caller takes the ownership of the opened store object |
|
90 * |
|
91 * @param aStoreUri URI where the store lies |
|
92 * @return A pointer to the opened store. The ownership is transferred |
|
93 * to the caller |
|
94 */ |
|
95 CLAPILandmarkStore* OpenStoreL(const TDesC& aStoreUri = KNullDesC); |
|
96 |
|
97 /** |
|
98 * Creates a landmark store to the specified URI. Note that the |
|
99 * URI must be in one of the following forms: |
|
100 * - <schema>://<path> |
|
101 * - <drive letter>:<path> |
|
102 * |
|
103 * The operation leaves with KErrAlreadyExists if there is a store |
|
104 * in the specified URI |
|
105 * |
|
106 * @param aStoreUri URI where the store should be created |
|
107 */ |
|
108 void CreateStoreL(const TDesC& aStoreUri); |
|
109 |
|
110 /** |
|
111 * Removes an existing landmark database from the specified URI |
|
112 * Note that the URI must be in one of the following forms: |
|
113 * - <schema>://<path> |
|
114 * - <drive letter>:<path> |
|
115 * |
|
116 * Note that any open stores will be closed and are not usable |
|
117 * any more. All operations to a closed store will leave with |
|
118 * KErrSessionClosed |
|
119 * |
|
120 * @param aStoreUri URI where the store lies |
|
121 */ |
|
122 void DeleteStoreL(const TDesC& aStoreUri); |
|
123 |
|
124 /** |
|
125 * Removes a landmark store native side peer from this class |
|
126 * The object will not be deleted since it is owned by its |
|
127 * Java side counterpart |
|
128 * |
|
129 * @param aLandmarkStore The landmark store object which should be |
|
130 * removed |
|
131 */ |
|
132 void RemoveStore(CLAPILandmarkStore& aLandmarkStore); |
|
133 |
|
134 protected: // Constructors |
|
135 |
|
136 /** |
|
137 * Default C++ constructor |
|
138 */ |
|
139 CLAPILandmarkStoreManager(); |
|
140 |
|
141 /** |
|
142 * Second phase constructor |
|
143 */ |
|
144 void ConstructL(); |
|
145 |
|
146 private: // Data |
|
147 |
|
148 // Database manager. Owned |
|
149 CPosLmDatabaseManager* iLmDbManager; |
|
150 // Array of landmark stores. The objects are NOT owned |
|
151 RPointerArray< CLAPILandmarkStore> iStores; |
|
152 |
|
153 }; |
|
154 |
|
155 #endif // CLAPILANDMARKSTOREMANAGER_H |
|
156 // End of file |