1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
/* -*-objc-*-
*
* GNUstep RSS Kit
* Copyright (C) 2006 Guenther Noack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, in version 2.1
* of the License
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Foundation/NSObject.h>
#import <Foundation/NSURL.h>
#import "RSSFeedProtocol.h"
/**
* When an article changes, it sends this notification with itself
* as notification object.
*/
extern NSString* RSSArticleChangedNotification;
/**
* Classes implementing this protocol can be used as RSSArticles.
*/
@protocol RSSArticle <NSObject>
/// @return The headline of the article
- (NSString*) headline;
/// @return The URL of the full version of the article (as NSString*)
- (NSString*) url;
/// @return The full text, an excerpt or a summary from the article
- (NSString*) content;
/**
* Returns an NSArray containing NSURL objects or nil,
* if there are none. The contained NSURL objects often
* have the "type" and "rel" properties set. See the
* documentation for addLink: for details.
*
* @return The links of the article.
*/
- (NSArray*) links;
/**
* Returns the date of the publication of the article.
* If the source feed of this article didn't contain information
* about this date, the fetching date is usually returned.
*
* @return The date of the publication of the article
*/
- (NSDate*) date;
/**
* Returns the Enclosure object of this article as URL.
* If there is no enclosure object, nil is returned.
*
* @return the URL of this article's enclosure object
*/
- (NSURL*) enclosure;
/**
* Sets the feed's autoclear flag. This flag determines if
* the feed's articles are removed before fetching new articles.
*/
-(void) setAutoClear: (BOOL) autoClear;
/**
* Returns the feed's autoclear flag. This flag determines if
* the feed's articles are removed before fetching new articles.
*
* @return the feed's autoclear flag
*/
-(BOOL) autoClear;
/**
* Returns the source feed of this article.
*
* @warning It's not guaranteed that this object actually exists.
* Be aware of segmentation faults!
*
* If you want to make sure the object exists, you have to follow
* these rules:
*
* <ul>
* <li>Don't retain any article!</li>
* <li>Don't call the (undocumented) <code>setFeed:</code> (Colon!) method.</li>
* </ul>
*
* @return The source feed of this article
*/
- (id<RSSFeed>) feed;
/**
* Returns a NSDictionary that represents the article and that can be used
* to generate the article again. The dictionary must be property list compatible.
*/
- (NSDictionary*) plistDictionary;
/**
* Saves the article to the URL that's calculated by the RSSFactory.
*/
- (BOOL) store;
/**
* This method is intended to make sure that the replacing article keeps
* some fields from the old (this) article. Subclasses will probably want
* to override this, but shouldn't forget calling the super implementation,
* first.
*/
- (void) willBeReplacedByArticle: (id) newArticle;
@end
/**
* Instances conforming to this protocol can be modified. Applications
* usually don't want to modify articles, as they are already created by the
* feeds, so handing around articles as id<RSSArticle> is a good way to ensure
* nobody (without malicious intentions) is going to change them.
*/
@protocol RSSMutableArticle <RSSArticle>
/**
* Adds a new link to this article.
* This is a RSSLink object, which usually has
* the "type" property set to an NSString which
* represents the resource's MIME type. You may
* also specify the "rel" property, which should
* be one of "enclosure", "related", "alternate",
* "via".
*/
- (void) addLink:(NSURL*) anURL;
/**
* Replaces the list of links with a new one.
* See the documentation for addLink: for details.
* Hint: The parameter may also be nil.
*/
- (void) setLinks: (NSArray*) someLinks;
// only used internally
- (void) setFeed: (id) aFeed;
/**
* Sets the article's date.
*/
- (void) setDate: (NSDate*) aDate;
@end
|