RSSFeed.h

00001 /*  -*-objc-*-
00002  *
00003  *  GNUstep RSS Kit
00004  *  Copyright (C) 2006 Guenther Noack
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License version 2 as
00008  *  published by the Free Software Foundation.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #import <objc/objc.h>
00021 #import <Foundation/Foundation.h>
00022 
00023 @class RSSFeed;
00024 
00025 
00026 #import "RSSArticle.h"
00027 
00031 enum RSSFeedError
00032   {
00033     RSSFeedErrorNoError = 0,         
00034     RSSFeedErrorNoFetcherError,      
00035     RSSFeedErrorMalformedURL,        
00036     RSSFeedErrorDomainNotKnown,      
00037     RSSFeedErrorServerNotReachable,  
00038     RSSFeedErrorDocumentNotPresent,  
00039     RSSFeedErrorMalformedRSS         
00040   };
00041 
00045 enum RSSFeedStatus
00046   {
00047     RSSFeedIsFetching,
00048     RSSFeedIsIdle
00049   };
00050 
00054 @protocol RSSFeedDelegate;
00055 
00107 @interface RSSFeed : NSObject <NSCoding>
00108 {
00109 @protected
00110   NSDate*           lastRetrieval;
00111   BOOL              clearFeedBeforeFetching;
00112   NSArray*          articles;
00113   enum RSSFeedError lastError;
00114   NSString*         feedName;
00115   NSURL*            feedURL;
00116   Class             articleClass;
00117   
00118   enum RSSFeedStatus status;
00119   NSRecursiveLock*  lock;
00120   
00121   id<RSSFeedDelegate> _delegate;
00122 }
00123 
00124 
00125 +feed;
00126 +feedWithURL: (NSURL*) aURL;
00127 
00128 -init;
00129 
00135 -initWithURL: (NSURL*) aURL;
00136 
00137 
00141 -(NSString*) description;
00142 
00143 // ----------------------------------------------------------------------
00144 // The RSSFeed's delegate
00145 // ----------------------------------------------------------------------
00146 
00147 -(void)setDelegate: (id<RSSFeedDelegate>)aDelegate;
00148 -(id<RSSFeedDelegate>)delegate;
00149 
00150 // ----------------------------------------------------------------------
00151 // NSCoding methods
00152 // ----------------------------------------------------------------------
00153 
00154 -(id)initWithCoder: (NSCoder*)coder;
00155 -(void)encodeWithCoder: (NSCoder*)coder;
00156 
00157 
00158 // ----------------------------------------------------------------------
00159 // Status access
00160 // ----------------------------------------------------------------------
00161 
00169 - (enum RSSFeedStatus) status;
00170 
00171 
00172 // ----------------------------------------------------------------------
00173 // Access to the articles
00174 // ----------------------------------------------------------------------
00175 
00188 - (RSSArticle*) articleAtIndex: (int) index;
00189 
00193 - (unsigned int) count;
00194 
00198 - (NSEnumerator*) articleEnumerator;
00199 
00205 - (void) removeArticle: (RSSArticle*) article;
00206 
00207 
00208 
00209 // ----------------------------------------------------------------------
00210 // Access to the preferences
00211 // ----------------------------------------------------------------------
00212 
00216 - (NSString*) feedName;
00217 
00222 - (NSURL*) feedURL;
00223 
00224 
00225 
00226 // --------------------------------------------------------------------
00227 // Equality and hash codes
00228 // --------------------------------------------------------------------
00229 - (unsigned) hash;
00230 - (BOOL) isEqual: (id)anObject;
00231 
00232 
00233 // --------------------------------------------------------------------
00234 // Accessor and Mutator for the automatic clearing
00235 // --------------------------------------------------------------------
00236 
00244 - (void) setAutoClear: (BOOL) autoClear;
00245 
00246 
00251 - (BOOL) autoClear;
00252 
00253 
00257 - (void) clearArticles;
00258 
00259 
00260 
00261 // ------------------------------------------------------------------
00262 // Extensions that make subclassing RSSFeed and RSSArticle easier.
00263 // ------------------------------------------------------------------
00264 
00271 -(void) setArticleClass:(Class)aClass;
00272 
00279 -(Class) articleClass;
00280 
00281 
00282 // ------------------------------------------------------------------
00283 // Dirtyness, now implemented via the date of last retrieval
00284 // ------------------------------------------------------------------
00285 
00292 -(NSDate*) lastRetrieval;
00293 
00294 
00298 -(void) newArticleFound: (RSSArticle*) anArticle;
00299 
00300 @end
00301 
00302 
00303 
00304 /*
00305  * FIXME: Hide this interface in some other header file
00306  * so that programmers don't get confused.
00307  */
00308 
00309 @interface RSSFeed (Private)
00310 
00317 -(BOOL) _submitArticles: (NSArray*) newArticles;
00318 
00319 @end
00320 
00321 
00327 @protocol RSSFeedDelegate <NSObject>
00328 
00332 - (void) feed: (RSSFeed*) aFeed
00333  addedArticle: (RSSArticle*) anArticle;
00334 
00335 @end

Generated on Thu Aug 3 00:51:27 2006 for RSSKit by  doxygen 1.4.6