tsrc/public/basic/atextpluginapitest/src/genericactive.cpp
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "genericactive.h"
       
    20 
       
    21 CGenericActive* CGenericActive::New(MGenericActiveObserver& aObserver, 
       
    22     CActive::TPriority aPriority, TInt aRequestId)
       
    23     {
       
    24     return new CGenericActive(aObserver, aPriority, aRequestId);
       
    25     }
       
    26 
       
    27 CGenericActive* CGenericActive::NewL(MGenericActiveObserver& aObserver, 
       
    28     CActive::TPriority aPriority, TInt aRequestId)
       
    29     {
       
    30     CGenericActive* self = new (ELeave) CGenericActive(aObserver, aPriority, aRequestId);
       
    31     return self;
       
    32     }
       
    33 
       
    34 CGenericActive::~CGenericActive()
       
    35     {
       
    36     Cancel();
       
    37     }
       
    38 
       
    39 void CGenericActive::GoActive()
       
    40     {
       
    41     SetActive();
       
    42     }
       
    43 
       
    44 TInt CGenericActive::RequestId() const
       
    45     {
       
    46     return iRequestId;
       
    47     }
       
    48 
       
    49 void CGenericActive::SetRequestId(TInt aRequestId)
       
    50     {
       
    51     iRequestId = aRequestId;
       
    52     }
       
    53 
       
    54 TRequestStatus& CGenericActive::RequestStatus()
       
    55     {
       
    56     return iStatus;
       
    57     }
       
    58 
       
    59 void CGenericActive::DoCancel()
       
    60     {
       
    61     iObserver.CancelRequest(*this);
       
    62     }
       
    63     
       
    64 void CGenericActive::RunL()
       
    65     {
       
    66     iObserver.RequestCompletedL(*this);
       
    67     }
       
    68     
       
    69 TInt CGenericActive::RunError(TInt aError)
       
    70     {
       
    71     return iObserver.HandleRunError(aError);
       
    72     }
       
    73 
       
    74 CGenericActive::CGenericActive(MGenericActiveObserver& aObserver, 
       
    75     CActive::TPriority aPriority, TInt aRequestId)
       
    76     : CActive(aPriority), iObserver(aObserver), iRequestId(aRequestId)
       
    77     {
       
    78     CActiveScheduler::Add(this);
       
    79     }