43 class CIdle; |
43 class CIdle; |
44 class CHttpCacheEvictionHandler; |
44 class CHttpCacheEvictionHandler; |
45 class THttpCacheEntry; |
45 class THttpCacheEntry; |
46 class CHttpCacheObserver; |
46 class CHttpCacheObserver; |
47 class CHttpCacheFileWriteHandler; |
47 class CHttpCacheFileWriteHandler; |
|
48 class CHttpCacheFileHash; |
48 |
49 |
49 // CLASS DECLARATION |
50 // CLASS DECLARATION |
50 |
51 |
51 NONSHARABLE_CLASS( THttpCachePostponeParameters ) |
52 NONSHARABLE_CLASS( THttpCachePostponeParameters ) |
52 { |
53 { |
55 |
56 |
56 TBool iEnabled; |
57 TBool iEnabled; |
57 TInt iFreeRamThreshold; |
58 TInt iFreeRamThreshold; |
58 TInt iImmediateWriteThreshold; |
59 TInt iImmediateWriteThreshold; |
59 TInt iWriteTimeout; |
60 TInt iWriteTimeout; |
60 }; |
|
61 |
|
62 NONSHARABLE_CLASS( TCompressedEntry ) |
|
63 { |
|
64 public: |
|
65 ~TCompressedEntry() { if(!IsCompressed()) delete iName.iNameAsHBuf; }; |
|
66 static TCompressedEntry *NewL( const TEntry& aEntry ); |
|
67 |
|
68 private: |
|
69 TCompressedEntry(){}; |
|
70 void ConstructL( const TEntry& aEntry ); |
|
71 enum { |
|
72 EFilenameStoredAsUint32 = 0x01 |
|
73 }; |
|
74 |
|
75 public: |
|
76 TBool IsCompressed() { return (iFlags && TCompressedEntry::EFilenameStoredAsUint32); }; |
|
77 static TBool ConvertANameToUint32( const TDesC& aName, TUint32& aConverted); |
|
78 static TInt ConvertAsciiToIntSingleHexDigit(const TUint16& aDigitChar); |
|
79 TUint32 GetSize() { return iSize; }; |
|
80 HBufC* GetNameL(); |
|
81 TUint32 GetCompressedName() { return iName.iNameAsUint32; }; |
|
82 |
|
83 private: |
|
84 TUint32 iFlags; |
|
85 TUint32 iSize; |
|
86 union { |
|
87 TUint32 iNameAsUint32; |
|
88 HBufC* iNameAsHBuf; |
|
89 }iName; |
|
90 }; |
|
91 |
|
92 NONSHARABLE_CLASS( CCustomCacheDirList ) : public CBase |
|
93 { |
|
94 public: |
|
95 static CCustomCacheDirList* NewL(CDir *aSrc); |
|
96 ~CCustomCacheDirList() { iDirList.ResetAndDestroy(); }; |
|
97 |
|
98 public: |
|
99 TBool ValidateCacheEntryL( const CHttpCacheEntry& aEntry ); |
|
100 TInt Count(); |
|
101 HBufC* NameAtL( TInt aIndex ); |
|
102 |
|
103 private: |
|
104 CCustomCacheDirList(); |
|
105 void ConstructL(CDir *aSrc); |
|
106 |
|
107 private: |
|
108 RPointerArray<TCompressedEntry> iDirList; |
|
109 }; |
|
110 |
|
111 NONSHARABLE_CLASS( CCacheDirectoryFiles ) : public CBase |
|
112 { |
|
113 public: |
|
114 static CCacheDirectoryFiles* NewL(RFs aRfs, const TDesC& aDir); |
|
115 static CCacheDirectoryFiles* NewLC(RFs aRfs, const TDesC& aDir); |
|
116 |
|
117 public: |
|
118 /* |
|
119 * Check to see if the entry passed in has a valid file in the directory listing |
|
120 * returns ETrue if file present and size matches entry |
|
121 * otherwise EFalse. |
|
122 * Removes matching files from stored list. |
|
123 */ |
|
124 TBool ValidateEntryL(const CHttpCacheEntry& aEntry); |
|
125 |
|
126 /* |
|
127 * Delete any files in the stored list from the filesystem |
|
128 * Intended to be called after you have validated all the entries |
|
129 * against the list - the content of the list will now only be the |
|
130 * orphan files in the cache subdirectories. |
|
131 * IMPORTANT: only call this once you've looked at all your entries. |
|
132 */ |
|
133 void RemoveLeftoverFilesL(); |
|
134 |
|
135 private: |
|
136 CCacheDirectoryFiles(RFs aRfs, const TDesC& aDir) : iRfs(aRfs), iDir(aDir) {}; |
|
137 ~CCacheDirectoryFiles(); |
|
138 void ConstructL(); |
|
139 |
|
140 private: |
|
141 RFs iRfs; |
|
142 const TDesC& iDir; |
|
143 |
|
144 RPointerArray<CCustomCacheDirList> iDirContent; |
|
145 }; |
61 }; |
146 |
62 |
147 /** |
63 /** |
148 * |
64 * |
149 * @lib |
65 * @lib |
442 TInt iSize; |
359 TInt iSize; |
443 // cache directory |
360 // cache directory |
444 HBufC* iDirectory; // owned |
361 HBufC* iDirectory; // owned |
445 // name of the index file |
362 // name of the index file |
446 HBufC* iIndexFile; // owned |
363 HBufC* iIndexFile; // owned |
|
364 public: |
447 // Observing changes in cache |
365 // Observing changes in cache |
448 CHttpCacheObserver* iHttpCacheObserver; // owned |
366 CHttpCacheObserver* iHttpCacheObserver; // owned |
|
367 private: |
449 // An opened and configured file server session |
368 // An opened and configured file server session |
450 RFs iRfs; |
369 RFs iRfs; |
451 // |
370 // |
452 CHttpCacheFileWriteHandler* iPostponeHandler; // owned |
371 CHttpCacheFileWriteHandler* iPostponeHandler; // owned |
453 }; |
372 }; |