1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/EPos_HPosLmDatabaseInfo.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,237 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: HPosLmDatabaseInfo class
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +#ifndef HPOSLMDATABASEINFO_H
1.24 +#define HPOSLMDATABASEINFO_H
1.25 +
1.26 +#include <e32base.h>
1.27 +#include <f32file.h>
1.28 +#include "EPos_TPosLmDatabaseSettings.h"
1.29 +
1.30 +/**
1.31 +* @ref HPosLmDatabaseInfo encapsulates information about a landmark database.
1.32 +*
1.33 +* @lib eposlmdbmanlib.lib
1.34 +* @since S60 3.0
1.35 +*/
1.36 +class HPosLmDatabaseInfo
1.37 + {
1.38 + public:
1.39 +
1.40 + /**
1.41 + * Two-phased constructor.
1.42 + *
1.43 + * @param[in] aDatabaseUri The URI of the landmark database.
1.44 + * @return A new instance of this class.
1.45 + */
1.46 + IMPORT_C static HPosLmDatabaseInfo* NewLC( const TDesC& aDatabaseUri );
1.47 +
1.48 + /**
1.49 + * Two-phased constructor.
1.50 + *
1.51 + * @param[in] aDatabaseUri The URI of the landmark database.
1.52 + * @return A new instance of this class.
1.53 + */
1.54 + IMPORT_C static HPosLmDatabaseInfo* NewL( const TDesC& aDatabaseUri );
1.55 +
1.56 + /**
1.57 + * Two-phased copy constructor.
1.58 + *
1.59 + * @param[in] aDatabaseInfo The information instance to copy.
1.60 + * @return A new instance of this class.
1.61 + */
1.62 + IMPORT_C static HPosLmDatabaseInfo* NewLC(
1.63 + const HPosLmDatabaseInfo& aDatabaseInfo
1.64 + );
1.65 +
1.66 + /**
1.67 + * Two-phased copy constructor.
1.68 + *
1.69 + * @param[in] aDatabaseInfo The information instance to copy.
1.70 + * @return A new instance of this class.
1.71 + */
1.72 + IMPORT_C static HPosLmDatabaseInfo* NewL(
1.73 + const HPosLmDatabaseInfo& aDatabaseInfo
1.74 + );
1.75 +
1.76 +
1.77 + public:
1.78 +
1.79 + /**
1.80 + * Retrieves the database URI.
1.81 + *
1.82 + * @return A pointer to the URI descriptor. This pointer is valid until
1.83 + * the @ref HPosLmDatabaseInfo object is destroyed.
1.84 + */
1.85 + IMPORT_C TPtrC DatabaseUri() const;
1.86 +
1.87 + /**
1.88 + * Returns the protocol part from the URI which is set.
1.89 + *
1.90 + * Example: If the URI is "file://c:landmarks.ldb" then the protocol is
1.91 + * "file".
1.92 + *
1.93 + * If no protocol is specified, an empty descriptor is returned. This
1.94 + * implies "file" protocol.
1.95 + *
1.96 + * @return A pointer to the protocol descriptor. This pointer is valid
1.97 + * until the @ref HPosLmDatabaseInfo object is destroyed.
1.98 + */
1.99 + IMPORT_C TPtrC Protocol() const;
1.100 +
1.101 + /**
1.102 + * Returns whether the database is the default database.
1.103 + *
1.104 + * Note: that this attribute is only set if the @ref HPosLmDatabaseInfo
1.105 + * instance has been returned from a @ref CPosLmDatabaseManager
1.106 + * function, e.g. @ref CPosLmDatabaseManager::ListDatabasesL,
1.107 + * @ref CPosLmDatabaseManager::GetDatabaseInfoL,
1.108 + * @ref CPosLmDatabaseManager::RegisterDatabaseL,
1.109 + * @ref CPosLmDatabaseManager::CreateDatabaseL or
1.110 + * @ref CPosLmDatabaseManager::ModifyDatabaseSettingsL. If not, this
1.111 + * function returns @p EFalse.
1.112 + *
1.113 + * @return @p ETrue if the database is the default one, otherwise @p EFalse.
1.114 + */
1.115 + IMPORT_C TBool IsDefault() const;
1.116 +
1.117 + /**
1.118 + * Returns which storage media the database resides in.
1.119 + *
1.120 + * Note: this attribute is only set if the @ref HPosLmDatabaseInfo
1.121 + * instance has been returned from a @ref CPosLmDatabaseManager
1.122 + * function, e.g. @ref CPosLmDatabaseManager::ListDatabasesL,
1.123 + * @ref CPosLmDatabaseManager::GetDatabaseInfoL,
1.124 + * @ref CPosLmDatabaseManager::RegisterDatabaseL,
1.125 + * @ref CPosLmDatabaseManager::CreateDatabaseL or
1.126 + * @ref CPosLmDatabaseManager::ModifyDatabaseSettingsL. If not, this
1.127 + * function returns @p EMediaUnknown.
1.128 + *
1.129 + * @return The storage media the database resides in.
1.130 + */
1.131 + IMPORT_C TMediaType DatabaseMedia() const;
1.132 +
1.133 + /**
1.134 + * Returns which database drive the database resides in.
1.135 + *
1.136 + * Note: that this attribute is only set if the @ref HPosLmDatabaseInfo
1.137 + * instance has been returned from a @ref CPosLmDatabaseManager
1.138 + * function, e.g. @ref CPosLmDatabaseManager::ListDatabasesL,
1.139 + * @ref CPosLmDatabaseManager::GetDatabaseInfoL,
1.140 + * @ref CPosLmDatabaseManager::RegisterDatabaseL,
1.141 + * @ref CPosLmDatabaseManager::CreateDatabaseL or
1.142 + * @ref CPosLmDatabaseManager::ModifyDatabaseSettingsL. If not, this
1.143 + * function returns 0.
1.144 + *
1.145 + * If database drive is not applicable for the database, e.g. the
1.146 + * database is remote, this function returns 0.
1.147 + *
1.148 + * @return The drive letter for the drive where the database resides, or
1.149 + * 0 if the letter is not set.
1.150 + */
1.151 + IMPORT_C TChar DatabaseDrive() const;
1.152 +
1.153 + /**
1.154 + * Retrieve a const reference to the database settings.
1.155 + *
1.156 + * The const reference can be used to read the database settings.
1.157 + *
1.158 + * @returns Const reference to the database settings
1.159 + */
1.160 + IMPORT_C const TPosLmDatabaseSettings& Settings() const;
1.161 +
1.162 + /**
1.163 + * Retrieve a reference to the database settings.
1.164 + *
1.165 + * The reference can be used to read and write to the database settings.
1.166 + *
1.167 + * @returns Reference to the database settings
1.168 + */
1.169 + IMPORT_C TPosLmDatabaseSettings& Settings();
1.170 +
1.171 + /**
1.172 + * Returns the size in bytes of this object.
1.173 + *
1.174 + * @returns The size of this object.
1.175 + */
1.176 + IMPORT_C TInt Size() const;
1.177 +
1.178 + /**
1.179 + * @internal */
1.180 + /*
1.181 + * Sets the default database indicator flag.
1.182 + * This flag is used to indicate if the database described by the
1.183 + * object is the default database.
1.184 + *
1.185 + * @param[in] aIsDefault @p ETrue if the database is the default database,
1.186 + * otherwise @p ETrue.
1.187 + */
1.188 + void SetDefault( TBool aIsDefault );
1.189 +
1.190 + /**
1.191 + * @internal */
1.192 + /*
1.193 + * Sets the database media type.
1.194 + *
1.195 + * @param[in] aMediaType The media type.
1.196 + */
1.197 + void SetMediaType( TMediaType aMediaType );
1.198 +
1.199 + /**
1.200 + * @internal */
1.201 + /*
1.202 + * Sets the database drive.
1.203 + *
1.204 + * @param[in] aDatabaseDrive The database drive letter.
1.205 + */
1.206 + void SetDatabaseDrive( TChar aDatabaseDrive );
1.207 +
1.208 + private:
1.209 +
1.210 + // C++ constructor.
1.211 + HPosLmDatabaseInfo(const TDesC& aDatabaseUri);
1.212 +
1.213 + // C++ copy constructor.
1.214 + HPosLmDatabaseInfo(const HPosLmDatabaseInfo& aDatabaseInfo);
1.215 +
1.216 + // Allocates memory for URI descriptor during construction.
1.217 + static TAny* AllocateL(const TDesC& aDatabaseUri);
1.218 +
1.219 + // Sets URI descriptor during construction.
1.220 + void SetDatabaseUri(const TDesC& aDatabaseUri);
1.221 +
1.222 + // Calculates buffer offset so that buffer is 4-byte aligned
1.223 + static TInt BufferOffset();
1.224 +
1.225 + // Prohibit assigment operator
1.226 + HPosLmDatabaseInfo& operator= ( const HPosLmDatabaseInfo& );
1.227 +
1.228 + private:
1.229 +
1.230 + TPosLmDatabaseSettings iSettings;
1.231 + TMediaType iDatabaseMedia;
1.232 + TChar iDatabaseDrive;
1.233 + TBool iIsDefault;
1.234 + TUint8 iBuffer[1]; // Must be at end of class
1.235 +
1.236 + };
1.237 +
1.238 +#endif // HPOSLMDATABASEINFO_H
1.239 +
1.240 +