|
1 // Copyright (c) 2002-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 "chttpdefaultheadercodec.h" |
|
17 |
|
18 #include "chttpdefaultheaderwriter.h" |
|
19 #include "chttpdefaultheaderreader.h" |
|
20 |
|
21 CHttpDefaultHeaderCodec* CHttpDefaultHeaderCodec::NewL(TAny* aStringPool) |
|
22 /** |
|
23 Factory constructor. |
|
24 @internalComponent |
|
25 @param aStringPool The current string pool. |
|
26 @return A pointer to a fully initialised object. |
|
27 @leave KErrNoMemory Not enough memory to create object. |
|
28 @leave CHttpDefaultHeaderCodec::ConstructL |
|
29 */ |
|
30 { |
|
31 RStringPool* strPool = static_cast<RStringPool*>(aStringPool); |
|
32 CHttpDefaultHeaderCodec* self = new (ELeave) CHttpDefaultHeaderCodec(*strPool); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(self); |
|
36 return self; |
|
37 } |
|
38 |
|
39 CHttpDefaultHeaderCodec::~CHttpDefaultHeaderCodec() |
|
40 /** |
|
41 Destructor. |
|
42 @internalComponent |
|
43 */ |
|
44 { |
|
45 } |
|
46 |
|
47 CHttpDefaultHeaderCodec::CHttpDefaultHeaderCodec(RStringPool aStringPool) |
|
48 : CHeaderCodecPlugin(), iStringPool(aStringPool) |
|
49 /** |
|
50 Constructor |
|
51 @internalComponent |
|
52 @param aStringPool The current string pool. |
|
53 */ |
|
54 { |
|
55 } |
|
56 |
|
57 void CHttpDefaultHeaderCodec::ConstructL() |
|
58 /** |
|
59 Second phase constructor |
|
60 @internalComponent |
|
61 @leave CHeaderCodec::ConstructL |
|
62 @leave CHttpDefaultHeaderWriter::NewL |
|
63 @leave CHttpDefaultHeaderReader::NewL |
|
64 */ |
|
65 { |
|
66 // Do second phase construction of the base class |
|
67 CHeaderCodec::ConstructL(); |
|
68 |
|
69 // Create the header writer and reader objects on behalf of the base class. |
|
70 iWriter = CHttpDefaultHeaderWriter::NewL(iStringPool); |
|
71 iReader = CHttpDefaultHeaderReader::NewL(iStringPool); |
|
72 } |
|
73 |
|
74 /* |
|
75 * Methods from CHeaderCodec |
|
76 */ |
|
77 |
|
78 TBool CHttpDefaultHeaderCodec::CanEncode(RStringF /*aHeaderField*/) const |
|
79 /** |
|
80 Asks if the codec can encode the specified header. The default codec can |
|
81 encode all headers. |
|
82 @internalComponent |
|
83 @param aHeaderField The header to be encoded. |
|
84 @return A value of ETrue as all headers can be encoded. |
|
85 */ |
|
86 { |
|
87 return ETrue; |
|
88 } |
|
89 |
|
90 TBool CHttpDefaultHeaderCodec::CanDecode(RStringF /*aHeaderField*/) const |
|
91 /** |
|
92 Asks if the codec can decode the specified header. The default codec can |
|
93 decode all headers. |
|
94 @internalComponent |
|
95 @param aHeaderField The header to be decoded. |
|
96 @return A value of ETrue as all headers can be decoded. |
|
97 */ |
|
98 { |
|
99 return ETrue; |
|
100 } |
|
101 |
|
102 CHeaderCodec* CHttpDefaultHeaderCodec::FindDelegateCodecL(RStringF /*aHeaderField*/) const |
|
103 /** |
|
104 Asks the codec to find a delegate codec that can deal with the header field. |
|
105 The default codec is the end of the line - there are no other codecs. |
|
106 @internalComponent |
|
107 @param aHeaderField The header field to be handled. |
|
108 @return A value of NULL as there are no other codecs. |
|
109 */ |
|
110 { |
|
111 return NULL; |
|
112 } |