2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: HPosLmDatabaseInfo class
20 #ifndef HPOSLMDATABASEINFO_H
21 #define HPOSLMDATABASEINFO_H
25 #include "EPos_TPosLmDatabaseSettings.h"
28 * @ref HPosLmDatabaseInfo encapsulates information about a landmark database.
30 * @lib eposlmdbmanlib.lib
33 class HPosLmDatabaseInfo
38 * Two-phased constructor.
40 * @param[in] aDatabaseUri The URI of the landmark database.
41 * @return A new instance of this class.
43 IMPORT_C static HPosLmDatabaseInfo* NewLC( const TDesC& aDatabaseUri );
46 * Two-phased constructor.
48 * @param[in] aDatabaseUri The URI of the landmark database.
49 * @return A new instance of this class.
51 IMPORT_C static HPosLmDatabaseInfo* NewL( const TDesC& aDatabaseUri );
54 * Two-phased copy constructor.
56 * @param[in] aDatabaseInfo The information instance to copy.
57 * @return A new instance of this class.
59 IMPORT_C static HPosLmDatabaseInfo* NewLC(
60 const HPosLmDatabaseInfo& aDatabaseInfo
64 * Two-phased copy constructor.
66 * @param[in] aDatabaseInfo The information instance to copy.
67 * @return A new instance of this class.
69 IMPORT_C static HPosLmDatabaseInfo* NewL(
70 const HPosLmDatabaseInfo& aDatabaseInfo
77 * Retrieves the database URI.
79 * @return A pointer to the URI descriptor. This pointer is valid until
80 * the @ref HPosLmDatabaseInfo object is destroyed.
82 IMPORT_C TPtrC DatabaseUri() const;
85 * Returns the protocol part from the URI which is set.
87 * Example: If the URI is "file://c:landmarks.ldb" then the protocol is
90 * If no protocol is specified, an empty descriptor is returned. This
91 * implies "file" protocol.
93 * @return A pointer to the protocol descriptor. This pointer is valid
94 * until the @ref HPosLmDatabaseInfo object is destroyed.
96 IMPORT_C TPtrC Protocol() const;
99 * Returns whether the database is the default database.
101 * Note: that this attribute is only set if the @ref HPosLmDatabaseInfo
102 * instance has been returned from a @ref CPosLmDatabaseManager
103 * function, e.g. @ref CPosLmDatabaseManager::ListDatabasesL,
104 * @ref CPosLmDatabaseManager::GetDatabaseInfoL,
105 * @ref CPosLmDatabaseManager::RegisterDatabaseL,
106 * @ref CPosLmDatabaseManager::CreateDatabaseL or
107 * @ref CPosLmDatabaseManager::ModifyDatabaseSettingsL. If not, this
108 * function returns @p EFalse.
110 * @return @p ETrue if the database is the default one, otherwise @p EFalse.
112 IMPORT_C TBool IsDefault() const;
115 * Returns which storage media the database resides in.
117 * Note: this attribute is only set if the @ref HPosLmDatabaseInfo
118 * instance has been returned from a @ref CPosLmDatabaseManager
119 * function, e.g. @ref CPosLmDatabaseManager::ListDatabasesL,
120 * @ref CPosLmDatabaseManager::GetDatabaseInfoL,
121 * @ref CPosLmDatabaseManager::RegisterDatabaseL,
122 * @ref CPosLmDatabaseManager::CreateDatabaseL or
123 * @ref CPosLmDatabaseManager::ModifyDatabaseSettingsL. If not, this
124 * function returns @p EMediaUnknown.
126 * @return The storage media the database resides in.
128 IMPORT_C TMediaType DatabaseMedia() const;
131 * Returns which database drive the database resides in.
133 * Note: that this attribute is only set if the @ref HPosLmDatabaseInfo
134 * instance has been returned from a @ref CPosLmDatabaseManager
135 * function, e.g. @ref CPosLmDatabaseManager::ListDatabasesL,
136 * @ref CPosLmDatabaseManager::GetDatabaseInfoL,
137 * @ref CPosLmDatabaseManager::RegisterDatabaseL,
138 * @ref CPosLmDatabaseManager::CreateDatabaseL or
139 * @ref CPosLmDatabaseManager::ModifyDatabaseSettingsL. If not, this
140 * function returns 0.
142 * If database drive is not applicable for the database, e.g. the
143 * database is remote, this function returns 0.
145 * @return The drive letter for the drive where the database resides, or
146 * 0 if the letter is not set.
148 IMPORT_C TChar DatabaseDrive() const;
151 * Retrieve a const reference to the database settings.
153 * The const reference can be used to read the database settings.
155 * @returns Const reference to the database settings
157 IMPORT_C const TPosLmDatabaseSettings& Settings() const;
160 * Retrieve a reference to the database settings.
162 * The reference can be used to read and write to the database settings.
164 * @returns Reference to the database settings
166 IMPORT_C TPosLmDatabaseSettings& Settings();
169 * Returns the size in bytes of this object.
171 * @returns The size of this object.
173 IMPORT_C TInt Size() const;
178 * Sets the default database indicator flag.
179 * This flag is used to indicate if the database described by the
180 * object is the default database.
182 * @param[in] aIsDefault @p ETrue if the database is the default database,
183 * otherwise @p ETrue.
185 void SetDefault( TBool aIsDefault );
190 * Sets the database media type.
192 * @param[in] aMediaType The media type.
194 void SetMediaType( TMediaType aMediaType );
199 * Sets the database drive.
201 * @param[in] aDatabaseDrive The database drive letter.
203 void SetDatabaseDrive( TChar aDatabaseDrive );
208 HPosLmDatabaseInfo(const TDesC& aDatabaseUri);
210 // C++ copy constructor.
211 HPosLmDatabaseInfo(const HPosLmDatabaseInfo& aDatabaseInfo);
213 // Allocates memory for URI descriptor during construction.
214 static TAny* AllocateL(const TDesC& aDatabaseUri);
216 // Sets URI descriptor during construction.
217 void SetDatabaseUri(const TDesC& aDatabaseUri);
219 // Calculates buffer offset so that buffer is 4-byte aligned
220 static TInt BufferOffset();
222 // Prohibit assigment operator
223 HPosLmDatabaseInfo& operator= ( const HPosLmDatabaseInfo& );
227 TPosLmDatabaseSettings iSettings;
228 TMediaType iDatabaseMedia;
229 TChar iDatabaseDrive;
231 TUint8 iBuffer[1]; // Must be at end of class
235 #endif // HPOSLMDATABASEINFO_H