epoc32/include/mw/EPos_CPosLmDatabaseManagerPluginBase.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2005-2006 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:   CPosLmDatabaseManagerPluginBase class
    15 *
    16 */
    17 
    18 
    19 
    20 #ifndef CPOSLMDATABASEMANAGERPLUGINBASE_H
    21 #define CPOSLMDATABASEMANAGERPLUGINBASE_H
    22 
    23 #include <e32base.h>
    24 #include <badesca.h>
    25 #include <EPos_TPosLmDatabaseEvent.h>
    26 #include <EPos_TPosLmDatabaseSettings.h>
    27 #include <EPos_HPosLmDatabaseInfo.h>
    28 
    29 class CPosLmDbManPluginBaseExtension;
    30 class RPosLandmarkServer;
    31 
    32 /**
    33 *  @internal
    34 *
    35 *  <b>This class is not used by client applications. 
    36 *  It is reserved for future extensions.</b>
    37 */
    38 /*
    39 *  This class is the base class which has to be subclassed in order to write a
    40 *  plug-in for database management for a specific protocol. It is reserved for
    41 *  for future extensions.
    42 *
    43 *  @p CPosLmDatabaseManagerPluginBase contains functions for listing,
    44 *  registering, unregistering, creating, deleting, copying landmark databases,
    45 *  etc.
    46 *
    47 *  @lib eposlmdbmanlib.lib
    48 *  @since S60 3.0
    49 */
    50 class CPosLmDatabaseManagerPluginBase : public CBase
    51     {
    52     public:
    53 
    54         /*
    55         * Destructor.
    56         */
    57         IMPORT_C virtual ~CPosLmDatabaseManagerPluginBase();
    58 
    59     public:
    60 
    61         /*
    62         * Retrieves the type of media where a landmark database resides.
    63         *
    64         * This function does not validate the URI. If the URI is invalid, this
    65         * function will just return @p EMediaUnknown.
    66         *
    67         * @param[in] aDatabaseUri The URI of the database to check media for.
    68         * @return Type of storage media.
    69         */
    70         virtual TMediaType DatabaseMedia( const TDesC& aDatabaseUri ) = 0;
    71 
    72         /*
    73         * Retrieves the drive letter for the drive where a landmark database
    74         * resides.
    75         *
    76         * If the landmark database is remote or otherwise the drive letter is
    77         * not applicable, 0 is returned.
    78         *
    79         * This function does not validate the URI. If the URI is invalid, this
    80         * function will just return 0.
    81         *
    82         * @param[in] aDatabaseUri The URI of the database to check drive letter
    83         *   for.
    84         * @return The drive letter, or 0 if drive letter is not applicable.
    85         */
    86         virtual TChar DatabaseDrive( const TDesC& aDatabaseUri ) = 0;
    87 
    88         /*
    89         * Returns the protocol which the plug-in handles.
    90         *
    91         * The returned descriptor pointer is valid until the plug-in is
    92         * unloaded.
    93         *
    94         * @return Pointer to the protocol descriptor, e.g. "file"
    95         */
    96         virtual TPtrC Protocol() = 0;
    97 
    98         /*
    99         * Lists the URIs to all landmark databases handled by this
   100         * plug-in.
   101         *
   102         * The client takes ownership of the returned array.
   103         *
   104         * If no databases are found, an empty array is returned.
   105         *
   106         * This function requires @p ReadUserData capability.
   107         *
   108         * @return The list of database URIs.
   109         */
   110         virtual CDesCArray* ListDatabasesLC() = 0;
   111 
   112         /*
   113         * Lists information about each landmark database handled by this
   114         * plug-in.
   115         *
   116         * The client specifies an array which is populated by this function.
   117         * The client takes ownership of all information objects in the array.
   118         *
   119         * If no databases are found, the input array is not modified.
   120         *
   121         * This function requires @p ReadUserData capability.
   122         *
   123         * @param[out] aDatabaseInfoArray On return, contains information about
   124         *   the landmark databases.
   125         */
   126         virtual void ListDatabasesL(
   127             RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray
   128         ) = 0;
   129 
   130         /*
   131         * Registers a landmark database.
   132         *
   133         * The landmark database is then returned when listing landmark
   134         * databases.
   135         *
   136         * Some protocols like "file" does not allow registering of databases
   137         * and will leave with error code @p KErrNotSupported. To add a
   138         * database of such protocol, the client must call @ref CreateDatabaseL.
   139         *
   140         * The client supplies an information object containing the URI of the
   141         * database to register. The information object can also contain
   142         * database settings, e.g. a display name for the database.
   143         *
   144         * This function requires @p ReadUserData and @p WriteUserData
   145         * capabilities.
   146         *
   147         * @param[in,out] aDatabaseInfo Information about the landmark database to
   148         *   register.
   149         *
   150         * @leave KErrNotSupported The protocol specified in the URI is not
   151         *   supported by this plug-in or the protocol does not allow
   152         *   registering landmark databases.
   153         * @leave KErrArgument The URI is incorrect.
   154         * @leave KErrAlreadyExists The database already exists in the registry.
   155         */
   156         virtual void RegisterDatabaseL( HPosLmDatabaseInfo& aDatabaseInfo ) = 0;
   157 
   158         /*
   159         * Unregisters a landmark database.
   160         *
   161         * After this, the landmark database will not be returned when listing
   162         * landmark databases.
   163         *
   164         * Some protocols like "file" does not allow unregistering of databases
   165         * and will leave with error code @p KErrNotSupported. To remove a
   166         * database of such protocol, the client must call @ref DeleteDatabaseL.
   167         *
   168         * This function requires @p ReadUserData and @p WriteUserData
   169         * capabilities.
   170         *
   171         * @param[in] aDatabaseUri The URI of the database to register.
   172         *
   173         * @leave KErrNotSupported The protocol specified in the URI is not
   174         *   supported by this plug-in or the protocol does not allow
   175         *   unregistering landmark databases.
   176         * @leave KErrArgument The URI is incorrect.
   177         */
   178         virtual void UnregisterDatabaseL( const TDesC& aDatabaseUri ) = 0;
   179 
   180         /*
   181         * Unregisters all landmark database which are accessed through this
   182         * plug-in.
   183         *
   184         * After this, the landmark databases will not be returned when listing
   185         * landmark databases.
   186         *
   187         * Some protocols like "file" does not allow unregistering of databases
   188         * and will leave with error code @p KErrNotSupported. To remove a
   189         * "file"-protocol database, the client must call @ref DeleteDatabaseL.
   190         *
   191         * This function requires @p ReadUserData and @p WriteUserData
   192         * capabilities.
   193         *
   194         * @leave KErrNotSupported This plug-in does not allow unregistering
   195         *   landmark databases.
   196         */
   197         virtual void UnregisterAllDatabasesL() = 0;
   198 
   199         /*
   200         * Modifies the settings for a landmark database.
   201         *
   202         * This function requires @p ReadUserData and @p WriteUserData
   203         * capabilities.
   204         *
   205         * @param[in] aDatabaseUri The URI of the database to modify settings for.
   206         * @param[in] aDatabaseSettings The new settings for the database.
   207         *
   208         * @leave KErrNotSupported The protocol specified in the URI is not
   209         *   supported by this plug-in.
   210         * @leave KErrNotFound The specified database is not found.
   211         */
   212         virtual void ModifyDatabaseSettingsL(
   213             const TDesC& aDatabaseUri,
   214             const TPosLmDatabaseSettings& aDatabaseSettings
   215         ) = 0;
   216 
   217         /*
   218         * Retrieve information about a landmark database.
   219         *
   220         * This function requires @p ReadUserData capability.
   221         *
   222         * @param[in,out] aDatabaseInfo An information object containing the URI of the
   223         *   landmark database. On return, the object contains information about
   224         *   the landmark database, including any database settings.
   225         *
   226         * @leave KErrNotSupported The protocol specified in the URI is not
   227         *   supported by this plug-in.
   228         * @leave KErrNotFound The specified database is not found.
   229         */
   230         virtual void GetDatabaseInfoL( HPosLmDatabaseInfo& aDatabaseInfo ) = 0;
   231 
   232         /*
   233         * Checks if the specified landmark database exists.
   234         *
   235         * The database to check is specified by passing a URI to this function.
   236         * URI construction is described in the class description for
   237         * @ref CPosLmDatabaseManager.
   238         *
   239         * This function requires @p ReadUserData capability. If the database is
   240         * remote, @p NetworkServices capability is also needed.
   241         *
   242         * @param[in] aDatabaseUri The URI of the database which should be checked
   243         *   for existence.
   244         * @return @p ETrue if the database exists, otherwise @p EFalse.
   245         * 
   246         * @leave KErrArgument The URI is incorrect or the protocol specified in the
   247         *   URI is not supported by this plug-in.
   248         */
   249         virtual TBool DatabaseExistsL( const TDesC&  aDatabaseUri ) = 0;
   250 
   251         /*
   252         * Creates a landmark database.
   253         *
   254         * This function requires @p ReadUserData and @p WriteUserData
   255         * capabilities. If the database is remote, @p NetworkServices
   256         * capability is also needed.
   257         *
   258         * @param[in,out] aDatabaseInfo Information about the landmark database to
   259         *   create.
   260         *
   261         * @leave KErrNotSupported The protocol is not supported or the create
   262         *   operation is not supported by the protocol plug-in.
   263         * @leave KErrArgument The URI is incorrect or the protocol specified in the
   264         *   URI is not supported by this plug-in.
   265         * @leave KErrAlreadyExists There is already a database at this URI.
   266         */
   267         virtual void CreateDatabaseL( HPosLmDatabaseInfo& aDatabaseInfo ) = 0;
   268 
   269         /*
   270         * Deletes a landmark database.
   271         *
   272         * The database to delete is specified by passing a URI to this
   273         * function. URI construction is described in the class description for
   274         * @ref CPosLmDatabaseManager. The URI must specify the protocol which
   275         * is handled by this database manager plug-in.
   276         *
   277         * If the specified database does not exist, the call is ignored.
   278         *
   279         * This function requires @p ReadUserData and @p WriteUserData
   280         * capabilities. If the database is remote, @p NetworkServices
   281         * capability is also needed.
   282         *
   283         * @param[in] aDatabaseUri The URI of the database to delete.
   284         *
   285         * @leave KErrNotSupported The protocol is not supported or the delete
   286         *   operation is not supported by the plug-in.
   287         * @leave KErrArgument The URI is incorrect or the protocol specified in the
   288         *   URI is not supported by this plug-in.
   289         * @leave KErrInUse The database is in use by some client.
   290         * @leave KErrAccessDenied The database is read-only.
   291         */
   292         virtual void DeleteDatabaseL( const TDesC& aDatabaseUri ) = 0;
   293 
   294         /*
   295         * Copies a landmark database to a new location.
   296         *
   297         * Database locations are specified as URIs. URI construction is
   298         * described in the class description for @ref CPosLmDatabaseManager.
   299         * The target and source URIs must specify the protocol which is handled
   300         * by this database manager plug-in.
   301         *
   302         * This function requires @p ReadUserData and @p WriteUserData
   303         * capabilities. If the database is remote, @p NetworkServices
   304         * capability is also needed.
   305         *
   306         * @param[in] aSourceUri The URI of the database to copy.
   307         * @param[in] aTargetUri The URI of the new database location.
   308         * 
   309         * @leave KErrNotSupported The operation is not supported by the plug-in.
   310         * @leave KErrArgument A URI is incorrect or the protocol specified in a
   311         *   URI is not supported by this plug-in.
   312         * @leave KErrInUse There is a write-lock on the database, e.g. some client
   313         *   is currently modifying the database.
   314         * @leave KErrNotFound There is no database at the source URI.
   315         */
   316         virtual void CopyDatabaseL(
   317             const TDesC& aSourceUri,
   318             const TDesC& aTargetUri
   319         ) = 0;
   320 
   321     protected:
   322 
   323         /*
   324         * C++ constructor.
   325         */
   326         IMPORT_C CPosLmDatabaseManagerPluginBase();
   327 
   328         /*
   329         * Creates the internals of the manager.
   330         *
   331         * This function must be called first in the manager's @b ConstructL()
   332         * method.
   333         *
   334         * @param[in] aConstructionParameters The construction parameters supplied
   335         *   in the factory call.
   336         */
   337         IMPORT_C void BaseConstructL( TAny* aConstructionParameters );
   338 
   339     protected:
   340 
   341         /*
   342         * Returns a reference to an open landmark server session.
   343         *
   344         * @return The server session.
   345         */
   346         IMPORT_C RPosLandmarkServer& Session() const;
   347 
   348     private:
   349 
   350         // Prohibit copy constructor
   351         CPosLmDatabaseManagerPluginBase(
   352             const CPosLmDatabaseManagerPluginBase& );
   353         // Prohibit assigment operator
   354         CPosLmDatabaseManagerPluginBase& operator=(
   355             const CPosLmDatabaseManagerPluginBase& );
   356 
   357     private:
   358 
   359         CPosLmDbManPluginBaseExtension* iExtension;
   360     };
   361 
   362 #endif      // CPOSLMDATABASEMANAGERPLUGINBASE_H
   363 
   364