|
1 // Copyright (c) 2001-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 // System includes |
|
17 #include <e32std.h> |
|
18 |
|
19 // User includes |
|
20 |
|
21 |
|
22 // Class signature |
|
23 #include <http/framework/cheadercodec.h> |
|
24 |
|
25 |
|
26 EXPORT_C |
|
27 CHeaderCodec::~CHeaderCodec() |
|
28 { |
|
29 delete iWriter; |
|
30 delete iReader; |
|
31 delete iDelegateCodec; |
|
32 } |
|
33 |
|
34 EXPORT_C |
|
35 void CHeaderCodec::EncodeHeaderL(RHeaderField& aHeader) const |
|
36 { |
|
37 RStringF fieldName = aHeader.Name(); |
|
38 if (CanEncode(fieldName)) |
|
39 iWriter->EncodeHeaderL(aHeader); |
|
40 else |
|
41 { |
|
42 // our reader can't deal with this header. Identify and delegate to a different codec |
|
43 if (!iDelegateCodec) |
|
44 // try and find a delegate codec as we don't yet have one |
|
45 iDelegateCodec = FindDelegateCodecL(fieldName); |
|
46 |
|
47 if (iDelegateCodec) |
|
48 iDelegateCodec->EncodeHeaderL(aHeader); |
|
49 else |
|
50 // we couldn't find a codec that supports encoding this header |
|
51 User::Leave(KErrNotSupported); |
|
52 } |
|
53 } |
|
54 |
|
55 EXPORT_C |
|
56 void CHeaderCodec::DecodeHeaderL(RHeaderField& aHeader) const |
|
57 { |
|
58 RStringF fieldName = aHeader.Name(); |
|
59 if (CanDecode(fieldName)) |
|
60 iReader->DecodeHeaderL(aHeader); |
|
61 else |
|
62 { |
|
63 if (!iDelegateCodec) |
|
64 // try and find a delegate codec as we don't yet have one |
|
65 iDelegateCodec = FindDelegateCodecL(fieldName); |
|
66 |
|
67 if (iDelegateCodec) |
|
68 iDelegateCodec->DecodeHeaderL(aHeader); |
|
69 else |
|
70 // we couldn't find a codec that supports decoding this header |
|
71 User::Leave(KErrNotSupported); |
|
72 } |
|
73 } |
|
74 |
|
75 EXPORT_C |
|
76 CHeaderCodec::CHeaderCodec() |
|
77 { |
|
78 } |
|
79 |
|
80 EXPORT_C |
|
81 void CHeaderCodec::ConstructL() |
|
82 { |
|
83 } |
|
84 |
|
85 EXPORT_C |
|
86 CHeaderWriter::~CHeaderWriter() |
|
87 { |
|
88 } |
|
89 |
|
90 EXPORT_C |
|
91 CHeaderWriter::CHeaderWriter() |
|
92 { |
|
93 } |
|
94 |
|
95 EXPORT_C |
|
96 void CHeaderWriter::ConstructL() |
|
97 { |
|
98 } |
|
99 |
|
100 |
|
101 EXPORT_C |
|
102 CHeaderReader::~CHeaderReader() |
|
103 { |
|
104 } |
|
105 |
|
106 EXPORT_C |
|
107 CHeaderReader::CHeaderReader() |
|
108 { |
|
109 } |
|
110 |
|
111 EXPORT_C |
|
112 void CHeaderReader::ConstructL() |
|
113 { |
|
114 } |
|
115 |
|
116 |