epoc32/include/mw/epos_cposlmoperation.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  CPosLmOperation class
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef CPOSLMOPERATION_H
williamr@2
    20
#define CPOSLMOPERATION_H
williamr@2
    21
williamr@2
    22
#include <e32base.h>
williamr@2
    23
williamr@2
    24
class CPosLmOperation;
williamr@2
    25
williamr@2
    26
/**
williamr@2
    27
*  Executes the operation synchronously and then deletes it.
williamr@2
    28
*
williamr@2
    29
*  All functions which return a @ref CPosLmOperation object can be run
williamr@2
    30
*  incrementally. If the client is not interested in running it
williamr@2
    31
*  incrementally, it can call @ref CPosLmOperation::ExecuteL to run the
williamr@2
    32
*  whole operation in one batch. This can be simplified by using
williamr@2
    33
*  @ref ExecuteAndDeleteLD. It runs the operation and deletes the object
williamr@2
    34
*  when it is done.
williamr@2
    35
*
williamr@2
    36
*  For instance, to use this function for
williamr@2
    37
*  @ref CPosLandmarkDatabase::InitializeL, the client would call
williamr@2
    38
*
williamr@2
    39
*  ExecuteAndDeleteLD( database->InitializeL() );
williamr@2
    40
*
williamr@2
    41
*  The operation object should not be on the cleanup stack when this function
williamr@2
    42
*  is called.
williamr@2
    43
*
williamr@2
    44
*  @since S60 3.0
williamr@2
    45
*  @param aOperation The operation to handle. It will be deleted when the
williamr@2
    46
*   function returns.
williamr@2
    47
*/
williamr@2
    48
inline void ExecuteAndDeleteLD( CPosLmOperation* aOperation );
williamr@2
    49
williamr@2
    50
williamr@2
    51
/**
williamr@2
    52
*  Base class for handles to landmark operations.
williamr@2
    53
*
williamr@2
    54
*  Long running operations in the Landmarks API returns an object of this class
williamr@2
    55
*  so that the client can run it incrementally and check the progress of the
williamr@2
    56
*  operation.
williamr@2
    57
*
williamr@2
    58
*  The operation must explicitly be run by the client. The operation can
williamr@2
    59
*  be run incrementally by calling @ref NextStep until it does not return
williamr@2
    60
*  the status @p KPosLmOperationNotComplete. Alternately the operation can be
williamr@2
    61
*  run synchronously by calling @ref ExecuteL.
williamr@2
    62
*
williamr@2
    63
*  @ref ExecuteAndDeleteLD can be used to handle the operation object if
williamr@2
    64
*  it is run in synchronous mode.
williamr@2
    65
*
williamr@2
    66
*  @lib eposlandmarks.lib
williamr@2
    67
*  @since S60 3.0
williamr@2
    68
*/
williamr@2
    69
class CPosLmOperation : public CBase
williamr@2
    70
    {
williamr@2
    71
    public:
williamr@2
    72
williamr@2
    73
        /**
williamr@2
    74
        * Destructor.
williamr@2
    75
        */
williamr@2
    76
        IMPORT_C virtual ~CPosLmOperation();
williamr@2
    77
williamr@2
    78
    public:
williamr@2
    79
williamr@2
    80
        /**
williamr@2
    81
        * Incremental execution of the operation.
williamr@2
    82
        *
williamr@2
    83
        * The client should use an active object and call this function until
williamr@2
    84
        * it does not complete with status @p KPosLmOperationNotComplete.
williamr@2
    85
        *
williamr@2
    86
        * When the operation has finished, this function will complete with
williamr@2
    87
        * status @p KErrNone if the operation was successful, or an error code
williamr@2
    88
        * if some error was encountered.
williamr@2
    89
        *
williamr@2
    90
        * This function also returns a progress of the operation. Progress is a
williamr@2
    91
        * floating point number in the interval [0.0,1.0]. 0.0 indicates that
williamr@2
    92
        * the operation has not started and 1.0 indicates that the operation
williamr@2
    93
        * has completed.
williamr@2
    94
        *
williamr@2
    95
        * Note that this function is asynchronous which means that status and
williamr@2
    96
        * progress may not be set when the function returns. They are only
williamr@2
    97
        * guaranteed to be set when the request is completed.
williamr@2
    98
        *
williamr@2
    99
        * The only way to cancel an operation is to delete the operation
williamr@2
   100
        * object. This will also cancel any outstanding request to
williamr@2
   101
        * NextStep().
williamr@2
   102
        *
williamr@2
   103
        * @param[out] aStatus The request status. Upon request completion contains
williamr@2
   104
        *   step status: 
williamr@2
   105
        *   - @p KPosLmOperationNotComplete if the step has completed but more
williamr@2
   106
        *   steps are needed before the operation will be completed. 
williamr@2
   107
        *   - @p KErrNone if the operation has finished successfully. 
williamr@2
   108
        *   - An error code if the operation has failed.
williamr@2
   109
        * @param[out] aProgress Upon request completion is set to the progress 
williamr@2
   110
        *   of the operation.
williamr@2
   111
        *
williamr@2
   112
        * @panic "Landmarks Client"-EPosInvalidOperationMode 
williamr@2
   113
        *   The function is called when the operation is already complete.
williamr@2
   114
        */
williamr@2
   115
        virtual void NextStep(
williamr@2
   116
            TRequestStatus& aStatus,
williamr@2
   117
            TReal32& aProgress
williamr@2
   118
        ) = 0;
williamr@2
   119
williamr@2
   120
        /**
williamr@2
   121
        * Synchronous execution of the operation.
williamr@2
   122
        *
williamr@2
   123
        * When this function returns, the operation has finished.
williamr@2
   124
        *
williamr@2
   125
        * @panic "Landmarks Client"-EPosInvalidOperationMode 
williamr@2
   126
        *   -# This function is called when the operation is already complete
williamr@2
   127
        *   -# The operation has already been started incrementally using @ref NextStep().
williamr@2
   128
        */
williamr@2
   129
        virtual void ExecuteL() = 0;
williamr@2
   130
williamr@2
   131
    protected:
williamr@2
   132
williamr@2
   133
        // C++ constructor.
williamr@2
   134
        IMPORT_C CPosLmOperation();
williamr@2
   135
williamr@2
   136
    private:
williamr@2
   137
williamr@2
   138
        // Prohibit copy constructor
williamr@2
   139
        CPosLmOperation( const CPosLmOperation& );
williamr@2
   140
        // Prohibit assigment operator
williamr@2
   141
        CPosLmOperation& operator= ( const CPosLmOperation& );
williamr@2
   142
williamr@2
   143
    };
williamr@2
   144
williamr@2
   145
#include "EPos_CPosLmOperation.inl"
williamr@2
   146
williamr@2
   147
#endif      // CPOSLMOPERATION_H
williamr@2
   148
williamr@2
   149