41 /** |
41 /** |
42 * |
42 * |
43 * @lib |
43 * @lib |
44 * @since 3.1 |
44 * @since 3.1 |
45 */ |
45 */ |
46 class CHttpCacheStreamEntry : public CBase |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * @since 3.1 |
|
53 * @param |
|
54 * @param |
|
55 * @return CHttpCacheStreamEntry object. |
|
56 */ |
|
57 static CHttpCacheStreamEntry* NewL( RFs& aRfs, CHttpCacheEntry& aHttpCacheEntry, TDriveUnit aDrive, |
|
58 TInt64 aCriticalLevel ); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 virtual ~CHttpCacheStreamEntry(); |
|
64 |
|
65 public: // new functions |
|
66 |
|
67 /** |
|
68 * |
|
69 * @since 3.1 |
|
70 * @param |
|
71 * @return |
|
72 */ |
|
73 inline CHttpCacheEntry* CacheEntry() const { return iHttpCacheEntry; } |
|
74 |
|
75 /** |
|
76 * |
|
77 * @since 3.1 |
|
78 * @param |
|
79 * @return |
|
80 */ |
|
81 void Erase(); |
|
82 |
|
83 /** |
|
84 * |
|
85 * @since 3.1 |
|
86 * @param |
|
87 * @return |
|
88 */ |
|
89 HBufC8* HeadersL(); |
|
90 |
|
91 /** |
|
92 * |
|
93 * @since 3.1 |
|
94 * @param |
|
95 * @return |
|
96 */ |
|
97 HBufC8* NextChunkL( TBool& aLastChunk ); |
|
98 |
|
99 /** |
|
100 * |
|
101 * @since 3.1 |
|
102 * @param |
|
103 * @return |
|
104 */ |
|
105 TInt SaveHeaders( const TDesC8& aHeaderStr ); |
|
106 |
|
107 /** |
|
108 * |
|
109 * @since 3.1 |
|
110 * @param |
|
111 * @return |
|
112 */ |
|
113 void RemoveHeaders(); |
|
114 |
|
115 /** |
|
116 * |
|
117 * @since 3.1 |
|
118 * @param |
|
119 * @return |
|
120 */ |
|
121 TInt SaveBodyData( const TDesC8& aBodyStr ); |
|
122 |
|
123 /** |
|
124 * |
|
125 * @since 3.1 |
|
126 * @param |
|
127 * @return |
|
128 */ |
|
129 void RemoveBodyData(); |
|
130 |
|
131 /** |
|
132 * Flush |
|
133 * @since 3.1 |
|
134 * @param |
|
135 * @return |
|
136 */ |
|
137 TInt Flush(); |
|
138 |
|
139 private: |
|
140 |
|
141 /** |
|
142 * Construct. |
|
143 * @since 3.1 |
|
144 * @param |
|
145 * @param |
|
146 * @return CHttpCacheStreamEntry object. |
|
147 */ |
|
148 CHttpCacheStreamEntry( RFs& aRfs, CHttpCacheEntry& aHttpCacheEntry, TDriveUnit aDrive, |
|
149 TInt64 aCriticalLevel ); |
|
150 |
|
151 /** |
|
152 * By default Symbian 2nd phase constructor is private. |
|
153 */ |
|
154 void ConstructL(); |
|
155 |
|
156 private: // |
|
157 |
|
158 /** |
|
159 * |
|
160 * @since 3.1 |
|
161 * @param |
|
162 * @return |
|
163 */ |
|
164 void GetHeaderFileName( const TFileName& aBodyFileName, TFileName& aHeaderFileName ); |
|
165 |
|
166 /** |
|
167 * |
|
168 * @since 3.1 |
|
169 * @param |
|
170 * @return |
|
171 */ |
|
172 TBool OpenCacheFiles(); |
|
173 |
|
174 /** |
|
175 * |
|
176 * @since 3.1 |
|
177 * @param |
|
178 * @return |
|
179 */ |
|
180 TBool CreateNewFilesL(); |
|
181 |
|
182 /** |
|
183 * |
|
184 * @since 3.1 |
|
185 * @param |
|
186 * @return |
|
187 */ |
|
188 void BodyFileName( TFileName& aBodyFileName ); |
|
189 |
|
190 /** |
|
191 * |
|
192 * @since 3.1 |
|
193 * @param |
|
194 * @return |
|
195 */ |
|
196 TBool DiskSpaceBelowCriticalLevel( TInt aContentSize ); |
|
197 |
|
198 private: // Data |
|
199 |
|
200 // |
|
201 TBool iFileOk; |
|
202 // |
|
203 RFs iRfs; // not owned |
|
204 // |
|
205 RFile iHeaderFile; // owned |
|
206 // |
|
207 RFile iBodyFile; // owned |
|
208 // |
|
209 CHttpCacheEntry* iHttpCacheEntry; // not owned |
|
210 // |
|
211 TDriveUnit iDrive; |
|
212 // |
|
213 TInt64 iCriticalLevel; |
|
214 // |
|
215 HBufC8* iCacheBuffer; // owned |
|
216 }; |
|
217 |
|
218 /** |
|
219 * |
|
220 * @lib |
|
221 * @since 3.1 |
|
222 */ |
|
223 class CHttpCacheStreamHandler : public CBase |
46 class CHttpCacheStreamHandler : public CBase |
224 { |
47 { |
225 public: // Constructors and destructor |
48 public: // Constructors and destructor |
226 |
49 |
227 /** |
50 /** |
367 * |
197 * |
368 * @since 3.1 |
198 * @since 3.1 |
369 * @param |
199 * @param |
370 * @return |
200 * @return |
371 */ |
201 */ |
372 CHttpCacheStreamEntry* FindStreamEntry( const CHttpCacheEntry& aCacheEntry, TInt* aIndex = NULL ); |
202 TBool IsDiskSpaceAvailable( TInt aContentSize ); |
373 |
203 |
374 |
204 /** |
|
205 * |
|
206 * @since 7.1 |
|
207 * @param |
|
208 * @return |
|
209 */ |
|
210 void FindCacheEntryIndex( const CHttpCacheEntry& aCacheEntry, TInt* aIndex ); |
375 |
211 |
376 private: // Data |
212 private: // Data |
377 |
213 |
378 // |
214 // |
379 RFs iRfs; // owned |
215 RFs iRfs; // owned |
380 // attached entries |
216 // attached entries |
381 CArrayPtrFlat<CHttpCacheStreamEntry>* iActiveEntries; // owned |
217 CArrayPtrFlat<CHttpCacheEntry>* iActiveEntries; // owned |
382 // |
218 // |
383 TInt iContentSize; |
219 TInt iContentSize; |
384 // |
220 // |
385 TDriveUnit iDrive; |
221 TDriveUnit iDrive; |
386 // |
222 // |
387 TInt64 iCriticalLevel; |
223 TInt64 iCriticalLevel; |
388 // |
|
389 TInt iDiskFull; |
|
390 }; |
224 }; |
391 |
225 |
392 #endif // CHTTPCACHESTREAMHANDLER_H |
226 #endif // CHTTPCACHESTREAMHANDLER_H |
393 |
227 |
394 // End of File |
228 // End of File |