| 1 | /* |
| 2 | ** CWUUFile.h |
| 3 | ** |
| 4 | ** Copyright (c) 2002-2004 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_CWUUFile |
| 23 | #define _Pantomime_H_CWUUFile |
| 24 | |
| 25 | #import <Foundation/NSData.h> |
| 26 | #import <Foundation/NSDictionary.h> |
| 27 | #import <Foundation/NSObject.h> |
| 28 | #import <Foundation/NSString.h> |
| 29 | |
| 30 | /*! |
| 31 | @class CWUUFile |
| 32 | @abstract Provides an interface to decode information that is uuencoded. |
| 33 | @discussion This class provides an interface to decode uuencoded information |
| 34 | from a string and access / mutation methods to access or modify the |
| 35 | decoded information. |
| 36 | */ |
| 37 | @interface CWUUFile : NSObject |
| 38 | { |
| 39 | NSDictionary *_attributes; |
| 40 | NSString *_name; |
| 41 | NSData *_data; |
| 42 | } |
| 43 | |
| 44 | /*! |
| 45 | @method initWithName: data: attributes: |
| 46 | @discussion This is the designated initializer for the CWUUFile class. |
| 47 | @param theName The name of the file. |
| 48 | @param theData The bytes of the file. |
| 49 | @param theAttributes The file attributes of the original file. |
| 50 | @result An instance of CWUUFile, nil on error. |
| 51 | */ |
| 52 | - (id) initWithName: (NSString *) theName |
| 53 | data: (NSData *) theData |
| 54 | attributes: (NSDictionary *) theAttributes; |
| 55 | |
| 56 | /*! |
| 57 | @method name |
| 58 | @discussion This method is used to obtain the name of the file. |
| 59 | @result The name of the file. |
| 60 | */ |
| 61 | - (NSString *) name; |
| 62 | |
| 63 | /*! |
| 64 | @method setName: |
| 65 | @discussion This method is used to set the name of the file. |
| 66 | @param theName The name of the file. |
| 67 | */ |
| 68 | - (void) setName: (NSString *) theName; |
| 69 | |
| 70 | /*! |
| 71 | @method data |
| 72 | @discussion This method is used to obtain the bytes of the file, |
| 73 | as an NSData instance. |
| 74 | @result The bytes of the file. |
| 75 | */ |
| 76 | - (NSData *) data; |
| 77 | |
| 78 | /*! |
| 79 | @method setData: |
| 80 | @discussion This method is used to set the bytes of the file, |
| 81 | as an NSData instance. |
| 82 | @param theData The bytes of the file. |
| 83 | */ |
| 84 | - (void) setData: (NSData *) theData; |
| 85 | |
| 86 | /*! |
| 87 | @method data |
| 88 | @discussion This method is used to obtain the attributes of the file, |
| 89 | @result The attributes of the file. |
| 90 | */ |
| 91 | - (NSDictionary *) attributes; |
| 92 | |
| 93 | /*! |
| 94 | @method setAttributes: |
| 95 | @discussion This method is used to set the attributes of the file. |
| 96 | @param theName The attributes of the file. |
| 97 | */ |
| 98 | - (void) setAttributes: (NSDictionary *) theAttributes; |
| 99 | |
| 100 | /*! |
| 101 | @method fileFromUUEncodedString: |
| 102 | @discussion This method will decode a uuencoded file from <i>theString</i>. |
| 103 | You must pass the entire string of the uuencoded file, and |
| 104 | only this. |
| 105 | @result The CWUUFile instance. |
| 106 | */ |
| 107 | + (CWUUFile *) fileFromUUEncodedString: (NSString *) theString; |
| 108 | |
| 109 | /*! |
| 110 | @method rangeOfUUEncodedStringFromString: range: |
| 111 | @discussion This method is used to obtain the range of a uuencoded |
| 112 | file from <i>theString</i> in <i>theRange</i>. |
| 113 | @result The range of the uuencoded file. |
| 114 | */ |
| 115 | + (NSRange) rangeOfUUEncodedStringFromString: (NSString *) theString |
| 116 | range: (NSRange) theRange; |
| 117 | |
| 118 | @end |
| 119 | |
| 120 | #endif // _Pantomime_H_CWUUFile |