|
1 /* |
|
2 * Copyright (c) 2009 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 the License "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: |
|
15 * |
|
16 */ |
|
17 /* |
|
18 * ============================================================================== |
|
19 * Name : PushMtmCacheDataSupplier.h |
|
20 * Part of : PushMtm |
|
21 * Interface : |
|
22 * Description : |
|
23 * Version : 3.1 |
|
24 */ |
|
25 |
|
26 |
|
27 #ifndef CPUSHMTMCACHEDATASUPPLIER_H |
|
28 #define CPUSHMTMCACHEDATASUPPLIER_H |
|
29 |
|
30 // INCLUDES |
|
31 #include <http/MHTTPDataSupplier.h> |
|
32 |
|
33 // CONSTANTS |
|
34 |
|
35 // MACROS |
|
36 |
|
37 // DATA TYPES |
|
38 |
|
39 // FUNCTION PROTOTYPES |
|
40 |
|
41 // FORWARD DECLARATIONS |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * Data supplier to supply response body if the url is loaded |
|
47 * from cache |
|
48 * |
|
49 * @lib |
|
50 * @since 3.1 |
|
51 */ |
|
52 class CPushMtmCacheDataSupplier : public CBase, public MHTTPDataSupplier |
|
53 { |
|
54 public: // Constructors and destructor |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 */ |
|
59 static CPushMtmCacheDataSupplier* NewL( HBufC8* aBody ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CPushMtmCacheDataSupplier(); |
|
65 |
|
66 public: // from MHTTPDataSupplier |
|
67 |
|
68 /** |
|
69 * From MHTTPDataSupplier. Free the data chunk that was requested. |
|
70 * @since 2.0 |
|
71 */ |
|
72 virtual void ReleaseData() { delete iBody; iBody = NULL;} |
|
73 |
|
74 /** |
|
75 * From MHTTPDataSupplier. It is not possible to know |
|
76 * the data size, so return KErrNotFound |
|
77 * @since 2.0 |
|
78 */ |
|
79 virtual TInt OverallDataSize () { return KErrNotFound; } |
|
80 |
|
81 /** |
|
82 * From MHTTPDataSupplier. Get the next data part of the response body |
|
83 * @since 2.0 |
|
84 */ |
|
85 virtual TBool GetNextDataPart( TPtrC8& aDataPart ); |
|
86 |
|
87 /** |
|
88 * From MHTTPDataSupplier. Not Supported |
|
89 * @since 2.0 |
|
90 */ |
|
91 virtual TInt Reset() { return KErrNotFound; } |
|
92 |
|
93 private: |
|
94 |
|
95 /** |
|
96 * C++ default constructor. |
|
97 */ |
|
98 CPushMtmCacheDataSupplier( HBufC8* aBody ); |
|
99 |
|
100 private: // Data |
|
101 |
|
102 //owned by datasupplier and is destroyed |
|
103 //when the releasedata function is called |
|
104 HBufC8* iBody; |
|
105 }; |
|
106 |
|
107 #endif // CPUSHMTMCACHEDATASUPPLIER_H |
|
108 |
|
109 // End of File |