applayerprotocols/httpservice/inc/mhttpcontentsink.h
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 #ifndef __MHTTPCONTENTSINK_H__
       
    18 #define __MHTTPCONTENTSINK_H__
       
    19 
       
    20 #include <e32base.h>
       
    21 
       
    22 class MHttpDataReceiver;
       
    23 /**
       
    24  * THttpContentSinkOp is an operator to retrieve/store/release the HTTP
       
    25  * content. The data consuming can be an asynchronous operation. After 
       
    26  * consuming the data Release/Store function must be called.
       
    27  * 
       
    28  * @publishedAll
       
    29  * @released
       
    30  */
       
    31 class THttpContentSinkOp
       
    32     {
       
    33     friend class CHttpDataReceiver;
       
    34     public:
       
    35     IMPORT_C THttpContentSinkOp();
       
    36     IMPORT_C TBool GetData(TPtrC8& aData);
       
    37     IMPORT_C void Release();
       
    38     IMPORT_C void Store(); // Store into a file if a sink is provided.
       
    39     
       
    40     private:
       
    41         THttpContentSinkOp(MHttpDataReceiver& aSupplier);
       
    42     private:
       
    43     MHttpDataReceiver* iDataReceiver;
       
    44     };
       
    45 
       
    46 /**
       
    47  * The implementation of MHttpContentSink can process the response body data  If the application wants to 
       
    48  * process/sink the data in different means then the client can insulate sink to a different sink
       
    49  * 
       
    50  * @publishedAll
       
    51  * @prototype
       
    52  */
       
    53 
       
    54 class MHttpContentSink
       
    55 	{
       
    56 	public:
       
    57     /**
       
    58      * Supply a part of the response body data. The data will survive till the THttpContentSinkOp::Release/Store 
       
    59      * is called. application should process the data or keep a separate copy if it has to process the data at a 
       
    60      * later stage. This function will be called when part of the body data is available
       
    61      * 
       
    62      * @param   aData  Sink Operator
       
    63      */
       
    64 	virtual void OnData(THttpContentSinkOp& aData) =0;
       
    65 	
       
    66 	private:
       
    67    // Reserved for future use.
       
    68     inline virtual void Reserved();
       
    69     inline virtual void Reserved2();        
       
    70     };
       
    71 
       
    72 inline void MHttpContentSink::Reserved()
       
    73     {
       
    74     
       
    75     }
       
    76 
       
    77 inline void MHttpContentSink::Reserved2()
       
    78     {
       
    79     
       
    80     }	
       
    81 
       
    82 #endif // __MHTTPCONTENTSINK_H__