RSSKit  0.6.1
RSSFeed.h
00001 /*  -*-objc-*-
00002  *
00003  *  GNUstep RSS Kit
00004  *  Copyright (C) 2006 Guenther Noack
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License as published by the Free Software Foundation, in version 2.1
00009  *  of the License
00010  * 
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014  *  Lesser General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Lesser General Public
00017  *  License along with this library; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 #import <objc/objc.h>
00022 #import <Foundation/Foundation.h>
00023 
00024 #import "RSSFeedProtocol.h"
00025 
00026 
00027 #import "RSSArticle.h"
00028 
00032 enum RSSFeedStatus
00033   {
00034     RSSFeedIsFetching,
00035     RSSFeedIsIdle
00036   };
00037 
00038 
00084 @interface RSSFeed : NSObject <RSSMutableFeed>
00085 {
00086 @protected
00087   NSDate*           lastRetrieval;
00088   BOOL              clearFeedBeforeFetching;
00089   NSMutableArray*   articles;
00090   enum RSSFeedError lastError;
00091   NSString*         feedName;
00092   NSURL*            feedURL;
00093   Class             articleClass;
00094   
00095   enum RSSFeedStatus status;
00096 
00097   NSMutableData *cacheData; // Used only when load in background.
00098 }
00099 
00100 
00101 + (RSSFeed *) feed;
00102 + (RSSFeed *) feedWithURL: (NSURL*) aURL;
00103 
00104 - (id) init;
00105 
00111 - (id) initWithURL: (NSURL*) aURL;
00112 
00113 
00117 -(NSString*) description;
00118 
00119 
00120 // ----------------------------------------------------------------------
00121 // Status access
00122 // ----------------------------------------------------------------------
00123 
00134 - (enum RSSFeedStatus) status;
00135 
00139 - (BOOL)isFetching;
00140 
00141 // ----------------------------------------------------------------------
00142 // Access to the articles
00143 // ----------------------------------------------------------------------
00144 
00145 // Note: please refer to RSSFeed protocol instead.
00146 
00150 - (NSEnumerator*) articleEnumerator;
00151 
00157 - (void) removeArticle: (RSSArticle*) article;
00158 
00159 
00160 
00161 // ----------------------------------------------------------------------
00162 // Access to the preferences
00163 // ----------------------------------------------------------------------
00164 
00168 - (void) setFeedName: (NSString*) aFeedName;
00169 
00173 - (NSString*) feedName;
00174 
00179 - (NSURL*) feedURL;
00180 
00181 
00182 
00183 // --------------------------------------------------------------------
00184 // Equality and hash codes
00185 // --------------------------------------------------------------------
00186 - (BOOL) isEqual: (id)anObject;
00187 
00188 
00189 // --------------------------------------------------------------------
00190 // Accessor and Mutator for the automatic clearing
00191 // --------------------------------------------------------------------
00192 
00200 - (void) setAutoClear: (BOOL) autoClear;
00201 
00202 
00207 - (BOOL) autoClear;
00208 
00209 
00213 - (void) clearArticles;
00214 
00215 
00216 
00217 // ------------------------------------------------------------------
00218 // Extensions that make subclassing RSSFeed and RSSArticle easier.
00219 // ------------------------------------------------------------------
00220 
00227 -(void) setArticleClass:(Class)aClass;
00228 
00235 -(Class) articleClass;
00236 
00237 
00238 // ------------------------------------------------------------------
00239 // Dirtyness, now implemented via the date of last retrieval
00240 // ------------------------------------------------------------------
00241 
00248 -(NSDate*) lastRetrieval;
00249 
00250 
00254 -(void) newArticleFound: (id) anArticle;
00255 
00256 @end
00257 
00258