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
|
/* -*-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/Foundation.h>
// --- Notifications ---
/**
* When feed finishes parsing, it posts this notification
* with itself as object and nil for userInfo.
**/
extern NSString *const RSSFeedFetchedNotification;
/**
* When feed fetching in background failed or feed fails to process data,
* it posts this notification
* with itself as object.
* userInfo: @"Reason" for a string of failed reason. It could be nil.
**/
extern NSString *const RSSFeedFetchFailedNotification;
/**
* When a feed is about to fetch, it first posts this notification
* with itself as object and nil as userInfo.
*/
extern NSString *const RSSFeedWillFetchNotification;
// ---------------------
/**
* The errors that can occur when fetching a feed.
*/
enum RSSFeedError
{
RSSFeedErrorNoError = 0, ///< No error occured
RSSFeedErrorNoFetcherError, ///< @deprecated
RSSFeedErrorMalformedURL, ///< Malformed URL
RSSFeedErrorDomainNotKnown, ///< Domain not known
RSSFeedErrorServerNotReachable, ///< Server not reachable
RSSFeedErrorDocumentNotPresent, ///< Document not present on server
RSSFeedErrorMalformedRSS ///< Malformed RSS / Parsing error
};
/**
* The RSS feed protocol defines the way users are supposed to talk to
* a feed.
*/
@protocol RSSFeed
// Article access
/**
* @return an enumerator for the articles in this feed
*/
- (NSEnumerator*) articleEnumerator;
/**
* @return a set that contains this feed's articles
*/
- (NSSet*) articleSet;
/**
* @return the number of articles in this feed
*/
- (int) articleCount;
/**
* Returns YES if and only if this feed is currently being fetched.
*/
- (BOOL)isFetching;
/**
* @return The name of the feed
*/
- (NSString*) feedName;
/**
* @return the URL where the feed can be downloaded from (as NSURL object)
* @see NSURL
*/
- (NSURL*) feedURL;
/**
* Fetches the feed from the web.
*
* @return An error number (of type enum RSSFeedError)
* @see NSURL
* @see RSSFeedError
*/
- (enum RSSFeedError) fetch;
/**
* Fetches the feed from the web. Feed fetching is done
* in the background. When the feed is fetched, the feed
* will post a RSSFeedFetchedNotification.
*
* @see RSSFeedFetchedNotification
**/
- (void) fetchInBackground;
/**
* Returns the last fetching error.
*/
- (enum RSSFeedError) lastError;
/**
* Returns a NSDictionary object that is property-list compatible and
* contains all information required to rebuild this article object.
*/
- (NSMutableDictionary*) plistDictionary;
@end
@protocol RSSMutableFeed <RSSFeed>
/**
* Deletes an article from the feed.
*
* @param article The article to delete.
*/
- (void) removeArticle: (id) article;
/**
* Sets the feed name
*/
- (void) setFeedName: (NSString*) aFeedName;
@end
|