examples/Messaging/SearchSortExample/mAsyncWaiter.cpp

Go to the documentation of this file.
00001 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // License: "Symbian Foundation License v1.0" to Symbian Foundation
00004 // members and "Symbian Foundation End User License Agreement v1.0"
00005 // to non-members at the URL
00006 // "http://www.symbianfoundation.org/legal/licencesv10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 // Encapsulates both issuing a request to an asynchronous service provider 
00015 // and handling the completed requests.
00016 //
00017 
00018 
00019 
00024 #include "mAsyncWaiter.h"
00025 
00029 CMessAsyncWaiter* CMessAsyncWaiter::NewL()
00030         {
00031         CMessAsyncWaiter* self = new(ELeave) CMessAsyncWaiter();
00032         return self;
00033         }
00034 
00038 CMessAsyncWaiter::CMessAsyncWaiter() : CActive(EPriorityStandard)
00039         {
00040         CActiveScheduler::Add(this);
00041         }       
00042 
00043 
00044 CMessAsyncWaiter::~CMessAsyncWaiter()
00045         {
00046         Cancel();
00047         }
00048         
00053 void CMessAsyncWaiter::StartAndWait()
00054         {
00055         SetActive();
00056         CActiveScheduler::Start();
00057         }
00058         
00059 
00060 TInt CMessAsyncWaiter::Result() const
00061         {
00062         return iError;
00063         }
00064         
00069 void CMessAsyncWaiter::RunL()
00070         {
00071         iError = iStatus.Int();
00072         CActiveScheduler::Stop();
00073         }
00074         
00079 void CMessAsyncWaiter::DoCancel()
00080         {
00081         iError = KErrCancel;
00082         CActiveScheduler::Stop();
00083         }
00084 

Generated by  doxygen 1.6.2