codhandler/codui/inc/RequestCompleteCallback.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2004 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 the License "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:  Declaration of class CRequestCompleteCallback.h   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef REQUEST_COMPLETE_CALLBACK_H
       
    20 #define REQUEST_COMPLETE_CALLBACK_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 // CLASS DECLARATION
       
    27 
       
    28 /**
       
    29 * Active object to transfer a request completion to a callback.
       
    30 * NOTE: This object handles only completion, but not cancellation. It does not
       
    31 * make ('own') the request, therefore it cannot possibly cancel.
       
    32 * Users of this object must make sure that the request is already completed
       
    33 * or cancelled before this object is cancelled/deleted. DoCancel() of this
       
    34 * object panics (to avoid the hang).
       
    35 */
       
    36 NONSHARABLE_CLASS( CRequestCompleteCallback ): public CActive
       
    37     {
       
    38 
       
    39     public:     // Constructors and destructor
       
    40 
       
    41         /**
       
    42         * Constructor.
       
    43         */      
       
    44         CRequestCompleteCallback();
       
    45         
       
    46         /**
       
    47         * Destructor.
       
    48         */      
       
    49         virtual ~CRequestCompleteCallback();
       
    50 
       
    51     public:     // new methods
       
    52 
       
    53         /**
       
    54         * Start waiting for completion. A request (on iStatus of this object)
       
    55         * must be outstanding.
       
    56         * @param aCallback Callback to call when request completes.
       
    57         * Note that the callback is called only once per CallbackOnCompletion()
       
    58         * invocation (like in CAsyncOneShot etc.), and repeated callbacks are
       
    59         * not supported. Therefore, the callback function must return EFalse.
       
    60         */
       
    61         void CallbackOnCompletion( const TCallBack& aCallback );
       
    62 
       
    63     public:     // from CActive
       
    64 
       
    65         /**
       
    66         * Cancel protocol implementation: panic
       
    67         * This object cannot cancel the request.
       
    68         */
       
    69         void DoCancel();
       
    70 
       
    71         /**
       
    72         * Request completed: call the callback.
       
    73         */
       
    74         void RunL();
       
    75 
       
    76     private:    // data
       
    77 
       
    78         TCallBack iCallback;    ///< The callback.
       
    79 
       
    80     };
       
    81 
       
    82 #endif /* def REQUEST_COMPLETE_CALLBACK_H */