|
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 #ifndef __CHTTPHEADERWRITER_H__ |
|
17 #define __CHTTPHEADERWRITER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <stringpool.h> |
|
21 #include <http/framework/cheadercodec.h> |
|
22 |
|
23 |
|
24 /** CHttpHeaderWriter is used by its owning codec to do conversion of header data from |
|
25 the generic format (of parts and parameters) to the plain-text representation. |
|
26 */ |
|
27 class CHttpHeaderWriter : public CHeaderWriter |
|
28 { |
|
29 protected: // methods |
|
30 |
|
31 CHttpHeaderWriter(RStringPool aStringPool); |
|
32 |
|
33 /** Helper to DoAcceptL(), DoAcceptCharsetL(), DoAcceptLanguageL() and DoAcceptEncodingL() for comma-separated |
|
34 lists incorporating q-values. |
|
35 @param aHeader The header field being encoded |
|
36 @param aFieldType A string reference to the field type being encoded |
|
37 @param aErrorCode An error value to use when encoding fails |
|
38 */ |
|
39 void DoGeneralAcceptHeaderL(TInt aNormalHeaderLen, RHeaderField& aHeader, RStringF aFieldType, TInt aErrorCode) const; |
|
40 |
|
41 /** Helper to DoConnectionL(), DoContentEncodingL(), DoTransferEncodingL(), etc., which take comma-separated |
|
42 token lists. |
|
43 @param aHeader The header field being encoded |
|
44 @param aErrorCode An error value to use when encoding fails |
|
45 */ |
|
46 void DoTokenCsvListHeaderL(RHeaderField& aHeader, TInt aErrorCode) const; |
|
47 |
|
48 /** Helper to DoUserAgentL(), etc., which take token lists with arbitrary separators |
|
49 @param aHeader The header field being encoded |
|
50 @param aFieldType A string reference to the field type being encoded |
|
51 @param aErrorCode An error value to use when encoding fails |
|
52 */ |
|
53 void DoTokenListHeaderL(RHeaderField& aHeader, const TDesC8& aSep, TInt aErrorCode) const; |
|
54 const CHeaderFieldPart* WriteRawStrFPartL(RHeaderField& aHeader, THeaderFieldPartIter& aIter, TInt aErrorCode) const; |
|
55 void EncodeGenericDateL(RHeaderField& aHeader, TInt aErrorCodeToUseOnFailure) const; |
|
56 void EncodeGenericNumberHeaderL(RHeaderField& aHeader, TInt aErrorCodeToUseOnFailure) const; |
|
57 |
|
58 protected: // attributes |
|
59 |
|
60 RStringPool iStringPool; |
|
61 |
|
62 const TStringTable& iStringTable; |
|
63 }; |
|
64 |
|
65 #endif // __CHTTPHEADERWRITER_H__ |