|
1 // Copyright (c) 2003-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 __THTTPDATACOMPOSER_H__ |
|
17 #define __THTTPDATACOMPOSER_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 |
|
21 class MHttpBufferSupplier; |
|
22 |
|
23 |
|
24 class THttpDataComposer |
|
25 /** |
|
26 The THttpDataComposer class allows tokens to be added to a data buffer. |
|
27 A token can be followed by a specified delimiter. The data buffer can be |
|
28 released at any time, allowing a fresh set of data to composed. Resetting |
|
29 the composer results in the data buffer being deleted. |
|
30 |
|
31 An MHttpBufferSupplier object owns the data buffer into which the tokens |
|
32 are placed. If there is not enough space for the tokens, the data composer |
|
33 asks the buffer supplier to resize the buffer to at least the required size. |
|
34 @internalComponent |
|
35 @see MHttpBufferSupplier |
|
36 */ |
|
37 { |
|
38 public: // enums |
|
39 |
|
40 enum TDelimiterType |
|
41 /** |
|
42 The TDelimiterType enumeration defines the types of delimiter that can be |
|
43 specified to follow a token. |
|
44 |
|
45 */ |
|
46 { |
|
47 /** Specifies that no delimiter should follow. |
|
48 */ |
|
49 ENone =0, |
|
50 |
|
51 /** The token should be followed by a Space character. |
|
52 */ |
|
53 ESpace, |
|
54 |
|
55 /** The token should be followed by a Colon and then a Space character. |
|
56 */ |
|
57 EColonSpace, |
|
58 |
|
59 /** The token should be followed by a Carriage Return and then a Line |
|
60 Feed character. |
|
61 */ |
|
62 ECRLF |
|
63 }; |
|
64 |
|
65 public: // methods |
|
66 |
|
67 THttpDataComposer(MHttpBufferSupplier& aBufferSupplier); |
|
68 |
|
69 void AddTokenL(const TDesC8& aToken, TDelimiterType aDelimiter); |
|
70 void Release(); |
|
71 void Reset(); |
|
72 |
|
73 private: // attributes |
|
74 |
|
75 MHttpBufferSupplier& iBufferSupplier; |
|
76 TPtr8 iBuffer; |
|
77 TInt iRequiredLength; |
|
78 |
|
79 }; |
|
80 |
|
81 #endif // __THTTPDATACOMPOSER_H__ |