epoc32/include/mw/EPos_CPosLandmarkDatabase.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.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2005-2007 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:  CPosLandmarkDatabase class
williamr@4
    15
*
williamr@4
    16
*/
williamr@4
    17
williamr@4
    18
williamr@4
    19
#ifndef CPOSLANDMARKDATABASE_H
williamr@4
    20
#define CPOSLANDMARKDATABASE_H
williamr@4
    21
williamr@4
    22
#include <e32base.h>
williamr@4
    23
#include <s32strm.h>
williamr@4
    24
#include "EPos_Landmarks.h"
williamr@4
    25
#include "EPos_CPosLandmark.h"
williamr@4
    26
#include "EPos_CPosLmPartialReadParameters.h"
williamr@4
    27
#include "EPos_CPosLmItemIterator.h"
williamr@4
    28
#include "EPos_TPosLmSortPref.h"
williamr@4
    29
#include "EPos_CPosLmOperation.h"
williamr@4
    30
williamr@4
    31
class CPosLandmarkParser;
williamr@4
    32
class CPosLandmarkEncoder;
williamr@4
    33
williamr@4
    34
williamr@4
    35
/**
williamr@4
    36
*  Handle to a landmark database.
williamr@4
    37
*
williamr@4
    38
*  This class contains functions for creating, iterating, reading, modifying
williamr@4
    39
*  and deleting landmarks.
williamr@4
    40
*
williamr@4
    41
*  Operations on the database may fail with error code @p KErrCorrupt if the
williamr@4
    42
*  database is damaged. The client can try to recover the database by calling
williamr@4
    43
*  @ref CPosLandmarkDatabase::InitializeL().
williamr@4
    44
*
williamr@4
    45
*  Operations on the database may fail with error code @p KErrLocked if another
williamr@4
    46
*  client is writing to the database. Write operations can also fail with this
williamr@4
    47
*  error code if another client is currently reading from the database.
williamr@4
    48
*
williamr@4
    49
*  If @ref CPosLandmarkDatabase is used, the client must call the global
williamr@4
    50
*  function @ref ReleaseLandmarkResources() before terminating in order to
williamr@4
    51
*  release all used landmark resources, otherwise the client may receive
williamr@4
    52
*  an ALLOC panic.
williamr@4
    53
*
williamr@4
    54
*  @p NetworkServices capability is required for remote databases.
williamr@4
    55
*
williamr@4
    56
*  @since S60 3.0
williamr@4
    57
*  @lib eposlandmarks.lib.
williamr@4
    58
*/
williamr@4
    59
