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