examples/Messaging/Imap4Example/asyncwaiter.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 // This encapsulates both issuing a request to an asynchronous service provider 
00015 // and handling the completed requests.
00016 //
00017 
00018 
00019 
00024 #include "asyncwaiter.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 CMessAsyncWaiter::~CMessAsyncWaiter()
00044         {
00045         Cancel();
00046         }
00047 
00052 void CMessAsyncWaiter::StartAndWait()
00053         {
00054         SetActive();
00055         CActiveScheduler::Start();
00056         }
00057 
00062 TInt CMessAsyncWaiter::Result() const
00063         {
00064         return iError;
00065         }
00066 
00071 void CMessAsyncWaiter::RunL()
00072         {
00073         iError = iStatus.Int();
00074         CActiveScheduler::Stop();
00075         }
00076 
00081 void CMessAsyncWaiter::DoCancel()
00082         {
00083         iError = KErrCancel;
00084         CActiveScheduler::Stop();
00085         }

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