|
1 /* |
|
2 * Copyright (c) 2006-2006 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 WSSTAR_HANDLER_MESSAGE_CONTEXT_H |
|
29 #define WSSTAR_HANDLER_MESSAGE_CONTEXT_H |
|
30 |
|
31 // INCLUDES |
|
32 #include <e32std.h> |
|
33 #include <flogger.h> |
|
34 #include "msenmessagecontext.h" |
|
35 #include "wsstarcons.h" |
|
36 #include "MSenProperties.h" |
|
37 |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CWSStarSessionContext; |
|
41 class CSenChunk; |
|
42 |
|
43 /** |
|
44 * Class: |
|
45 */ |
|
46 class CWSStarMessageContext : public CBase, public MSenMessageContext |
|
47 { |
|
48 |
|
49 public: |
|
50 static CWSStarMessageContext* NewL(SenContext::TContextDirection aDirection, CSenXmlReader*& aParser); |
|
51 static CWSStarMessageContext* NewLC(SenContext::TContextDirection aDirection, CSenXmlReader*& aParser); |
|
52 static CWSStarMessageContext* NewLC(SenContext::TContextDirection aDirection, |
|
53 CSenXmlReader*& aParser, CWSStarSessionContext& aSessionContext); |
|
54 ~CWSStarMessageContext(); |
|
55 |
|
56 |
|
57 void SetOwnedEnvelope(TBool aOwned = ETrue) |
|
58 { |
|
59 iOwnedEnvelope = aOwned; |
|
60 } |
|
61 |
|
62 //From MessageContext |
|
63 virtual CSenSoapMessage* GetCurrentSoapMessage(); |
|
64 virtual TPtrC8 GetMessageL(); |
|
65 |
|
66 |
|
67 |
|
68 //Implementation in these is in fact is equal to GetCurrentSoapMessae. |
|
69 //In current shape, message context keep only one CSenSoapMessage |
|
70 virtual TInt Add(const TDesC8& aKey, CSenSoapEnvelope* aValue); |
|
71 virtual TInt Update(const TDesC8& aKey, CSenSoapEnvelope* aValue); |
|
72 virtual const CSenSoapEnvelope* GetSenSoapEnvelopeL(const TDesC8& aKey); |
|
73 |
|
74 |
|
75 //From MContext |
|
76 virtual SenContext::TContextType Type() const; |
|
77 virtual SenContext::TContextDirection Direction() const; |
|
78 |
|
79 //Desc handling methods do not take ownership. but create new object from passed value |
|
80 virtual TInt Add(const TDesC8& aKey, const TDesC8& aValue); |
|
81 virtual TInt Update(const TDesC8& aKey, const TDesC8& aValue); |
|
82 virtual const TDesC8* GetDesC8L(const TDesC8& aKey); |
|
83 virtual TInt Remove(const TDesC8& aKey); |
|
84 |
|
85 //Int handling methods do not take ownership. but create new object from passed value |
|
86 virtual TInt Add(const TDesC8& aKey, TInt aValue); |
|
87 virtual TInt Update(const TDesC8& aKey, TInt aValue); |
|
88 virtual const TInt* GetIntL(const TDesC8& aKey); |
|
89 |
|
90 |
|
91 //Element handling methods - ownership is transfered |
|
92 virtual TInt Add(const TDesC8& aKey, CSenElement* aValue); |
|
93 virtual TInt Update(const TDesC8& aKey, CSenElement* aValue); |
|
94 virtual const CSenElement* GetSenElementL(const TDesC8& aKey) ; |
|
95 |
|
96 //These are NOT supported: |
|
97 virtual TInt Add(const TDesC8& aKey, TAny* aValue); |
|
98 virtual TInt Update(const TDesC8& aKey, TAny* aValue) ; |
|
99 virtual TAny* GetAnyL(const TDesC8& aKey); //codescannerwarnings |
|
100 virtual const CSenXmlReader* GetParser(); |
|
101 virtual TInt Count() const; |
|
102 virtual TPtrC8 KeyAtL(TInt aIndex); |
|
103 virtual void Reset(); |
|
104 virtual MSenMessage* MessageL(); //codescannerwarnigs |
|
105 virtual TInt SetMessage(MSenMessage* apMessage, TBool aOwned = ETrue); |
|
106 virtual TInt SetProperties(MSenProperties* apOwnedTransportProperties, TBool aOwned = ETrue); |
|
107 virtual MSenProperties* Properties(); |
|
108 virtual TInt Add(const TDesC8& aKey, MSenMessage* apMessage, TBool aOwned = ETrue); |
|
109 virtual TInt Update(const TDesC8& aKey, MSenMessage* apMessage, TBool aOwned = ETrue); |
|
110 virtual MSenMessage* GetMessageL(const TDesC8& aKey);// codescannerwarnings |
|
111 virtual CSenChunk* CWSStarMessageContext::ChunkL(); // codescannerwarnings |
|
112 virtual TInt SetChunk(CSenChunk* apMsgAsChunk, TBool aOwned = ETrue); // not implemented |
|
113 virtual TInt SetDirection(SenContext::TContextDirection aDirection); // not implemented |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 //new |
|
120 /** |
|
121 * Update message context from session context. |
|
122 * If resending occurs we need copy again already cached info. |
|
123 * |
|
124 * @since S60 4.0 |
|
125 */ |
|
126 void UpdateFromSessionContextL(CWSStarSessionContext& aSessionContext); |
|
127 |
|
128 private: |
|
129 void UpdateIntL(CWSStarSessionContext& aSessionContext, const TDesC8& aKey); |
|
130 void UpdateDesC8L(CWSStarSessionContext& aSessionContext, const TDesC8& aKey); |
|
131 |
|
132 protected: |
|
133 /** |
|
134 * Function: CWSStarMessageContext |
|
135 * |
|
136 * Discussion: Perform the first phase of two phase construction |
|
137 */ |
|
138 CWSStarMessageContext(SenContext::TContextDirection aDirection, CSenXmlReader*& aParser); |
|
139 |
|
140 |
|
141 |
|
142 /** |
|
143 * Function: ConstructL |
|
144 * |
|
145 * Discussion: Perform the second phase construction of a |
|
146 * CImplementationClassPlus object. |
|
147 */ |
|
148 void ConstructL(); |
|
149 void ConstructL(CWSStarSessionContext& aSessionContext); |
|
150 |
|
151 private: |
|
152 SenContext::TContextDirection iDirection; |
|
153 TBool iOwnedEnvelope; |
|
154 CSenSoapEnvelope* iCurrentEnvelope; //depends on iOwnedEnvelope |
|
155 TPtrC8 iCurrentEnvelopeTxt; //depends on iOwnedEnvelope |
|
156 const CSenElement* iBody; //not owned, session Ctx own |
|
157 const CSenXmlReader* iParser; |
|
158 RMapDescriptors iDescs; |
|
159 RMapInt iInts; |
|
160 RPointerArray<HBufC8>* ipSignedParts; //not owned (both elements and array) |
|
161 }; |
|
162 |
|
163 |
|
164 #endif // WSSTAR_HANDLER_MESSAGE_CONTEXT_H |
|
165 |
|
166 |
|
167 |
|
168 // END OF FILE |
|
169 |