applayerprotocols/httptransportfw/httpmessage/rhttpmessagecomposer.cpp
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 #include "rhttpmessagecomposer.h"
       
    17 
       
    18 #include "chttpmessagecomposer.h"
       
    19 
       
    20 EXPORT_C void RHttpMessageComposer::OpenL(MHttpMessageComposerObserver& aObserver)
       
    21 /**
       
    22 	Opens the object.
       
    23 	@param		aObserver	The observer for the composer.
       
    24 	@panic		EInvariantFalse	This RHttpMessageComposer has already been opened.
       
    25 */
       
    26 	{
       
    27 	__ASSERT_ALWAYS( iImplementation == NULL, User::Invariant() );
       
    28 
       
    29 	iImplementation = CHttpMessageComposer::NewL(aObserver);
       
    30 	}
       
    31 
       
    32 EXPORT_C void RHttpMessageComposer::Close()
       
    33 /**
       
    34 	Closes the object. Any resources are freed.
       
    35 */
       
    36 	{
       
    37 	delete iImplementation;
       
    38 	iImplementation = NULL;
       
    39 	}
       
    40 
       
    41 EXPORT_C void RHttpMessageComposer::MessageInfoAvailable()
       
    42 /**
       
    43 	Notifies the composer that more message info is available. The composer can
       
    44 	continue composing the message.
       
    45 	@pre		The composer is waiting for more message info.
       
    46 	@post		The composer continues composing the message.
       
    47 	@panic		EHttpMessagePanicBadDataState	The composer was not waiting for
       
    48 												more info.
       
    49 */
       
    50 	{
       
    51 	iImplementation->MessageInfoAvailable();
       
    52 	}
       
    53 
       
    54 EXPORT_C void RHttpMessageComposer::GetMessageData(TPtrC8& aData)
       
    55 /**
       
    56 	Get the current message data.
       
    57 	@panic		EHttpMessagePanicBadDataState	There is no current data buffer 
       
    58 												ready.
       
    59 	@pre		The observer has been notified of available message data.
       
    60 */
       
    61 	{
       
    62 	iImplementation->GetMessageData(aData);
       
    63 	}
       
    64 
       
    65 EXPORT_C void RHttpMessageComposer::ReleaseMessageData()
       
    66 /**
       
    67 	Release the message data. The observer has finished with the current message 
       
    68 	data buffer. The composer can continue composing the message.
       
    69 	@panic		EHttpMessagePanicBadDataState	There is no current data buffer 
       
    70 												ready.
       
    71 	@pre		The observer has been notified of available message data.
       
    72 	@post		The composer continues composing the message.
       
    73 */
       
    74 	{
       
    75 	iImplementation->ReleaseMessageData();
       
    76 	}
       
    77 
       
    78 EXPORT_C void RHttpMessageComposer::Reset()
       
    79 /**
       
    80 	Composer reset request. As the observer can reset the composer during one of 
       
    81 	the callback functions, the composer must check for re-entrancy to avoid 
       
    82 	releasing resources that are still required. If the composer is either 
       
    83 	waiting for more message info or is waiting to process its state machine, 
       
    84 	the composer can safely reset immediately. Otherwise the composer is being
       
    85 	reset from within its RunL() and so it must defer resetting itself until a
       
    86 	safer point - this is the point in the RunL() where the next step is decided.
       
    87 	@panic		EHttpMessagePanicDoubleReset	The composer has been reset twice
       
    88 												in one of the callback functions.
       
    89 */
       
    90 	{
       
    91 	iImplementation->Reset();
       
    92 	}
       
    93 
       
    94 EXPORT_C TBool RHttpMessageComposer::CheckMessagePendingComplete()
       
    95 /**
       
    96 	Message may be fully composed and sent. Have not yet received confirmation from socket.
       
    97 */
       
    98 	{
       
    99 	return iImplementation->CheckMessagePendingComplete();
       
   100 	}
       
   101 
       
   102 EXPORT_C void RHttpMessageComposer::Reserved_RHttpMessageComposer()
       
   103 /**
       
   104 	Reserved function.
       
   105 	@panic	EInvariantFalse	This function should not be called.
       
   106 */
       
   107 	{
       
   108 	User::Invariant();
       
   109 	}