| 1 | /* |
| 2 | ** CWLocalCacheManager.h |
| 3 | ** |
| 4 | ** Copyright (c) 2001-2007 Ludovic Marcotte |
| 5 | ** Copyright (C) 2013-2019 Riccardo Mottola |
| 6 | ** |
| 7 | ** Author: Ludovic Marcotte <[email protected]> |
| 8 | ** Riccardo Mottola |
| 9 | ** Sebastan Reitenbach |
| 10 | ** |
| 11 | ** This library is free software; you can redistribute it and/or |
| 12 | ** modify it under the terms of the GNU Lesser General Public |
| 13 | ** License as published by the Free Software Foundation; either |
| 14 | ** version 2.1 of the License, or (at your option) any later version. |
| 15 | ** |
| 16 | ** This library is distributed in the hope that it will be useful, |
| 17 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | ** Lesser General Public License for more details. |
| 20 | ** |
| 21 | ** You should have received a copy of the GNU General Public License |
| 22 | ** along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | */ |
| 24 | |
| 25 | #ifndef _Pantomime_H_CWLocalCacheManager |
| 26 | #define _Pantomime_H_CWLocalCacheManager |
| 27 | |
| 28 | #include <Pantomime/CWCacheManager.h> |
| 29 | |
| 30 | @class CWFolder; |
| 31 | @class CWLocalMessage; |
| 32 | @class NSDate; |
| 33 | |
| 34 | /*! |
| 35 | @class CWLocalCacheManager |
| 36 | @discussion This class provides trivial extensions to the |
| 37 | CWCacheManager superclass for CWLocalFolder instances. |
| 38 | */ |
| 39 | @interface CWLocalCacheManager: CWCacheManager |
| 40 | { |
| 41 | @private |
| 42 | CWFolder *_folder; |
| 43 | |
| 44 | unsigned int _modification_date; // FIXME this should become NSTimeInterval or at least longer |
| 45 | NSUInteger _size; |
| 46 | } |
| 47 | |
| 48 | - (void) readAllMessages; |
| 49 | - (void) readMessagesInRange: (NSRange) theRange; |
| 50 | |
| 51 | /*! |
| 52 | @method initWithPath:folder: |
| 53 | @discussion This is the designated initialization method |
| 54 | for the local cache manager. |
| 55 | @param thePath The path where the cache file is. |
| 56 | @param theFolder The CWLocalFolder instance to be used together |
| 57 | with the cache file. |
| 58 | @result A CWLocalCacheManager instance, nil otherwise. |
| 59 | */ |
| 60 | - (id) initWithPath: (NSString *) thePath folder: (id) theFolder; |
| 61 | |
| 62 | /*! |
| 63 | @method modificationDate |
| 64 | @discussion This method is used to obtain the modification date |
| 65 | of the receiver. That is, the last time the cache |
| 66 | was written to disk. |
| 67 | @result The date. |
| 68 | */ |
| 69 | - (NSDate *) modificationDate; |
| 70 | |
| 71 | /*! |
| 72 | @method setModificationDate: |
| 73 | @discussion This method is used to set the modification date |
| 74 | of the receiver. Normally you should not invoke |
| 75 | this method directly. |
| 76 | @param theDate The new date value. |
| 77 | */ |
| 78 | - (void) setModificationDate: (NSDate *) theDate; |
| 79 | |
| 80 | /*! |
| 81 | @method fileSize |
| 82 | @discussion This method is used to obtain the size of the |
| 83 | associated CWLocalFolder's mailbox. |
| 84 | @result The size. |
| 85 | */ |
| 86 | - (NSUInteger) fileSize; |
| 87 | |
| 88 | /*! |
| 89 | @method setFileSize: |
| 90 | @discussion This method is used to set the size of the |
| 91 | associated LocalFolder's mailbox. |
| 92 | Normally you should not invoke |
| 93 | this method directly. |
| 94 | @param theSize The new size value. |
| 95 | */ |
| 96 | - (void) setFileSize: (unsigned int) theSize; |
| 97 | |
| 98 | /*! |
| 99 | @method writeRecord: |
| 100 | @discussion This method is used to write a cache record to disk. |
| 101 | @param theRecord The record to write. |
| 102 | */ |
| 103 | - (void) writeRecord: (cache_record *) theRecord; |
| 104 | @end |
| 105 | |
| 106 | #endif // _Pantomime_H_LocalCacheManager |