examples/Messaging/Pop3Example/MAsyncWaiter.cpp

Go to the documentation of this file.
00001 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.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         
00078 void CMessAsyncWaiter::DoCancel()
00079         {
00080         iError = KErrCancel;
00081         CActiveScheduler::Stop();
00082         }
00083 

Generated on Thu Jan 21 10:32:58 2010 for TB10.1 Example Applications by  doxygen 1.5.3