2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: CPosLmOperation class
19 #ifndef CPOSLMOPERATION_H
20 #define CPOSLMOPERATION_H
24 class CPosLmOperation;
27 * Executes the operation synchronously and then deletes it.
29 * All functions which return a @ref CPosLmOperation object can be run
30 * incrementally. If the client is not interested in running it
31 * incrementally, it can call @ref CPosLmOperation::ExecuteL to run the
32 * whole operation in one batch. This can be simplified by using
33 * @ref ExecuteAndDeleteLD. It runs the operation and deletes the object
36 * For instance, to use this function for
37 * @ref CPosLandmarkDatabase::InitializeL, the client would call
39 * ExecuteAndDeleteLD( database->InitializeL() );
41 * The operation object should not be on the cleanup stack when this function
45 * @param aOperation The operation to handle. It will be deleted when the
48 inline void ExecuteAndDeleteLD( CPosLmOperation* aOperation );
52 * Base class for handles to landmark operations.
54 * Long running operations in the Landmarks API returns an object of this class
55 * so that the client can run it incrementally and check the progress of the
58 * The operation must explicitly be run by the client. The operation can
59 * be run incrementally by calling @ref NextStep until it does not return
60 * the status @p KPosLmOperationNotComplete. Alternately the operation can be
61 * run synchronously by calling @ref ExecuteL.
63 * @ref ExecuteAndDeleteLD can be used to handle the operation object if
64 * it is run in synchronous mode.
66 * @lib eposlandmarks.lib
69 class CPosLmOperation : public CBase
76 IMPORT_C virtual ~CPosLmOperation();
81 * Incremental execution of the operation.
83 * The client should use an active object and call this function until
84 * it does not complete with status @p KPosLmOperationNotComplete.
86 * When the operation has finished, this function will complete with
87 * status @p KErrNone if the operation was successful, or an error code
88 * if some error was encountered.
90 * This function also returns a progress of the operation. Progress is a
91 * floating point number in the interval [0.0,1.0]. 0.0 indicates that
92 * the operation has not started and 1.0 indicates that the operation
95 * Note that this function is asynchronous which means that status and
96 * progress may not be set when the function returns. They are only
97 * guaranteed to be set when the request is completed.
99 * The only way to cancel an operation is to delete the operation
100 * object. This will also cancel any outstanding request to
103 * @param[out] aStatus The request status. Upon request completion contains
105 * - @p KPosLmOperationNotComplete if the step has completed but more
106 * steps are needed before the operation will be completed.
107 * - @p KErrNone if the operation has finished successfully.
108 * - An error code if the operation has failed.
109 * @param[out] aProgress Upon request completion is set to the progress
112 * @panic "Landmarks Client"-EPosInvalidOperationMode
113 * The function is called when the operation is already complete.
115 virtual void NextStep(
116 TRequestStatus& aStatus,
121 * Synchronous execution of the operation.
123 * When this function returns, the operation has finished.
125 * @panic "Landmarks Client"-EPosInvalidOperationMode
126 * -# This function is called when the operation is already complete
127 * -# The operation has already been started incrementally using @ref NextStep().
129 virtual void ExecuteL() = 0;
134 IMPORT_C CPosLmOperation();
138 // Prohibit copy constructor
139 CPosLmOperation( const CPosLmOperation& );
140 // Prohibit assigment operator
141 CPosLmOperation& operator= ( const CPosLmOperation& );
145 #include "EPos_CPosLmOperation.inl"
147 #endif // CPOSLMOPERATION_H