|
1 /* |
|
2 * Copyright (c) 2010 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: Header file for mylocation database lookup table. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MYLOCATIONSLOOKUPDB_H__ |
|
19 #define __MYLOCATIONSLOOKUPDB_H__ |
|
20 |
|
21 //Headers needed |
|
22 #include <f32file.h> //RFs |
|
23 #include <d32dbms.h> //RDbNamedDatabase,RDbView |
|
24 |
|
25 #include "mylocationsdefines.h" |
|
26 |
|
27 /** |
|
28 * CLookupDatabase class. |
|
29 * This class handles all the operations related to mylocations lookup database. |
|
30 * |
|
31 */ |
|
32 |
|
33 class CLookupDatabase : public CBase |
|
34 { |
|
35 public: |
|
36 // Two phase constructors |
|
37 |
|
38 /** |
|
39 * This is a static function, which creates and returns an instance of this class. |
|
40 */ |
|
41 static CLookupDatabase* NewL( const TDesC& aLookupTableName ); |
|
42 |
|
43 /** |
|
44 * This is a static function, which creates and returns an instance of this class. Pushes the created object |
|
45 * to the cleanup stack. |
|
46 */ |
|
47 static CLookupDatabase* NewLC( const TDesC& aLookupTableName ); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
|
52 ~CLookupDatabase(); |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Opens the lookup database. |
|
58 */ |
|
59 TInt Open(); |
|
60 |
|
61 /** |
|
62 * Closes the lookup database. |
|
63 */ |
|
64 void Close(); |
|
65 |
|
66 /** |
|
67 * Creates an entry in the lookup table. |
|
68 * @param[in] aLookupItem The lookup item to be created in the database. |
|
69 */ |
|
70 void CreateEntryL( const TLookupItem& aLookupItem ); |
|
71 |
|
72 /** |
|
73 * Updates an entry in the lookup table. |
|
74 * @param[in] aLookupItem The lookup item to be updated in the database. |
|
75 */ |
|
76 void UpdateEntryL( const TLookupItem& aLookupItem ); |
|
77 |
|
78 /** |
|
79 * Deletes an entry from the lookup table. |
|
80 * @param[in] aLookupItem The lookup item to be deleted from the database. |
|
81 */ |
|
82 void DeleteEntryL( const TLookupItem& aLookupItem ); |
|
83 |
|
84 /** |
|
85 * Finds an entry in the lookup table. |
|
86 * @param[in/out] aLookupItem The lookup item to be found in the database. The source iUid and source type |
|
87 * iSource is passed in the lookup item, if the entry is found, then the iLmId is copied to the lookup item |
|
88 * @return ETrue if found, else EFalse |
|
89 */ |
|
90 TBool FindEntryL( TLookupItem& aLookupItem ); |
|
91 |
|
92 /** |
|
93 * Finds list of lookup items given a landmark id. |
|
94 * @param[in] aLandmarkId The landmark id to be found in the lookup database. |
|
95 * @param[out] aLookupItemArray List of lookup entried found. |
|
96 */ |
|
97 void FindEntriesByLandmarkIdL( const TUint32 aLandmarkId, |
|
98 RArray<TLookupItem>& aLookupItemArray ); |
|
99 |
|
100 /** |
|
101 * Finds list of lookup items given a source type. |
|
102 * @param[in] aSourceType The source type to be found in the lookup database. |
|
103 * @param[out] aLookupItemArray List of lookup entried found. |
|
104 */ |
|
105 void FindEntriesBySourceTypeL( const TUint32 aSourceType, |
|
106 RArray<TLookupItem>& aLookupItemArray ); |
|
107 |
|
108 |
|
109 |
|
110 private: |
|
111 |
|
112 // default constructor |
|
113 CLookupDatabase(); |
|
114 |
|
115 // Second phase constructor |
|
116 void ConstructL( const TDesC& aLookupTableName ); |
|
117 |
|
118 // Creates a lookup table in the lookup database. |
|
119 void CreateTableL(RDbDatabase& aDatabase); |
|
120 |
|
121 private: |
|
122 |
|
123 // Handle to the items database |
|
124 RDbNamedDatabase iItemsDatabase; |
|
125 |
|
126 // handle to the file session |
|
127 RFs iFsSession; |
|
128 |
|
129 // holds the database file name |
|
130 TFileName iDbFileName; |
|
131 |
|
132 }; |
|
133 |
|
134 |
|
135 #endif // __MYLOCATIONSLOOKUP_H__ |
|
136 |
|
137 // End of file |
|
138 |