S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CLandmarksLmOpWrapper Class Reference

#include <LandmarksLmOpWrapper.h>

List of all members.

Public Member Functions

 CLandmarksLmOpWrapper ()
 ~CLandmarksLmOpWrapper ()
void StartOperation (CPosLmOperation *aLmOperation, TRequestStatus &aStatus, TBool aReportProgress=EFalse)
CPosLmOperation * LmOperationPtr ()
void ExecuteNextStep (TRequestStatus &aStatus)
TInt Progress ()

Protected Member Functions

void DoCancel ()
void RunL ()

Private Member Functions

void ExecuteNextStep ()

Private Attributes

CPosLmOperation * iLmOperation
 the wrapped CPosLmOperation that is executed
TReal32 iProgress
 contains a value between 0-1 and indicates the progress
TRequestStatus * iCallerStatus
 the req. status of the caller executing the operation
TBool iReportProgress
 indicates if progress should be reported or not


Detailed Description

Active class that wraps an instance of CPosLmOperation. The wrapped CPosLmOperation instance is executed incrementally. Execution progress can be reported. This class is designed to be utilized by active objects.

Definition at line 36 of file LandmarksLmOpWrapper.h.


Constructor & Destructor Documentation

CLandmarksLmOpWrapper::CLandmarksLmOpWrapper (   ) 
 

C++ default constructor.

Definition at line 30 of file LandmarksLmOpWrapper.cpp.

00031 : CActive(CActive::EPriorityStandard)
00032     {
00033     CActiveScheduler::Add(this);
00034     }

CLandmarksLmOpWrapper::~CLandmarksLmOpWrapper (   ) 
 

Destructor.

Definition at line 37 of file LandmarksLmOpWrapper.cpp.

References iLmOperation.

00038     {
00039     Cancel();
00040     delete iLmOperation;
00041     iLmOperation = NULL;
00042     }


Member Function Documentation

void CLandmarksLmOpWrapper::StartOperation (  CPosLmOperation *  aLmOperation,
TRequestStatus &  aStatus,
TBool  aReportProgress = EFalse
) 
 

Starts execution of the supplied operation.

Parameters:
aLmOperation operation to execute. Ownership of the operation is transferred to this instance.
aStatus the request status to complete when execution of the supplied LmOperation is finished.
aReportProgress ETrue if progress should be reported (incremental execution), EFalse otherwise.

Definition at line 50 of file LandmarksLmOpWrapper.cpp.

References ExecuteNextStep(), iCallerStatus, iLmOperation, iProgress, and iReportProgress.

00054     {
00055     delete iLmOperation;
00056     iLmOperation = aLmOperation;
00057     iCallerStatus = &aStatus;
00058     iReportProgress = aReportProgress;
00059     iProgress = 0;
00060 
00061     ExecuteNextStep();
00062     }

CPosLmOperation * CLandmarksLmOpWrapper::LmOperationPtr (   ) 
 

Returns a pointer to the wrapped CPosLmOperation object. This object keeps ownership of the operation.

Returns:
a pointer to a CPosLmOperation instance

Definition at line 70 of file LandmarksLmOpWrapper.cpp.

References iLmOperation.

00071     {
00072     return iLmOperation;
00073     }

void CLandmarksLmOpWrapper::ExecuteNextStep (  TRequestStatus &  aStatus  ) 
 

Executes the next step of the incremental operation. Typically called when progress of the CPosLmOperaiotion is reported.

Parameters:
aStatus the request status to complete when execution of the next step is finished.

Definition at line 81 of file LandmarksLmOpWrapper.cpp.

References ExecuteNextStep(), and iCallerStatus.

00082     {
00083     iCallerStatus = &aStatus;
00084     ExecuteNextStep();
00085     }

TInt CLandmarksLmOpWrapper::Progress (   ) 
 

Return the current progress of the CPosLmnOperation.

Returns:
a number between 0-100. 100 means that the operation is completed

Definition at line 93 of file LandmarksLmOpWrapper.cpp.

References iProgress.

00094     {
00095     return (TInt) (iProgress * 100);
00096     }

void CLandmarksLmOpWrapper::DoCancel (   )  [protected]
 

Implements cancellation of an outstanding request.

Definition at line 104 of file LandmarksLmOpWrapper.cpp.

References iCallerStatus, and iLmOperation.

00105     {
00106     delete iLmOperation;
00107     iLmOperation = NULL;
00108     User::RequestComplete(iCallerStatus, KErrCancel);
00109     }

void CLandmarksLmOpWrapper::RunL (   )  [protected]
 

Handles an active object’s request completion event.

Definition at line 117 of file LandmarksLmOpWrapper.cpp.

References ExecuteNextStep(), iCallerStatus, and iReportProgress.

00118     {
00119     if (iStatus == KErrNone)
00120         {
00121         // Operation finished.
00122         User::RequestComplete(iCallerStatus, KErrNone);
00123         }
00124     else if (iStatus == KPosLmOperationNotComplete)
00125         {
00126         if (iReportProgress)
00127             {
00128             User::RequestComplete(iCallerStatus, KPosLmOperationNotComplete);
00129             }
00130         else
00131             {
00132             ExecuteNextStep();
00133             }
00134         }
00135     }

void CLandmarksLmOpWrapper::ExecuteNextStep (   )  [private]
 

Executes the next step of the incremental operation.

Definition at line 143 of file LandmarksLmOpWrapper.cpp.

References iLmOperation, and iProgress.

00144     {
00145     iStatus = KRequestPending;
00146     iLmOperation->NextStep(iStatus, iProgress);
00147     SetActive();
00148     }


© Nokia 2006

Back to top