webservices/wsoviplugin/inc/wsovimessagecontext.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2008 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:    Header declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26  
       
    27 
       
    28 #ifndef WSOvi_HANDLER_MESSAGE_CONTEXT_H
       
    29 #define WSOvi_HANDLER_MESSAGE_CONTEXT_H
       
    30 
       
    31 // INCLUDES
       
    32 #include <e32std.h>
       
    33 #include <flogger.h>
       
    34 #include "msenmessagecontext.h"
       
    35 #include "wsovicons.h"
       
    36 #include <SenTransportProperties.h>
       
    37 
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CWSOviSessionContext;
       
    41 class CSenChunk;
       
    42 
       
    43 /**
       
    44  * Class:       
       
    45  */
       
    46 class CWSOviMessageContext : public CBase, public MSenMessageContext
       
    47     {
       
    48 
       
    49     public:
       
    50         static CWSOviMessageContext* NewL(SenContext::TContextDirection aDirection);
       
    51         static CWSOviMessageContext* NewLC(SenContext::TContextDirection aDirection);
       
    52         static CWSOviMessageContext* NewLC(SenContext::TContextDirection aDirection,
       
    53                 CWSOviSessionContext& aSessionContext);
       
    54         ~CWSOviMessageContext();
       
    55 
       
    56 
       
    57         
       
    58         //From MessageContext
       
    59         virtual CSenSoapMessage* GetCurrentSoapMessage();
       
    60         virtual TPtrC8 GetMessageL();
       
    61         virtual TInt Add(const TDesC8& aKey, CSenSoapEnvelope* aValue);
       
    62         virtual TInt Update(const TDesC8& aKey, CSenSoapEnvelope* aValue);
       
    63         virtual const CSenSoapEnvelope* GetSenSoapEnvelopeL(const TDesC8& aKey);
       
    64             
       
    65             
       
    66         //From MContext    
       
    67         virtual SenContext::TContextType Type() const;        
       
    68         virtual SenContext::TContextDirection Direction() const;
       
    69 
       
    70         //Desc handling methods do not take ownership. but create new object from passed value
       
    71         virtual TInt Add(const TDesC8& aKey, const TDesC8& aValue);
       
    72         virtual TInt Update(const TDesC8& aKey, const TDesC8& aValue);
       
    73         virtual const TDesC8* GetDesC8L(const TDesC8& aKey);
       
    74         virtual TInt Remove(const TDesC8& aKey);
       
    75 
       
    76         //Int handling methods do not take ownership. but create new object from passed value
       
    77         virtual TInt Add(const TDesC8& aKey, TInt aValue);
       
    78         virtual TInt Update(const TDesC8& aKey, TInt aValue);
       
    79         virtual const TInt* GetIntL(const TDesC8& aKey);
       
    80 
       
    81 
       
    82         //Element handling methods - ownership is transfered
       
    83         virtual TInt Add(const TDesC8& aKey, CSenElement* aValue);
       
    84         virtual TInt Update(const TDesC8& aKey, CSenElement* aValue);
       
    85         virtual const CSenElement* GetSenElementL(const TDesC8& aKey) ;
       
    86 
       
    87         //These are NOT supported:
       
    88         virtual TInt Add(const TDesC8& aKey, TAny* aValue);
       
    89         virtual TInt Update(const TDesC8& aKey, TAny* aValue) ;
       
    90         virtual TAny* GetAnyL(const TDesC8& aKey);
       
    91         virtual const CSenXmlReader* GetParser();
       
    92         virtual TInt Count() const;
       
    93         virtual TPtrC8 KeyAtL(TInt aIndex);
       
    94         virtual void Reset();
       
    95         virtual MSenMessage* MessageL();
       
    96         virtual TInt SetMessage(MSenMessage* apMessage, TBool aOwned = ETrue);
       
    97         virtual TInt SetProperties(MSenProperties* apOwnedTransportProperties, TBool aOwned = ETrue);
       
    98         virtual MSenProperties* Properties();
       
    99         virtual TInt Add(const TDesC8& aKey, MSenMessage* apMessage, TBool aOwned = ETrue);
       
   100         virtual TInt Update(const TDesC8& aKey, MSenMessage* apMessage, TBool aOwned = ETrue);
       
   101         virtual MSenMessage* GetMessageL(const TDesC8& aKey);
       
   102         virtual CSenChunk* CWSOviMessageContext::ChunkL();
       
   103         virtual TInt SetChunk(CSenChunk* apMsgAsChunk, TBool aOwned = ETrue);
       
   104         virtual TInt SetDirection(SenContext::TContextDirection aDirection);
       
   105         
       
   106         
       
   107         
       
   108 
       
   109         /**
       
   110          * Update message context from session context.
       
   111          *  If resending occurs we need copy again already cached info.
       
   112          *
       
   113          * @since S60 5.0
       
   114          */
       
   115         void UpdateFromSessionContextL(CWSOviSessionContext& aSessionContext);
       
   116 
       
   117         
       
   118         /**
       
   119         *   no onwership taken
       
   120         *   no copy is maked
       
   121         */
       
   122         TInt UpdateTP(CSenTransportProperties*& aTP);
       
   123         
       
   124         
       
   125         /**
       
   126         *   no onwership returned
       
   127         *   no copy is maked
       
   128         */
       
   129         
       
   130         CSenTransportProperties* TP();
       
   131         
       
   132         /**
       
   133         *   no onwership returned
       
   134         *   no copy is maked
       
   135         */
       
   136         RMapDescriptors& OAuthProperies();
       
   137         
       
   138     protected:
       
   139         /**
       
   140          * Function:   CWSOviMessageContext
       
   141          *
       
   142          * Discussion: Perform the first phase of two phase construction
       
   143          */
       
   144         CWSOviMessageContext(SenContext::TContextDirection aDirection);
       
   145 
       
   146         /**
       
   147          * Function:   ConstructL
       
   148          *
       
   149          * Discussion: Perform the second phase construction of a
       
   150          *             CImplementationClassPlus object.
       
   151          */
       
   152         void ConstructL();
       
   153         void ConstructL(CWSOviSessionContext& aSessionContext);
       
   154         
       
   155     private:
       
   156         void UpdateIntL(CWSOviSessionContext& aSessionContext, const TDesC8& aKey);
       
   157         void UpdateDesC8L(CWSOviSessionContext& aSessionContext, const TDesC8& aKey);
       
   158 
       
   159         SenContext::TContextDirection iDirection;
       
   160         RMapDescriptors iDescs;
       
   161         RMapDescriptors iOAuthProperties;
       
   162         RMapInt         iInts;
       
   163         CSenTransportProperties* iTP;//not owned
       
   164     };
       
   165 
       
   166 
       
   167 #endif // WSOvi_HANDLER_MESSAGE_CONTEXT_H
       
   168 
       
   169 
       
   170     
       
   171 // END OF FILE
       
   172