class CPosLandmarkDatabase : public CBase
williamr@4
    60
    {
williamr@4
    61
    public:
williamr@4
    62
williamr@4
    63
        /**
williamr@4
    64
        *  Bitmap for specifying a group of transfer options
williamr@4
    65
        *  defined by @ref _TAttributes.
williamr@4
    66
        */
williamr@4
    67
        typedef TUint TTransferOptions;
williamr@4
    68
williamr@4
    69
        /**
williamr@4
    70
        *  Specifies options for importing and exporting landmarks.
williamr@4
    71
        */
williamr@4
    72
        enum _TTransferOptions
williamr@4
    73
            {
williamr@4
    74
            EDefaultOptions = 0                 /**<
williamr@4
    75
                None of the transfer option flags are set. */,
williamr@4
    76
            EIncludeCategories = 0x01           /**<
williamr@4
    77
                Export/Import the categories of the landmarks. */,
williamr@4
    78
            EIncludeGlobalCategoryNames = 0x02  /**<
williamr@4
    79
                Only useful in combination with EIncludeCategories.
williamr@4
    80
                If set, global category names will be used in export/import
williamr@4
    81
                even if user has renamed them. For import it means that the
williamr@4
    82
                names of the global categories in the database are overwritten
williamr@4
    83
                by the imported names. For export it means that predefined
williamr@4
    84
                names of global categories in the current language will be
williamr@4
    85
                exported instead of user-defined names. */,
williamr@4
    86
            ESupressCategoryCreation = 0x04     /**<
williamr@4
    87
                Only useful in combination with EIncludeCategories.
williamr@4
    88
                If set, no new categories are created in the database when
williamr@4
    89
                importing landmarks. This means that connections from
williamr@4
    90
                imported landmarks will be established only to already
williamr@4
    91
                existing categories, according to the import information. */
williamr@4
    92
            };
williamr@4
    93
williamr@4
    94
        /**
williamr@4
    95
        *  Encapsulates size information for a landmark database.
williamr@4
    96
        */
williamr@4
    97
        struct TSize
williamr@4
    98
            {
williamr@4
    99
            TInt iFileSize;   /**<
williamr@4
   100
                The size of the database in bytes. */
williamr@4
   101
            TReal32 iUsage;   /**<
williamr@4
   102
                How many percent of the database which is currently in use.
williamr@4
   103
                This value lies in the interval [0.0, 1.0]. */
williamr@4
   104
            };
williamr@4
   105
williamr@4
   106
    public:
williamr@4
   107
williamr@4
   108
        /**
williamr@4
   109
        * Opens the default landmark database.
williamr@4
   110
        *
williamr@4
   111
        * The client takes ownership of the returned database handle.
williamr@4
   112
        *
williamr@4
   113
        * The database may have to be initialized before it can be used, see
williamr@4
   114
        * @ref IsInitializingNeeded and @ref InitializeL.
williamr@4
   115
        *
williamr@4
   116
        * This function requires @p ReadUserData capability.
williamr@4
   117
        *
williamr@4
   118
        * @returns A handle to the open database.
williamr@4
   119
        */
williamr@4
   120
        IMPORT_C static CPosLandmarkDatabase* OpenL();
williamr@4
   121
williamr@4
   122
        /**
williamr@4
   123
        * Opens a specific landmark database.
williamr@4
   124
        *
williamr@4
   125
        * The client refers to a database by URI. The URI consists of a
williamr@4
   126
        * protocol specifier and the database location: "protocol://location".
williamr@4
   127
        * If the client does not specify a protocol, "file://" will be assumed.
williamr@4
   128
        *
williamr@4
   129
        * For local landmark databases, the URI consists of the drive and the
williamr@4
   130
        * database file name, e.g. "c:landmarks.ldb". The path cannot be
williamr@4
   131
        * specified by the client. The extension of the database file name must
williamr@4
   132
        * be "ldb" otherwise the client will get the error @p KErrArgument.
williamr@4
   133
        *
williamr@4
   134
        * If the client specifies a local database and does not specify the
williamr@4
   135
        * drive letter, e.g. "landmarks.ldb", default database drive will be assumed.
williamr@4
   136
        *
williamr@4
   137
        * The client takes ownership of the returned database handle.
williamr@4
   138
        *
williamr@4
   139
        * The database may have to be initialized before it can be used, see
williamr@4
   140
        * @ref IsInitializingNeeded and @ref InitializeL.
williamr@4
   141
        *
williamr@4
   142
        * This function requires @p ReadUserData capability.
williamr@4
   143
        *
williamr@4
   144
        * @param[in] aDatabaseUri The URI of the database to open.
williamr@4
   145
        * @returns A handle to the open database.
williamr@4
   146
        *
williamr@4
   147
        * @leave KErrArgument Extension of the local database name is not "ldb".
williamr@4
   148
        * @leave KErrNotSupported The protocol specified in URI is not supported.
williamr@4
   149
        */
williamr@4
   150
        IMPORT_C static CPosLandmarkDatabase* OpenL(
williamr@4
   151
               const TDesC&  aDatabaseUri
williamr@4
   152
        );
williamr@4
   153
williamr@4
   154
        /**
williamr@4
   155
        * Destructor.
williamr@4
   156
        */
williamr@4
   157
        IMPORT_C virtual ~CPosLandmarkDatabase();
williamr@4
   158
williamr@4
   159
    public:
williamr@4
   160
williamr@4
   161
        /**
williamr@4
   162
        * Checks if the database is in need of initialization.
williamr@4
   163
        *
williamr@4
   164
        * If the database needs to be initialized, the client must call
williamr@4
   165
        * @ref InitializeL, otherwise the database may not be possible to
williamr@4
   166
        * access. Access functions may leave with @p KErrPosLmNotInitialized.
williamr@4
   167
        *
williamr@4
   168
        * Initialization may be needed also if the database becomes damaged.
williamr@4
   169
        * The client can then try to call @ref InitializeL to try to recover
williamr@4
   170
        * the database.
williamr@4
   171
        *
williamr@4
   172
        * @returns @p ETrue if the database is in need of initialization,
williamr@4
   173
        *   otherwise @p EFalse.
williamr@4
   174
        */
williamr@4
   175
        virtual TBool IsInitializingNeeded() const = 0;
williamr@4
   176
williamr@4
   177
        /**
williamr@4
   178
        * Initializes the database.
williamr@4
   179
        *
williamr@4
   180
        * This function may have to be called right after the database is
williamr@4
   181
        * opened. @ref IsInitializingNeeded can be called to find out if
williamr@4
   182
        * initialization is needed.
williamr@4
   183
        *
williamr@4
   184
        * If the database becomes damaged, the client can call
williamr@4
   185
        * @ref InitializeL  to try to recover the database.
williamr@4
   186
        *
williamr@4
   187
        * It is ok to call @InitializeL even if initialization is not needed.
williamr@4
   188
        * In this case, the operation will not do anything.
williamr@4
   189
        *
williamr@4
   190
        * If the database needs to be initialized, the client must call
williamr@4
   191
        * @ref InitializeL, otherwise the database may not be possible to
williamr@4
   192
        * access. Access functions may leave with @p KErrPosLmNotInitialized.
williamr@4
   193
        *
williamr@4
   194
        * The function returns an operation object which can be run in
williamr@4
   195
        * incremental mode. If it is run incrementally the client can supervise
williamr@4
   196
        * the progress of the operation.
williamr@4
   197
        *
williamr@4
   198
        * If the @ref CPosLmOperation object is deleted before the operation
williamr@4
   199
        * is complete, it is possible that the database is not yet initialized.
williamr@4
   200
        *
williamr@4
   201
        * The client takes ownership of the returned operation object.
williamr@4
   202
        *
williamr@4
   203
        * This function requires @p ReadUserData capability.
williamr@4
   204
        *
williamr@4
   205
        * @returns A handle to the operation.
williamr@4
   206
        */
williamr@4
   207
        virtual CPosLmOperation* InitializeL() = 0;
williamr@4
   208
williamr@4
   209
        /**
williamr@4
   210
        * Reads a landmark from the database.
williamr@4
   211
        *
williamr@4
   212
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   213
        *
williamr@4
   214
        * The client takes ownership of the returned database landmark object.
williamr@4
   215
        *
williamr@4
   216
        * This function requires @p ReadUserData capability.
williamr@4
   217
        *
williamr@4
   218
        * @param The ID of the landmark to read.
williamr@4
   219
        * @returns The requested landmark. The landmark object is put on the
williamr@4
   220
        *   cleanup stack.
williamr@4
   221
        *
williamr@4
   222
        * @leave KErrNotFound The requested landmark does not exist in the database.
williamr@4
   223
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   224
        */
williamr@4
   225
        virtual CPosLandmark* ReadLandmarkLC(
williamr@4
   226
               TPosLmItemId  aLandmarkId
williamr@4
   227
        ) = 0;
williamr@4
   228
williamr@4
   229
        /**
williamr@4
   230
        * Returns an object for iterating the landmarks in the database.
williamr@4
   231
        *
williamr@4
   232
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   233
        *
williamr@4
   234
        * The iterator object is reset, so that the first
williamr@4
   235
        * @ref CPosLmItemIterator::NextL call will return the first landmark
williamr@4
   236
        * ID.
williamr@4
   237
        *
williamr@4
   238
        * The client takes ownership of the returned iterator object.
williamr@4
   239
        *
williamr@4
   240
        * This function requires @p ReadUserData capability.
williamr@4
   241
        *
williamr@4
   242
        * @return The landmark iterator.
williamr@4
   243
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   244
        */
williamr@4
   245
        virtual CPosLmItemIterator* LandmarkIteratorL() = 0;
williamr@4
   246
williamr@4
   247
        /**
williamr@4
   248
        * Returns an object for iterating the landmarks in the database.
williamr@4
   249
        *
williamr@4
   250
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   251
        *
williamr@4
   252
        * The iterator object is reset, so that the first
williamr@4
   253
        * @ref CPosLmItemIterator::NextL call will return the first landmark
williamr@4
   254
        * ID.
williamr@4
   255
        *
williamr@4
   256
        * This overload of the iterator function takes a sort preference object
williamr@4
   257
        * as input. The sort preference object specifies how the landmarks
williamr@4
   258
        * should be sorted by the iterator. Only sorting by landmark name is supported.
williamr@4
   259
        *
williamr@4
   260
        * The client takes ownership of the returned iterator object.
williamr@4
   261
        *
williamr@4
   262
        * This function requires @p ReadUserData capability.
williamr@4
   263
        *
williamr@4
   264
        * @param[in] aSortPref A sort preference object.
williamr@4
   265
        * @return The landmark iterator.
williamr@4
   266
        *
williamr@4
   267
        * @leave KErrNotSupported Sorting by another attribute than name is
williamr@4
   268
        *   requested.
williamr@4
   269
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   270
        */
williamr@4
   271
        virtual CPosLmItemIterator* LandmarkIteratorL(
williamr@4
   272
               const TPosLmSortPref&  aSortPref
williamr@4
   273
        ) = 0;
williamr@4
   274
williamr@4
   275
        /**
williamr@4
   276
        * Adds a new landmark to the database and returns its ID.
williamr@4
   277
        *
williamr@4
   278
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   279
        *
williamr@4
   280
        * A landmark can contain the IDs of the categories it belongs to. If
williamr@4
   281
        * any of these categories does not exist in the database, the add
williamr@4
   282
        * operation will still complete successfully but the category which
williamr@4
   283
        * was not found will be ignored.
williamr@4
   284
        *
williamr@4
   285
        * This function requires @p ReadUserData and @p WriteUserData
williamr@4
   286
        * capabilities.
williamr@4
   287
        *
williamr@4
   288
        * @post Landmark is added to the database and landmark object
williamr@4
   289
        *   has database item set (CPosLandmark::LandmarkId()).
williamr@4
   290
        *
williamr@4
   291
        * @param[in,out] aLandmark The landmark to add.
williamr@4
   292
        * @return The ID of the new landmark.
williamr@4
   293
        *
williamr@4
   294
        * @leave KErrAccessDenied The database is read-only.
williamr@4
   295
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   296
        */
williamr@4
   297
        virtual TPosLmItemId AddLandmarkL(
williamr@4
   298
            CPosLandmark&  aLandmark
williamr@4
   299
        ) = 0;
williamr@4
   300
williamr@4
   301
        /**
williamr@4
   302
        * Updates a landmark in the database.
williamr@4
   303
        *
williamr@4
   304
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   305
        *
williamr@4
   306
        * Only landmark objects containing full landmark information can be
williamr@4
   307
        * used to update a landmark. If a partial landmark (see
williamr@4
   308
        * @ref ReadPartialLandmarkLC and @ref CPosLandmark::IsPartial) is
williamr@4
   309
        * passed to this function it will leave with @p KErrArgument.
williamr@4
   310
        *
williamr@4
   311
        * Note that any updates in the database made since the landmark
williamr@4
   312
        * object was read from the database will be overwritten by this
williamr@4
   313
        * operation.
williamr@4
   314
        *
williamr@4
   315
        * A landmark can contain the IDs of the categories it belongs to. If
williamr@4
   316
        * any of these categories does not exist in the database, the update
williamr@4
   317
        * operation will still complete successfully but the category which
williamr@4
   318
        * was not found will be ignored.
williamr@4
   319
        *
williamr@4
   320
        * This function requires @p ReadUserData and @p WriteUserData
williamr@4
   321
        * capabilities.
williamr@4
   322
        *
williamr@4
   323
        * @param[in] aLandmark The new landmark data.
williamr@4
   324
        *
williamr@4
   325
        * @leave KErrArgument A partial landmark is passed.
williamr@4
   326
        * @leave KErrAccessDenied The database is read-only.
williamr@4
   327
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   328
        */
williamr@4
   329
        virtual void UpdateLandmarkL(
williamr@4
   330
               const CPosLandmark&  aLandmark
williamr@4
   331
        ) = 0;
williamr@4
   332
williamr@4
   333
        /**
williamr@4
   334
        * Removes a landmark from the database.
williamr@4
   335
        *
williamr@4
   336
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   337
        *
williamr@4
   338
        * If the landmark does not exist in the database, nothing happens.
williamr@4
   339
        *
williamr@4
   340
        * This function requires @p ReadUserData and @p WriteUserData
williamr@4
   341
        * capabilities.
williamr@4
   342
        *
williamr@4
   343
        * @param aLandmarkId The ID of the landmark to remove.
williamr@4
   344
        *
williamr@4
   345
        * @leave KErrAccessDenied The database is read-only.
williamr@4
   346
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   347
        */
williamr@4
   348
        virtual void RemoveLandmarkL(
williamr@4
   349
               TPosLmItemId  aLandmarkId
williamr@4
   350
        ) = 0;
williamr@4
   351
williamr@4
   352
        /**
williamr@4
   353
        * Removes a set of landmarks from the database.
williamr@4
   354
        *
williamr@4
   355
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   356
        *
williamr@4
   357
        * If any of the specified landmarks don't exist in the database,
williamr@4
   358
        * nothing happens for those landmarks.
williamr@4
   359
        *
williamr@4
   360
        * The function returns an operation object which can be run in
williamr@4
   361
        * incremental mode. If it is run incrementally the client can supervise
williamr@4
   362
        * the progress of the operation.
williamr@4
   363
        *
williamr@4
   364
        * If the @ref CPosLmOperation object is deleted before the operation
williamr@4
   365
        * is complete, it is possible that only a subset of the landmarks
williamr@4
   366
        * have been deleted.
williamr@4
   367
        *
williamr@4
   368
        * The client takes ownership of the returned operation object.
williamr@4
   369
        *
williamr@4
   370
        * While removing landmarks, this operation will acquire a write-lock on
williamr@4
   371
        * the database.
williamr@4
   372
        *
williamr@4
   373
        * This function requires @p ReadUserData and @p WriteUserData
williamr@4
   374
        * capabilities.
williamr@4
   375
        *
williamr@4
   376
        * @param[in] aLandmarkIdArray The IDs of the landmarks to remove.
williamr@4
   377
        * @returns A handle to the operation.
williamr@4
   378
        *
williamr@4
   379
        * @leave KErrAccessDenied The database is read-only.
williamr@4
   380
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   381
        */
williamr@4
   382
        virtual CPosLmOperation* RemoveLandmarksL(
williamr@4
   383
               const RArray<TPosLmItemId>&  aLandmarkIdArray
williamr@4
   384
        ) = 0;
williamr@4
   385
williamr@4
   386
        /**
williamr@4
   387
        * Removes all landmarks from the database.
williamr@4
   388
        *
williamr@4
   389
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   390
        *
williamr@4
   391
        * The function returns an operation object which can be run in
williamr@4
   392
        * incremental mode. If it is run incrementally the client can supervise
williamr@4
   393
        * the progress of the operation.
williamr@4
   394
        *
williamr@4
   395
        * If the @ref CPosLmOperation object is deleted before the operation
williamr@4
   396
        * is complete, it is possible that only a subset of the landmarks
williamr@4
   397
        * have been deleted.
williamr@4
   398
        *
williamr@4
   399
        * The client takes ownership of the returned operation object.
williamr@4
   400
        *
williamr@4
   401
        * While removing landmarks, this operation will acquire a write-lock on
williamr@4
   402
        * the database.
williamr@4
   403
        *
williamr@4
   404
        * This function requires @p ReadUserData and @p WriteUserData
williamr@4
   405
        * capabilities.
williamr@4
   406
        *
williamr@4
   407
        * @returns A handle to the operation.
williamr@4
   408
        *
williamr@4
   409
        * @leave KErrAccessDenied The database is read-only.
williamr@4
   410
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   411
        */
williamr@4
   412
        virtual CPosLmOperation* RemoveAllLandmarksL() = 0;
williamr@4
   413
williamr@4
   414
        /**
williamr@4
   415
        * Returns the partial read parameters for this database handle.
williamr@4
   416
        *
williamr@4
   417
        * Partial read parameters are used to define which landmark data should
williamr@4
   418
        * be returned when @ref ReadPartialLandmarkLC is called.
williamr@4
   419
        *
williamr@4
   420
        * The client takes ownership of the returned parameter object.
williamr@4
   421
        *
williamr@4
   422
        * @returns The current partial read parameters.
williamr@4
   423
        */
williamr@4
   424
        virtual CPosLmPartialReadParameters* PartialReadParametersLC() = 0;
williamr@4
   425
williamr@4
   426
        /**
williamr@4
   427
        * Sets the partial read parameters for this database handle.
williamr@4
   428
        *
williamr@4
   429
        * Partial read parameters are used to define which landmark data should
williamr@4
   430
        * be returned when @ref ReadPartialLandmarkLC is called.
williamr@4
   431
        *
williamr@4
   432
        * @param[in] aPartialSettings The new partial read parameters.
williamr@4
   433
        */
williamr@4
   434
        virtual void SetPartialReadParametersL(
williamr@4
   435
               const CPosLmPartialReadParameters&  aPartialSettings
williamr@4
   436
        ) = 0;
williamr@4
   437
williamr@4
   438
        /**
williamr@4
   439
        * Reads partial data from a landmark in the database.
williamr@4
   440
        *
williamr@4
   441
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   442
        *
williamr@4
   443
        * Partial settings define which landmark data should be returned in
williamr@4
   444
        * this call. Partial read attributes are defined by calling
williamr@4
   445
        * @ref SetPartialReadParametersL. If no partial read parameters have
williamr@4
   446
        * been set, the landmarks will not contain any attributes.
williamr@4
   447
        *
williamr@4
   448
        * The client takes ownership of the returned landmark object.
williamr@4
   449
        *
williamr@4
   450
        * This function requires @p ReadUserData capability.
williamr@4
   451
        *
williamr@4
   452
        * @param The ID of the landmark to read.
williamr@4
   453
        * @returns The requested landmark. The landmark object will only
williamr@4
   454
        *   contain the attributes defined in the partial read attributes. The
williamr@4
   455
        *   landmark object is put on the cleanup stack.
williamr@4
   456
        *
williamr@4
   457
        * @leave KErrNotFound The requested landmark does not exist in the database.
williamr@4
   458
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   459
        */
williamr@4
   460
        virtual CPosLandmark* ReadPartialLandmarkLC(
williamr@4
   461
               TPosLmItemId  aLandmarkId
williamr@4
   462
        ) = 0;
williamr@4
   463
williamr@4
   464
        /**
williamr@4
   465
        * Reads partial data from a set of landmarks in the database.
williamr@4
   466
        *
williamr@4
   467
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   468
        *
williamr@4
   469
        * Partial settings define which landmark data should be read. Partial
williamr@4
   470
        * read attributes are defined by calling @ref SetPartialReadParametersL.
williamr@4
   471
        * If no partial read parameters have been set, the landmarks will not
williamr@4
   472
        * contain any attributes.
williamr@4
   473
        *
williamr@4
   474
        * Note that the returned data may be very big if all attributes in
williamr@4
   475
        * each landmark are requested. A typical use for this function is to
williamr@4
   476
        * retrieve the names for a set of landmarks.
williamr@4
   477
        *
williamr@4
   478
        * When the request is completed, the result can be retrieved by calling
williamr@4
   479
        * @ref TakePreparedPartialLandmarksL.
williamr@4
   480
        *
williamr@4
   481
        * The function returns an operation object which can be run in
williamr@4
   482
        * incremental mode. If it is run incrementally the client can supervise
williamr@4
   483
        * the progress of the operation.
williamr@4
   484
        *
williamr@4
   485
        * The client takes ownership of the returned operation object.
williamr@4
   486
        *
williamr@4
   487
        * While preparing landmark information, this operation will acquire a
williamr@4
   488
        * read-lock on the database.
williamr@4
   489
        *
williamr@4
   490
        * This function requires @p ReadUserData capability.
williamr@4
   491
        *
williamr@4
   492
        * @param[in] aLandmarkIdArray An array with IDs of the landmarks to read.
williamr@4
   493
        * @returns A handle to the operation.
williamr@4
   494
        *
williamr@4
   495
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   496
        */
williamr@4
   497
        virtual CPosLmOperation* PreparePartialLandmarksL(
williamr@4
   498
               const RArray<TPosLmItemId>&  aLandmarkIdArray
williamr@4
   499
        ) = 0;
williamr@4
   500
williamr@4
   501
        /**
williamr@4
   502
        * Fetches the result from a call to @ref PreparePartialLandmarksL.
williamr@4
   503
        *
williamr@4
   504
        * @pre A call to this function must be preceeded by successful call to
williamr@4
   505
        *   @ref PreparePartialLandmarksL.
williamr@4
   506
        *
williamr@4
   507
        * The returned array will have the same length as the ID array passed
williamr@4
   508
        * in the @ref PreparePartialLandmarksL call and it will have the same
williamr@4
   509
        * order.
williamr@4
   510
        *
williamr@4
   511
        * If reading a landmark failed during preparation, the corresponding
williamr@4
   512
        * pointer value in the returned array will be NULL. For instance,
williamr@4
   513
        * reading can fail if the specified ID does not exist in the database.
williamr@4
   514
        *
williamr@4
   515
        * The client takes ownership of the returned array object including
williamr@4
   516
        * the contained landmark objects.
williamr@4
   517
        *
williamr@4
   518
        * @param[in] aPreparePartialLandmarkOperation The operation object returned
williamr@4
   519
        *   by the @ref PreparePartialLandmarksL function.
williamr@4
   520
        *
williamr@4
   521
        * @returns An array containing the prepared partial landmark objects.
williamr@4
   522
        *
williamr@4
   523
        * @leave KErrNotFound @ref PreparePartialLandmarksL hasn't been called yet or
williamr@4
   524
        *   it didn't succeed or this function has been called already since then.
williamr@4
   525
        */
williamr@4
   526
        virtual CArrayPtr<CPosLandmark>* TakePreparedPartialLandmarksL(
williamr@4
   527
               CPosLmOperation*  aPreparePartialLandmarkOperation
williamr@4
   528
        ) = 0;
williamr@4
   529
williamr@4
   530
        /**
williamr@4
   531
        * Returns a URI which points to the landmark database storage.
williamr@4
   532
        *
williamr@4
   533
        * The URI may point to a file in the terminal file system or on a
williamr@4
   534
        * remote file.
williamr@4
   535
        *
williamr@4
   536
        * The client takes ownership of the returned descriptor.
williamr@4
   537
        *
williamr@4
   538
        * @returns The database URI. The URI is put on the cleanup stack.
williamr@4
   539
        */
williamr@4
   540
        virtual HBufC* DatabaseUriLC() = 0;
williamr@4
   541
williamr@4
   542
        /**
williamr@4
   543
        * Returns size information for the database.
williamr@4
   544
        *
williamr@4
   545
        * This function requires @p ReadUserData capability.
williamr@4
   546
        *
williamr@4
   547
        * @returns Size information for the database.
williamr@4
   548
        */
williamr@4
   549
        virtual TSize SizeL() = 0;
williamr@4
   550
williamr@4
   551
        /**
williamr@4
   552
        * Compacts the landmark database.
williamr@4
   553
        *
williamr@4
   554
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   555
        *
williamr@4
   556
        * Compaction means that any unused space in the database is removed.
williamr@4
   557
        *
williamr@4
   558
        * The function returns an operation object which can be run in
williamr@4
   559
        * incremental mode. If it is run incrementally the client can supervise
williamr@4
   560
        * the progress of the operation.
williamr@4
   561
        *
williamr@4
   562
        * The client takes ownership of the returned operation object.
williamr@4
   563
        *
williamr@4
   564
        * This function requires @p ReadUserData and @p WriteUserData
williamr@4
   565
        * capabilities.
williamr@4
   566
        *
williamr@4
   567
        * @returns A handle to the operation.
williamr@4
   568
        *
williamr@4
   569
        * @leave KErrAccessDenied The database is read-only.
williamr@4
   570
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   571
        */
williamr@4
   572
        virtual CPosLmOperation* CompactL() = 0;
williamr@4
   573
williamr@4
   574
        /**
williamr@4
   575
        * Listens for database events.
williamr@4
   576
        *
williamr@4
   577
        * This function is asynchronous and it will complete the request
williamr@4
   578
        * status when an event occurs. At this time @p aEvent input parameter
williamr@4
   579
        * is updated and the client can read event information from it.
williamr@4
   580
        *
williamr@4
   581
        * Event listening can be cancelled by calling
williamr@4
   582
        * @ref CancelNotifyDatabaseEvent.
williamr@4
   583
        *
williamr@4
   584
        * This function requires @p ReadUserData capability.
williamr@4
   585
        *
williamr@4
   586
        * @param[out] aEvent Upon completion contains the event information.
williamr@4
   587
        * @param[out] aStatus Upon completion contains status of the request.
williamr@4
   588
        *   @p KErrNotSupported if events are not supported.
williamr@4
   589
        *   @p KErrNone if an event occured, otherwise an error code if some error was encountered.
williamr@4
   590
        *
williamr@4
   591
        * @panic "Landmarks Client"-EPosEventNotifierAlreadyHasOutstandingRequest
williamr@4
   592
        *   Client already has an outstanding @ref NotifyDatabaseEvent request.
williamr@4
   593
        */
williamr@4
   594
        virtual void NotifyDatabaseEvent(
williamr@4
   595
           TPosLmEvent& aEvent,
williamr@4
   596
           TRequestStatus& aStatus
williamr@4
   597
        ) = 0;
williamr@4
   598
williamr@4
   599
        /**
williamr@4
   600
        * Cancels a call to @ref NotifyDatabaseEvent.
williamr@4
   601
        *
williamr@4
   602
        * This function requires @p ReadUserData capability.
williamr@4
   603
        *
williamr@4
   604
        * @return @p KErrNone if the request was successfully cancelled,
williamr@4
   605
        *   otherwise a system wide error code.
williamr@4
   606
        */
williamr@4
   607
        virtual TInt CancelNotifyDatabaseEvent() = 0;
williamr@4
   608
williamr@4
   609
        /**
williamr@4
   610
        * Exports a number of landmarks.
williamr@4
   611
        *
williamr@4
   612
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   613
        *
williamr@4
   614
        * To export a set of landmarks, the client must first create a
williamr@4
   615
        * @ref CPosLandmarkEncoder object for the landmark content format in
williamr@4
   616
        * which the landmarks should be encoded. The client can add some
williamr@4
   617
        * information of the landmark collection in the encoder as well.
williamr@4
   618
        *
williamr@4
   619
        * The client must also provide a list of the landmarks which should be
williamr@4
   620
        * exported. If one of the landmarks are not found in the database, the returned
williamr@4
   621
        * operation fails with error code @p KErrNotFound.
williamr@4
   622
        *
williamr@4
   623
        * The client does not have to add any landmarks to the encoder object.
williamr@4
   624
        * This function will add the ones specified in the ID array.
williamr@4
   625
        *
williamr@4
   626
        * The function returns an operation object which can be run in
williamr@4
   627
        * incremental mode. If it is run incrementally the client can supervise
williamr@4
   628
        * the progress of the operation.
williamr@4
   629
        *
williamr@4
   630
        * If the @ref CPosLmOperation object is deleted before the operation
williamr@4
   631
        * is complete, it is possible that only a subset of the landmarks have
williamr@4
   632
        * been exported.
williamr@4
   633
        *
williamr@4
   634
        * The client takes ownership of the returned operation object.
williamr@4
   635
        *
williamr@4
   636
        * When all landmarks have been exported the client must finalize
williamr@4
   637
        * encoding by calling @ref CPosLandmarkEncoder::FinalizeEncodingL.
williamr@4
   638
        *
williamr@4
   639
        * This function requires @p ReadUserData capability.
williamr@4
   640
        *
williamr@4
   641
        * @param[in] aLandmarkEncoder A landmark encoder object.
williamr@4
   642
        * @param[in] aLandmarkIdArray The landmarks which should be exported.
williamr@4
   643
        * @param[in] aTransferOptions A bitmap representing the options for the
williamr@4
   644
        *   export operation. The bitmap values are defined by
williamr@4
   645
        *   @ref _TTransferOptions.
williamr@4
   646
        *
williamr@4
   647
        * @returns A handle to the operation.
williamr@4
   648
        *
williamr@4
   649
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   650
        *
williamr@4
   651
        * @panic "Landmarks Client"-EPosLmInvalidArgument
williamr@4
   652
        *   Client specified invalid transfer option values.
williamr@4
   653
        */
williamr@4
   654
        virtual CPosLmOperation* ExportLandmarksL(
williamr@4
   655
               CPosLandmarkEncoder&  aLandmarkEncoder,
williamr@4
   656
               const RArray<TPosLmItemId>&  aLandmarkIdArray,
williamr@4
   657
               TTransferOptions  aTransferOptions
williamr@4
   658
        ) = 0;
williamr@4
   659
williamr@4
   660
        /**
williamr@4
   661
        * Import a set of landmarks.
williamr@4
   662
        *
williamr@4
   663
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   664
        *
williamr@4
   665
        * To import landmark content, the client must first create a parser
williamr@4
   666
        * object which can parse the landmark content. The client does not have
williamr@4
   667
        * to call @ref CPosLandmarkParser::ParseContentL first. If the content
williamr@4
   668
        * is not already parsed, this will be handled by the import operation.
williamr@4
   669
        *
williamr@4
   670
        * The function returns an operation object which can be run in
williamr@4
   671
        * incremental mode. If it is run incrementally the client can supervise
williamr@4
   672
        * the progress of the operation.
williamr@4
   673
        *
williamr@4
   674
        * If the @ref CPosLmOperation object is deleted before the operation
williamr@4
   675
        * is complete, it is possible that only a subset of the landmarks have
williamr@4
   676
        * been imported.
williamr@4
   677
        *
williamr@4
   678
        * The client takes ownership of the returned operation object.
williamr@4
   679
        *
williamr@4
   680
        * After completion @ref ImportedLandmarksIteratorL can be called to
williamr@4
   681
        * retrieve the IDs of the added landmarks.
williamr@4
   682
        *
williamr@4
   683
        * The @p NextStep function in the operation object cannot be executed
williamr@4
   684
        * synchronously using @p User::WaitForRequest. Doing so may cause the
williamr@4
   685
        * operation to hang. @p NextStep must be run using an active object
williamr@4
   686
        * for this operation.
williamr@4
   687
        *
williamr@4
   688
        * This function requires @p ReadUserData and @p WriteUserData
williamr@4
   689
        * capabilities.
williamr@4
   690
        *
williamr@4
   691
        * @param[in] aLandmarkParser An object which can parse landmark content.
williamr@4
   692
        * @param[in] aTransferOptions A bitmap representing the options for the
williamr@4
   693
        *   import operation. The bitmap values are defined by
williamr@4
   694
        *   @ref _TTransferOptions.
williamr@4
   695
        *
williamr@4
   696
        * @returns A handle to the operation.
williamr@4
   697
        *
williamr@4
   698
        * @leave KErrAccessDenied The database is read-only.
williamr@4
   699
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   700
        *
williamr@4
   701
        * @panic "Landmarks Client"-EPosLmInvalidArgument
williamr@4
   702
        *   Client specified invalid transfer option values.
williamr@4
   703
        */
williamr@4
   704
        virtual CPosLmOperation* ImportLandmarksL(
williamr@4
   705
               CPosLandmarkParser&  aLandmarkParser,
williamr@4
   706
               TTransferOptions  aTransferOptions
williamr@4
   707
        ) = 0;
williamr@4
   708
williamr@4
   709
        /**
williamr@4
   710
        * Import a set of landmarks.
williamr@4
   711
        *
williamr@4
   712
        * @pre Database is initialized (see @ref IsInitializingNeeded).
williamr@4
   713
        *
williamr@4
   714
        * To import landmark content, the client must first create a parser
williamr@4
   715
        * object which can parse the landmark content. The client does not have
williamr@4
   716
        * to call @ref CPosLandmarkParser::ParseContentL first. If the content
williamr@4
   717
        * is not already parsed, this will be handled by the import operation.
williamr@4
   718
        *
williamr@4
   719
        * In this overload of the function, the client can pass an array
williamr@4
   720
        * defining a subset of the landmarks in the parser object. This way
williamr@4
   721
        * the client can select to import only a part of the landmark content.
williamr@4
   722
        *
williamr@4
   723
        * The function returns an operation object which can be run in
williamr@4
   724
        * incremental mode. If it is run incrementally the client can supervise
williamr@4
   725
        * the progress of the operation.
williamr@4
   726
        *
williamr@4
   727
        * If the @ref CPosLmOperation object is deleted before the operation
williamr@4
   728
        * is complete, it is possible that only a subset of the landmarks have
williamr@4
   729
        * been imported.
williamr@4
   730
        *
williamr@4
   731
        * The client takes ownership of the returned operation object.
williamr@4
   732
        *
williamr@4
   733
        * After completion @ref ImportedLandmarksIteratorL can be called to
williamr@4
   734
        * retrieve the IDs of the added landmarks.
williamr@4
   735
        *
williamr@4
   736
        * The @p NextStep function in the operation object cannot be executed
williamr@4
   737
        * synchronously using @p User::WaitForRequest. Doing so may cause the
williamr@4
   738
        * operation to hang. @p NextStep must be run using an active object
williamr@4
   739
        * for this operation.
williamr@4
   740
        *
williamr@4
   741
        * This function requires @p ReadUserData and @p WriteUserData
williamr@4
   742
        * capabilities.
williamr@4
   743
        *
williamr@4
   744
        * @param[in] aLandmarkParser An object which can parse landmark content.
williamr@4
   745
        * @param[in] aLandmarkSelection An array defining which of the parsed
williamr@4
   746
        *   landmarks to import. The array items refer to the order in which
williamr@4
   747
        *   @ref CPosLandmarkParser accesses the landmarks. 0 means the first
williamr@4
   748
        *   parsed landmark, 1 means the second, etc. If the parser supports
williamr@4
   749
        *   indexing, these numbers correspond to the index values used to
williamr@4
   750
        *   access the landmarks in @ref CPosLandmarkParser::LandmarkLC. The
williamr@4
   751
        *   index values must be less than the number of landmarks accessed by
williamr@4
   752
        *   the parser, otherwise the operation object will panic with error
williamr@4
   753
        *   code @p EPosInvalidIndex during execution. @p Note: The indexes
williamr@4
   754
        *   can be used regardless of whether the parser supports indexing or
williamr@4
   755
        *   not.
williamr@4
   756
        * @param aTransferOptions A bitmap representing the options for the
williamr@4
   757
        *   import operation. The bitmap values are defined by
williamr@4
   758
        *   @ref _TTransferOptions.
williamr@4
   759
        * @returns A handle to the operation.
williamr@4
   760
        *
williamr@4
   761
        * @leave KErrAccessDenied The database is read-only.
williamr@4
   762
        * @leave KErrPosLmNotInitialized Database is not yet initialized.
williamr@4
   763
        *
williamr@4
   764
        * @panic "Landmarks Client"-EPosLmInvalidArgument
williamr@4
   765
        *   Client specified invalid transfer option values.
williamr@4
   766
        */
williamr@4
   767
        virtual CPosLmOperation* ImportLandmarksL(
williamr@4
   768
               CPosLandmarkParser&  aLandmarkParser,
williamr@4
   769
               const RArray<TUint>&  aLandmarkSelection,
williamr@4
   770
               TTransferOptions  aTransferOptions
williamr@4
   771
        ) = 0;
williamr@4
   772
williamr@4
   773
        /**
williamr@4
   774
        * Returns an object for iterating the landmarks added in an import
williamr@4
   775
        * operation.
williamr@4
   776
        *
williamr@4
   777
        * To import landmarks @ref ImportLandmarksL is used.
williamr@4
   778
        *
williamr@4
   779
        * If @ref ImportedLandmarksIteratorL is called before the
williamr@4
   780
        * @ref ImportLandmarksL operation has completed, the iterator will
williamr@4
   781
        * iterate the landmarks imported so far. Landmarks imported after
williamr@4
   782
        * the iterator is obtained will not affect the iterator. A new
williamr@4
   783
        * iterator must be obtained to iterate these new landmarks.
williamr@4
   784
        *
williamr@4
   785
        * The client takes ownership of the returned iterator object.
williamr@4
   786
        *
williamr@4
   787
        * @param[in] aImportOperation This object is returned by
williamr@4
   788
        *   @ref ImportLandmarksL methods.
williamr@4
   789
        * @returns An object for iterating the landmarks added in the latest
williamr@4
   790
        *   import operation.
williamr@4
   791
        */
williamr@4
   792
        virtual CPosLmItemIterator* ImportedLandmarksIteratorL(
williamr@4
   793
               CPosLmOperation*  aImportOperation
williamr@4
   794
        ) = 0;
williamr@4
   795
williamr@4
   796
        /**
williamr@4
   797
        * @internal */
williamr@4
   798
        /*
williamr@4
   799
        * Returns the database access implementation ID.
williamr@4
   800
        *
williamr@4
   801
        * @returns The @ref CPosLandmarkDatabase implementation ID.
williamr@4
   802
        */
williamr@4
   803
        TUid ImplementationId() const;
williamr@4
   804
williamr@4
   805
    protected:
williamr@4
   806
williamr@4
   807
        // C++ constructor.
williamr@4
   808
        IMPORT_C CPosLandmarkDatabase();
williamr@4
   809
williamr@4
   810
    private:
williamr@4
   811
williamr@4
   812
        // Prohibit copy constructor
williamr@4
   813
        CPosLandmarkDatabase( const CPosLandmarkDatabase& );
williamr@4
   814
        // Prohibit assigment operator
williamr@4
   815
        CPosLandmarkDatabase& operator= ( const CPosLandmarkDatabase& );
williamr@4
   816
williamr@4
   817
    protected:
williamr@4
   818
williamr@4
   819
        // Implementation Uid
williamr@4
   820
        TUid iDtorIdKey;
williamr@4
   821
    };
williamr@4
   822
williamr@4
   823
#endif      // CPOSLANDMARKDATABASE_H
williamr@4
   824
williamr@4
   825