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