| 1 | /* |
| 2 | ** CWURLName.h |
| 3 | ** |
| 4 | ** Copyright (c) 2001-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_CWURLName |
| 23 | #define _Pantomime_H_CWURLName |
| 24 | |
| 25 | #import <Foundation/NSObject.h> |
| 26 | #import <Foundation/NSString.h> |
| 27 | |
| 28 | /*! |
| 29 | @class CWURLName |
| 30 | @discussion This class provides support for handling POP3, IMAP and |
| 31 | local URL schemes. The POP3 URL scheme is described in |
| 32 | RFC 2384. The IMAP URL scheme is described in RFC 2192 |
| 33 | while the local URL scheme is a simple Pantomime scheme |
| 34 | to refer to local mailboxes. |
| 35 | */ |
| 36 | @interface CWURLName : NSObject |
| 37 | { |
| 38 | @private |
| 39 | NSString *_protocol; |
| 40 | NSString *_foldername; |
| 41 | NSString *_path; |
| 42 | |
| 43 | NSString *_host; |
| 44 | unsigned int _port; |
| 45 | |
| 46 | NSString *_username; |
| 47 | NSString *_password; |
| 48 | } |
| 49 | |
| 50 | /*! |
| 51 | @method initWithString: |
| 52 | @discussion This method invokes -initWithString: path: |
| 53 | with a <i>nil</i> path. |
| 54 | @param theString The URL. |
| 55 | @result A CWURLName instance, nil on error. |
| 56 | */ |
| 57 | - (id) initWithString: (NSString *) theString; |
| 58 | |
| 59 | /*! |
| 60 | @method initWithString: path: |
| 61 | @discussion This is the designated initializer for the |
| 62 | URLName class. |
| 63 | @param theString The URL. |
| 64 | @param thePath The path to the local mailstore. |
| 65 | @result A CWURLName instance, nil on error. |
| 66 | */ |
| 67 | - (id) initWithString: (NSString *) theString |
| 68 | path: (NSString *) thePath; |
| 69 | |
| 70 | |
| 71 | /*! |
| 72 | @method protocol |
| 73 | @discussion This method is used to obtain the protocol part |
| 74 | of an URL. |
| 75 | @result POP3, IMAP or LOCAL. |
| 76 | */ |
| 77 | - (NSString *) protocol; |
| 78 | |
| 79 | /*! |
| 80 | @method foldername |
| 81 | @discussion This method is used to obtain the name of the |
| 82 | folder of the receiver. |
| 83 | @result The name of the folder. |
| 84 | */ |
| 85 | - (NSString *) foldername; |
| 86 | |
| 87 | /*! |
| 88 | @method path |
| 89 | @discussion This method is used to obtain the path to the mailstore. |
| 90 | @result The full path. |
| 91 | */ |
| 92 | - (NSString *) path; |
| 93 | |
| 94 | /*! |
| 95 | @method host |
| 96 | @discussion This method is used to obtain the host name part |
| 97 | of an URL. |
| 98 | @result The host name. |
| 99 | */ |
| 100 | - (NSString *) host; |
| 101 | |
| 102 | /*! |
| 103 | @method host |
| 104 | @discussion This method is used to obtain the port part |
| 105 | of an URL. |
| 106 | @result The port. |
| 107 | */ |
| 108 | - (unsigned int) port; |
| 109 | |
| 110 | /*! |
| 111 | @method username |
| 112 | @discussion This method is used to obtain the username part |
| 113 | of an URL. |
| 114 | @result The username. |
| 115 | */ |
| 116 | - (NSString *) username; |
| 117 | |
| 118 | /*! |
| 119 | @method password |
| 120 | @discussion This method is used to obtain the password part |
| 121 | of an URL. |
| 122 | @result The password. |
| 123 | */ |
| 124 | - (NSString *) password; |
| 125 | |
| 126 | /*! |
| 127 | @method stringValue |
| 128 | @discussion This method is used to obtain the string |
| 129 | representation of the receiver. The returned |
| 130 | format is the same as one that could be |
| 131 | used by an initializer. |
| 132 | @result The string value. |
| 133 | */ |
| 134 | - (NSString *) stringValue; |
| 135 | |
| 136 | @end |
| 137 | |
| 138 | #endif // _Pantomime_H_CWURLName |