RSSKit  0.6.1
RSSFeed.h
1 /* -*-objc-*-
2  *
3  * GNUstep RSS Kit
4  * Copyright (C) 2006 Guenther Noack
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation, in version 2.1
9  * of the License
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 #import <objc/objc.h>
22 #import <Foundation/Foundation.h>
23 
24 #import "RSSFeedProtocol.h"
25 
26 
27 #import "RSSArticle.h"
28 
32 enum RSSFeedStatus
33  {
34  RSSFeedIsFetching,
35  RSSFeedIsIdle
36  };
37 
38 
84 @interface RSSFeed : NSObject <RSSMutableFeed>
85 {
86 @protected
87  NSDate* lastRetrieval;
88  BOOL clearFeedBeforeFetching;
89  NSMutableArray* articles;
90  enum RSSFeedError lastError;
91  NSString* feedName;
92  NSURL* feedURL;
93  Class articleClass;
94 
95  enum RSSFeedStatus status;
96 
97  NSMutableData *cacheData; // Used only when load in background.
98 }
99 
100 
101 + (RSSFeed *) feed;
102 + (RSSFeed *) feedWithURL: (NSURL*) aURL;
103 
104 - (id) init;
105 
111 - (id) initWithURL: (NSURL*) aURL;
112 
113 
117 -(NSString*) description;
118 
119 
120 // ----------------------------------------------------------------------
121 // Status access
122 // ----------------------------------------------------------------------
123 
134 - (enum RSSFeedStatus) status;
135 
139 - (BOOL)isFetching;
140 
141 // ----------------------------------------------------------------------
142 // Access to the articles
143 // ----------------------------------------------------------------------
144 
145 // Note: please refer to RSSFeed protocol instead.
146 
150 - (NSEnumerator*) articleEnumerator;
151 
157 - (void) removeArticle: (RSSArticle*) article;
158 
159 
160 
161 // ----------------------------------------------------------------------
162 // Access to the preferences
163 // ----------------------------------------------------------------------
164 
168 - (void) setFeedName: (NSString*) aFeedName;
169 
173 - (NSString*) feedName;
174 
179 - (NSURL*) feedURL;
180 
181 
182 
183 // --------------------------------------------------------------------
184 // Equality and hash codes
185 // --------------------------------------------------------------------
186 - (BOOL) isEqual: (id)anObject;
187 
188 
189 // --------------------------------------------------------------------
190 // Accessor and Mutator for the automatic clearing
191 // --------------------------------------------------------------------
192 
200 - (void) setAutoClear: (BOOL) autoClear;
201 
202 
207 - (BOOL) autoClear;
208 
209 
213 - (void) clearArticles;
214 
215 
216 
217 // ------------------------------------------------------------------
218 // Extensions that make subclassing RSSFeed and RSSArticle easier.
219 // ------------------------------------------------------------------
220 
227 -(void) setArticleClass:(Class)aClass;
228 
235 -(Class) articleClass;
236 
237 
238 // ------------------------------------------------------------------
239 // Dirtyness, now implemented via the date of last retrieval
240 // ------------------------------------------------------------------
241 
248 -(NSDate*) lastRetrieval;
249 
250 
254 -(void) newArticleFound: (id) anArticle;
255 
256 @end
257 
258