williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
3 |
* All rights reserved.
|
williamr@4
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
8 |
*
|
williamr@4
|
9 |
* Initial Contributors:
|
williamr@4
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@4
|
11 |
*
|
williamr@4
|
12 |
* Contributors:
|
williamr@4
|
13 |
*
|
williamr@4
|
14 |
* Description: HPosLmDatabaseInfo class
|
williamr@4
|
15 |
*
|
williamr@4
|
16 |
*/
|
williamr@4
|
17 |
|
williamr@4
|
18 |
|
williamr@4
|
19 |
|
williamr@4
|
20 |
#ifndef HPOSLMDATABASEINFO_H
|
williamr@4
|
21 |
#define HPOSLMDATABASEINFO_H
|
williamr@4
|
22 |
|
williamr@4
|
23 |
#include <e32base.h>
|
williamr@4
|
24 |
#include <f32file.h>
|
williamr@4
|
25 |
#include "EPos_TPosLmDatabaseSettings.h"
|
williamr@4
|
26 |
|
williamr@4
|
27 |
/**
|
williamr@4
|
28 |
* @ref HPosLmDatabaseInfo encapsulates information about a landmark database.
|
williamr@4
|
29 |
*
|
williamr@4
|
30 |
* @lib eposlmdbmanlib.lib
|
williamr@4
|
31 |
* @since S60 3.0
|
williamr@4
|
32 |
*/
|
williamr@4
|
33 |
class HPosLmDatabaseInfo
|
williamr@4
|
34 |
{
|
williamr@4
|
35 |
public:
|
williamr@4
|
36 |
|
williamr@4
|
37 |
/**
|
williamr@4
|
38 |
* Two-phased constructor.
|
williamr@4
|
39 |
*
|
williamr@4
|
40 |
* @param[in] aDatabaseUri The URI of the landmark database.
|
williamr@4
|
41 |
* @return A new instance of this class.
|
williamr@4
|
42 |
*/
|
williamr@4
|
43 |
IMPORT_C static HPosLmDatabaseInfo* NewLC( const TDesC& aDatabaseUri );
|
williamr@4
|
44 |
|
williamr@4
|
45 |
/**
|
williamr@4
|
46 |
* Two-phased constructor.
|
williamr@4
|
47 |
*
|
williamr@4
|
48 |
* @param[in] aDatabaseUri The URI of the landmark database.
|
williamr@4
|
49 |
* @return A new instance of this class.
|
williamr@4
|
50 |
*/
|
williamr@4
|
51 |
IMPORT_C static HPosLmDatabaseInfo* NewL( const TDesC& aDatabaseUri );
|
williamr@4
|
52 |
|
williamr@4
|
53 |
/**
|
williamr@4
|
54 |
* Two-phased copy constructor.
|
williamr@4
|
55 |
*
|
williamr@4
|
56 |
* @param[in] aDatabaseInfo The information instance to copy.
|
williamr@4
|
57 |
* @return A new instance of this class.
|
williamr@4
|
58 |
*/
|
williamr@4
|
59 |
IMPORT_C static HPosLmDatabaseInfo* NewLC(
|
williamr@4
|
60 |
const HPosLmDatabaseInfo& aDatabaseInfo
|
williamr@4
|
61 |
);
|
williamr@4
|
62 |
|
williamr@4
|
63 |
/**
|
williamr@4
|
64 |
* Two-phased copy constructor.
|
williamr@4
|
65 |
*
|
williamr@4
|
66 |
* @param[in] aDatabaseInfo The information instance to copy.
|
williamr@4
|
67 |
* @return A new instance of this class.
|
williamr@4
|
68 |
*/
|
williamr@4
|
69 |
IMPORT_C static HPosLmDatabaseInfo* NewL(
|
williamr@4
|
70 |
const HPosLmDatabaseInfo& aDatabaseInfo
|
williamr@4
|
71 |
);
|
williamr@4
|
72 |
|
williamr@4
|
73 |
|
williamr@4
|
74 |
public:
|
williamr@4
|
75 |
|
williamr@4
|
76 |
/**
|
williamr@4
|
77 |
* Retrieves the database URI.
|
williamr@4
|
78 |
*
|
williamr@4
|
79 |
* @return A pointer to the URI descriptor. This pointer is valid until
|
williamr@4
|
80 |
* the @ref HPosLmDatabaseInfo object is destroyed.
|
williamr@4
|
81 |
*/
|
williamr@4
|
82 |
IMPORT_C TPtrC DatabaseUri() const;
|
williamr@4
|
83 |
|
williamr@4
|
84 |
/**
|
williamr@4
|
85 |
* Returns the protocol part from the URI which is set.
|
williamr@4
|
86 |
*
|
williamr@4
|
87 |
* Example: If the URI is "file://c:landmarks.ldb" then the protocol is
|
williamr@4
|
88 |
* "file".
|
williamr@4
|
89 |
*
|
williamr@4
|
90 |
* If no protocol is specified, an empty descriptor is returned. This
|
williamr@4
|
91 |
* implies "file" protocol.
|
williamr@4
|
92 |
*
|
williamr@4
|
93 |
* @return A pointer to the protocol descriptor. This pointer is valid
|
williamr@4
|
94 |
* until the @ref HPosLmDatabaseInfo object is destroyed.
|
williamr@4
|
95 |
*/
|
williamr@4
|
96 |
IMPORT_C TPtrC Protocol() const;
|
williamr@4
|
97 |
|
williamr@4
|
98 |
/**
|
williamr@4
|
99 |
* Returns whether the database is the default database.
|
williamr@4
|
100 |
*
|
williamr@4
|
101 |
* Note: that this attribute is only set if the @ref HPosLmDatabaseInfo
|
williamr@4
|
102 |
* instance has been returned from a @ref CPosLmDatabaseManager
|
williamr@4
|
103 |
* function, e.g. @ref CPosLmDatabaseManager::ListDatabasesL,
|
williamr@4
|
104 |
* @ref CPosLmDatabaseManager::GetDatabaseInfoL,
|
williamr@4
|
105 |
* @ref CPosLmDatabaseManager::RegisterDatabaseL,
|
williamr@4
|
106 |
* @ref CPosLmDatabaseManager::CreateDatabaseL or
|
williamr@4
|
107 |
* @ref CPosLmDatabaseManager::ModifyDatabaseSettingsL. If not, this
|
williamr@4
|
108 |
* function returns @p EFalse.
|
williamr@4
|
109 |
*
|
williamr@4
|
110 |
* @return @p ETrue if the database is the default one, otherwise @p EFalse.
|
williamr@4
|
111 |
*/
|
williamr@4
|
112 |
IMPORT_C TBool IsDefault() const;
|
williamr@4
|
113 |
|
williamr@4
|
114 |
/**
|
williamr@4
|
115 |
* Returns which storage media the database resides in.
|
williamr@4
|
116 |
*
|
williamr@4
|
117 |
* Note: this attribute is only set if the @ref HPosLmDatabaseInfo
|
williamr@4
|
118 |
* instance has been returned from a @ref CPosLmDatabaseManager
|
williamr@4
|
119 |
* function, e.g. @ref CPosLmDatabaseManager::ListDatabasesL,
|
williamr@4
|
120 |
* @ref CPosLmDatabaseManager::GetDatabaseInfoL,
|
williamr@4
|
121 |
* @ref CPosLmDatabaseManager::RegisterDatabaseL,
|
williamr@4
|
122 |
* @ref CPosLmDatabaseManager::CreateDatabaseL or
|
williamr@4
|
123 |
* @ref CPosLmDatabaseManager::ModifyDatabaseSettingsL. If not, this
|
williamr@4
|
124 |
* function returns @p EMediaUnknown.
|
williamr@4
|
125 |
*
|
williamr@4
|
126 |
* @return The storage media the database resides in.
|
williamr@4
|
127 |
*/
|
williamr@4
|
128 |
IMPORT_C TMediaType DatabaseMedia() const;
|
williamr@4
|
129 |
|
williamr@4
|
130 |
/**
|
williamr@4
|
131 |
* Returns which database drive the database resides in.
|
williamr@4
|
132 |
*
|
williamr@4
|
133 |
* Note: that this attribute is only set if the @ref HPosLmDatabaseInfo
|
williamr@4
|
134 |
* instance has been returned from a @ref CPosLmDatabaseManager
|
williamr@4
|
135 |
* function, e.g. @ref CPosLmDatabaseManager::ListDatabasesL,
|
williamr@4
|
136 |
* @ref CPosLmDatabaseManager::GetDatabaseInfoL,
|
williamr@4
|
137 |
* @ref CPosLmDatabaseManager::RegisterDatabaseL,
|
williamr@4
|
138 |
* @ref CPosLmDatabaseManager::CreateDatabaseL or
|
williamr@4
|
139 |
* @ref CPosLmDatabaseManager::ModifyDatabaseSettingsL. If not, this
|
williamr@4
|
140 |
* function returns 0.
|
williamr@4
|
141 |
*
|
williamr@4
|
142 |
* If database drive is not applicable for the database, e.g. the
|
williamr@4
|
143 |
* database is remote, this function returns 0.
|
williamr@4
|
144 |
*
|
williamr@4
|
145 |
* @return The drive letter for the drive where the database resides, or
|
williamr@4
|
146 |
* 0 if the letter is not set.
|
williamr@4
|
147 |
*/
|
williamr@4
|
148 |
IMPORT_C TChar DatabaseDrive() const;
|
williamr@4
|
149 |
|
williamr@4
|
150 |
/**
|
williamr@4
|
151 |
* Retrieve a const reference to the database settings.
|
williamr@4
|
152 |
*
|
williamr@4
|
153 |
* The const reference can be used to read the database settings.
|
williamr@4
|
154 |
*
|
williamr@4
|
155 |
* @returns Const reference to the database settings
|
williamr@4
|
156 |
*/
|
williamr@4
|
157 |
IMPORT_C const TPosLmDatabaseSettings& Settings() const;
|
williamr@4
|
158 |
|
williamr@4
|
159 |
/**
|
williamr@4
|
160 |
* Retrieve a reference to the database settings.
|
williamr@4
|
161 |
*
|
williamr@4
|
162 |
* The reference can be used to read and write to the database settings.
|
williamr@4
|
163 |
*
|
williamr@4
|
164 |
* @returns Reference to the database settings
|
williamr@4
|
165 |
*/
|
williamr@4
|
166 |
IMPORT_C TPosLmDatabaseSettings& Settings();
|
williamr@4
|
167 |
|
williamr@4
|
168 |
/**
|
williamr@4
|
169 |
* Returns the size in bytes of this object.
|
williamr@4
|
170 |
*
|
williamr@4
|
171 |
* @returns The size of this object.
|
williamr@4
|
172 |
*/
|
williamr@4
|
173 |
IMPORT_C TInt Size() const;
|
williamr@4
|
174 |
|
williamr@4
|
175 |
/**
|
williamr@4
|
176 |
* @internal */
|
williamr@4
|
177 |
/*
|
williamr@4
|
178 |
* Sets the default database indicator flag.
|
williamr@4
|
179 |
* This flag is used to indicate if the database described by the
|
williamr@4
|
180 |
* object is the default database.
|
williamr@4
|
181 |
*
|
williamr@4
|
182 |
* @param[in] aIsDefault @p ETrue if the database is the default database,
|
williamr@4
|
183 |
* otherwise @p ETrue.
|
williamr@4
|
184 |
*/
|
williamr@4
|
185 |
void SetDefault( TBool aIsDefault );
|
williamr@4
|
186 |
|
williamr@4
|
187 |
/**
|
williamr@4
|
188 |
* @internal */
|
williamr@4
|
189 |
/*
|
williamr@4
|
190 |
* Sets the database media type.
|
williamr@4
|
191 |
*
|
williamr@4
|
192 |
* @param[in] aMediaType The media type.
|
williamr@4
|
193 |
*/
|
williamr@4
|
194 |
void SetMediaType( TMediaType aMediaType );
|
williamr@4
|
195 |
|
williamr@4
|
196 |
/**
|
williamr@4
|
197 |
* @internal */
|
williamr@4
|
198 |
/*
|
williamr@4
|
199 |
* Sets the database drive.
|
williamr@4
|
200 |
*
|
williamr@4
|
201 |
* @param[in] aDatabaseDrive The database drive letter.
|
williamr@4
|
202 |
*/
|
williamr@4
|
203 |
void SetDatabaseDrive( TChar aDatabaseDrive );
|
williamr@4
|
204 |
|
williamr@4
|
205 |
private:
|
williamr@4
|
206 |
|
williamr@4
|
207 |
// C++ constructor.
|
williamr@4
|
208 |
HPosLmDatabaseInfo(const TDesC& aDatabaseUri);
|
williamr@4
|
209 |
|
williamr@4
|
210 |
// C++ copy constructor.
|
williamr@4
|
211 |
HPosLmDatabaseInfo(const HPosLmDatabaseInfo& aDatabaseInfo);
|
williamr@4
|
212 |
|
williamr@4
|
213 |
// Allocates memory for URI descriptor during construction.
|
williamr@4
|
214 |
static TAny* AllocateL(const TDesC& aDatabaseUri);
|
williamr@4
|
215 |
|
williamr@4
|
216 |
// Sets URI descriptor during construction.
|
williamr@4
|
217 |
void SetDatabaseUri(const TDesC& aDatabaseUri);
|
williamr@4
|
218 |
|
williamr@4
|
219 |
// Calculates buffer offset so that buffer is 4-byte aligned
|
williamr@4
|
220 |
static TInt BufferOffset();
|
williamr@4
|
221 |
|
williamr@4
|
222 |
// Prohibit assigment operator
|
williamr@4
|
223 |
HPosLmDatabaseInfo& operator= ( const HPosLmDatabaseInfo& );
|
williamr@4
|
224 |
|
williamr@4
|
225 |
private:
|
williamr@4
|
226 |
|
williamr@4
|
227 |
TPosLmDatabaseSettings iSettings;
|
williamr@4
|
228 |
TMediaType iDatabaseMedia;
|
williamr@4
|
229 |
TChar iDatabaseDrive;
|
williamr@4
|
230 |
TBool iIsDefault;
|
williamr@4
|
231 |
TUint8 iBuffer[1]; // Must be at end of class
|
williamr@4
|
232 |
|
williamr@4
|
233 |
};
|
williamr@4
|
234 |
|
williamr@4
|
235 |
#endif // HPOSLMDATABASEINFO_H
|
williamr@4
|
236 |
|
williamr@4
|
237 |
|