| 1 | /* |
| 2 | ** CWFlags.h |
| 3 | ** |
| 4 | ** Copyright (c) 2001-2006 Ludovic Marcotte |
| 5 | ** |
| 6 | ** Author: Ludovic Marcotte <[email protected]> |
| 7 | ** |
| 8 | ** This library is free software; you can redistribute it and/or |
| 9 | ** modify it under the terms of the GNU Lesser General Public |
| 10 | ** License as published by the Free Software Foundation; either |
| 11 | ** version 2.1 of the License, or (at your option) any later version. |
| 12 | ** |
| 13 | ** This library is distributed in the hope that it will be useful, |
| 14 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | ** Lesser General Public License for more details. |
| 17 | ** |
| 18 | ** You should have received a copy of the GNU General Public License |
| 19 | ** along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | |
| 22 | #ifndef _Pantomime_H_CWFlags |
| 23 | #define _Pantomime_H_CWFlags |
| 24 | |
| 25 | #import <Foundation/NSCoder.h> |
| 26 | #import <Foundation/NSObject.h> |
| 27 | #import <Foundation/NSString.h> |
| 28 | #import <Foundation/NSValue.h> |
| 29 | |
| 30 | #include <Pantomime/CWConstants.h> |
| 31 | |
| 32 | /*! |
| 33 | @class CWFlags |
| 34 | @abstract This class provides an interface to message flags. |
| 35 | @discussion This class provides methods to deal with message flags. Each message |
| 36 | has a set of flags, like answered, deleted, seen, unread, etc. |
| 37 | See the PantomimeFlag enum for the list of possible values. |
| 38 | */ |
| 39 | @interface CWFlags : NSObject <NSCoding, NSCopying> |
| 40 | { |
| 41 | @public |
| 42 | PantomimeFlag flags; |
| 43 | } |
| 44 | |
| 45 | /*! |
| 46 | @method initWithFlags: |
| 47 | @discussion This is the designed initializer for the CWFlags class. |
| 48 | @param theFlags The initial set of flags the CWFlags instance will hold. |
| 49 | Flags are part of the PantomimeFlag enum and can be |
| 50 | combined with a bitwise OR. |
| 51 | @result A Flags instance. |
| 52 | */ |
| 53 | - (id) initWithFlags: (PantomimeFlag) theFlags; |
| 54 | |
| 55 | /*! |
| 56 | @method add: |
| 57 | @discussion This method is used to add (combine) an additional |
| 58 | flag to an existing set of flags. |
| 59 | @param theFlag The flag to add. This value is one of the values |
| 60 | of the PantomimeFlag enum. |
| 61 | */ |
| 62 | - (void) add: (PantomimeFlag) theFlag; |
| 63 | |
| 64 | /*! |
| 65 | @method addFlagsFromData: |
| 66 | @discussion This method is used to add flags contained in a |
| 67 | NSData instance. Such flags are come normally from |
| 68 | parsing a mailbox that contains Status or X-Status |
| 69 | headers or from the maildir's info. |
| 70 | @param theData The NSData instance from which to parse the flags. |
| 71 | @param theFormat The format we are parsing. |
| 72 | */ |
| 73 | - (void) addFlagsFromData: (NSData *) theData |
| 74 | format: (PantomimeFolderFormat) theFormat; |
| 75 | |
| 76 | /*! |
| 77 | @method contain: |
| 78 | @discussion This method is used to verify if a specific file |
| 79 | is present in the flags set. |
| 80 | @param theFlag The flag to verify the presence in the set. Possible |
| 81 | values are part of the PantomimeFlag enum. |
| 82 | @result YES if the flag is present, NO otherwise. |
| 83 | */ |
| 84 | - (BOOL) contain: (PantomimeFlag) theFlag; |
| 85 | |
| 86 | /*! |
| 87 | @method replaceWithFlags: |
| 88 | @discussion This method is used to replace all flags from the receiver |
| 89 | with the ones specified in <i>theFlags</i>. |
| 90 | @param theFlags The CWFlags instance which holds the new set of flags. |
| 91 | */ |
| 92 | - (void) replaceWithFlags: (CWFlags *) theFlags; |
| 93 | |
| 94 | /*! |
| 95 | @method remove: |
| 96 | @discussion This method is used to remove a flag from the receicer's |
| 97 | set of flags. The possibile values are part of the PantomimeFlag enum. |
| 98 | @param theFlag The flag to remove from the set of flags. |
| 99 | */ |
| 100 | - (void) remove: (PantomimeFlag) theFlag; |
| 101 | |
| 102 | /*! |
| 103 | @method removeAll |
| 104 | @discussion This method is used to remove all flags from the receiver. |
| 105 | */ |
| 106 | - (void) removeAll; |
| 107 | |
| 108 | /*! |
| 109 | @method statusString |
| 110 | @discussion This method is used to return a string value of the flags. |
| 111 | This representation is commonly used by MUA:s like Pine |
| 112 | and belongs to the "Status:" header. |
| 113 | @result A string value of the flags. |
| 114 | */ |
| 115 | - (NSString *) statusString; |
| 116 | |
| 117 | /*! |
| 118 | @method xstatusString |
| 119 | @discussion This method is used to return a string value of the flags. |
| 120 | This representation is commonly used by MUA:s like Pine |
| 121 | and belongs to the "X-Status:" header. |
| 122 | @result A string value of the flags. |
| 123 | */ |
| 124 | - (NSString *) xstatusString; |
| 125 | |
| 126 | /*! |
| 127 | @method maildirString |
| 128 | @discussion This method is used to return a string value of the flags. |
| 129 | This representation is used by the maildir format. It |
| 130 | corresponds to the info semantics and is equivalent |
| 131 | to the Status field of the mbox format. The returned |
| 132 | string always begins with "2,". |
| 133 | @result A string value of the flags. |
| 134 | */ |
| 135 | - (NSString *) maildirString; |
| 136 | |
| 137 | @end |
| 138 | |
| 139 | #endif // _Pantomime_H_CWFlags |